diff options
author | Ben Cheng <bccheng@google.com> | 2012-03-07 23:04:02 -0800 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2012-03-08 17:00:54 -0800 |
commit | cc6695e2684ce93cdf8bd2da63d55d2cf49ff076 (patch) | |
tree | 58f9941f89a1bde4e068610a507f86c6cb02eadf | |
parent | 669e96ff41a1b72aa034a26563d90b4768d51482 (diff) | |
download | android_external_elfutils-cc6695e2684ce93cdf8bd2da63d55d2cf49ff076.tar.gz android_external_elfutils-cc6695e2684ce93cdf8bd2da63d55d2cf49ff076.tar.bz2 android_external_elfutils-cc6695e2684ce93cdf8bd2da63d55d2cf49ff076.zip |
Upgrade elfutils from version 0.97 to 0.138
This upgrade is in preparation for adding perf to the Android tree, where
perf needs newer version of elfutils.
This particular snapshot also cleans up the current makefile where only
the host version of libelf.a (needed by elftree). Additional build
targets for libebl.a, libebl_arm.a, and libebl_sh.a are eliminated since
they are not used in the tree at all.
Changes that build other target modules and associated modifications to
work with bionic will be added later.
Change-Id: Ifa808ba5ad2881ccb2c0cf44d134931faad801e1
821 files changed, 100962 insertions, 43107 deletions
@@ -1,10 +1,11 @@ -Notes on the Free Translation Project -************************************* +1 Notes on the Free Translation Project +*************************************** - Free software is going international! The Free Translation Project -is a way to get maintainers of free software, translators, and users all -together, so that will gradually become able to speak many languages. -A few packages already provide translations for their messages. +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, @@ -15,41 +16,78 @@ this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and -work at translations should contact the appropriate team. +work on translations can contact the appropriate team. When reporting bugs in the `intl/' directory or bugs which may be related to internationalization, you should tell about the version of `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. -INSTALL Matters -=============== +1.1 Quick configuration advice +============================== - Some packages are "localizable" when properly installed; the -programs they contain can be made to speak your own native language. -Most such packages use GNU `gettext'. Other packages have their own -ways to internationalization, predating GNU `gettext'. +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already -provides the GNU `gettext' functions. If not, the GNU `gettext' own -library will be used. This library is wholly contained within this -package, usually in the `intl/' subdirectory, so prior installation of -the GNU `gettext' package is _not_ required. Installers may use -special options at configuration time for changing the default -behaviour. The command: +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + ./configure --with-included-gettext ./configure --disable-nls -will bypass any pre-existing `gettext' to _totally_ disable translation -of messages. +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. The configuration process will not test for the `catgets' function and therefore it will not be used. The reason is that even an emulation of `gettext' on top of `catgets' could not provide all the extensions of the GNU `gettext' library. - Internationalized packages have usually many `po/LL.po' files, where + Internationalized packages usually have many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at `configure' time by using the `--disable-nls' switch, all available translations are installed @@ -58,10 +96,10 @@ may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. -Using This Package -================== +1.3 Using This Package +====================== - As a user, if your language has been installed for this package, you +As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate `LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, and `CC' is an ISO 3166 two-letter country code. For example, let's @@ -80,8 +118,8 @@ country code serves to distinguish the dialects. language and `CC' denoting the country, is the one use on systems based on GNU libc. On other systems, some variations of this scheme are used, such as `LL' or `LL_CC.ENCODING'. You can get the list of -locales supported by your system for your country by running the command -`locale -a | grep '^LL''. +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you @@ -94,16 +132,23 @@ system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + In the `LANGUAGE' environment variable, but not in the `LANG' environment variable, `LL_CC' combinations can be abbreviated as `LL' to denote the language's main dialect. For example, `de' is equivalent to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' (Portuguese as spoken in Portugal) in this context. -Translating Teams -================= +1.4 Translating Teams +===================== - For the Free Translation Project to be a success, we need interested +For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of @@ -127,429 +172,897 @@ get started, please write to `translation@iro.umontreal.ca' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing -the terminology in use. Proven linguistic skill are praised more than -programming skill, here. +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. -Available Packages -================== +1.5 Available Packages +====================== - Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of May 2003. -The matrix shows, in regard of each package, for which languages PO -files have been submitted to translation coordination, with a +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of October +2006. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a translation percentage of at least 50%. - Ready PO files am az be bg ca cs da de el en en_GB eo es - +-------------------------------------------+ - a2ps | [] [] [] [] | - aegis | () | - anubis | | - ap-utils | | - bash | [] [] [] | - batchelor | | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] | - bluez-pin | [] [] | - clisp | | - clisp | [] [] [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - darkstat | () [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] () [] [] [] [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] [] | - flex | [] [] [] [] | - gas | [] | - gawk | [] [] [] [] | - gcal | [] | - gcc | [] [] | - gettext | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] [] [] [] | - gliv | | - glunarclock | [] [] [] | - gnucash | () [] | - gnucash-glossary | [] () [] | - gnupg | [] () [] [] [] [] | - gpe-calendar | [] | - gpe-conf | [] | - gpe-contacts | [] | - gpe-edit | | - gpe-login | [] | - gpe-ownerinfo | [] | - gpe-sketchbook | [] | - gpe-timesheet | | - gpe-today | [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | () () () | - grep | [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] | - id-utils | [] [] | - indent | [] [] [] [] | - jpilot | [] [] [] [] | - jwhois | [] | - kbd | [] [] [] [] [] | - ld | [] [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] | - libiconv | [] [] [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lingoteach_lessons | () () | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] | - man-db | [] () [] [] () | - mysecretdiary | [] [] [] | - nano | [] () [] [] [] | - nano_1_0 | [] () [] [] [] | - opcodes | [] [] | - parted | [] [] [] [] [] | - ptx | [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] | - sh-utils | [] [] [] | - sharutils | [] [] [] [] [] [] | - sketch | [] () [] | - soundtracker | [] [] [] | - sp | [] | - tar | [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] | - tin | () () | - util-linux | [] [] [] [] [] | - vorbis-tools | [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +-------------------------------------------+ - am az be bg ca cs da de el en en_GB eo es - 0 1 4 2 31 17 54 60 14 1 4 12 56 - - et fa fi fr ga gl he hr hu id it ja ko - +----------------------------------------+ - a2ps | [] [] [] () () | - aegis | | - anubis | [] | - ap-utils | [] | - bash | [] [] | - batchelor | [] | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] [] | - bluez-pin | [] [] [] [] | - clisp | | - clisp | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] [] | - darkstat | () [] [] [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] [] [] [] | - flex | [] [] | - gas | [] | - gawk | [] [] | - gcal | [] | - gcc | [] | - gettext | [] [] [] | - gettext-runtime | [] [] [] [] | - gettext-tools | [] | - gimp-print | [] [] | - gliv | () | - glunarclock | [] [] [] [] | - gnucash | [] | - gnucash-glossary | [] | - gnupg | [] [] [] [] [] [] [] | - gpe-calendar | [] | - gpe-conf | | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] | - gpe-ownerinfo | [] [] [] | - gpe-sketchbook | [] | - gpe-timesheet | [] [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] | - gprof | [] [] | - gpsdrive | () [] () () | - grep | [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] [] [] [] | - jpilot | [] () | - jwhois | [] [] [] [] | - kbd | [] | - ld | [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] [] | - libiconv | [] [] [] [] [] [] [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] | - lingoteach_lessons | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] [] [] [] [] | - man-db | [] () () | - mysecretdiary | [] [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] | - sketch | [] | - soundtracker | [] [] [] | - sp | [] () | - tar | [] [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] [] | - tin | [] () | - util-linux | [] [] [] [] () [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +----------------------------------------+ - et fa fi fr ga gl he hr hu id it ja ko - 20 1 15 73 14 24 8 10 30 31 19 31 9 - - lg lt lv ms nb nl nn no pl pt pt_BR ro - +----------------------------------------+ - a2ps | [] [] () () () [] [] | - aegis | () | - anubis | [] [] | - ap-utils | () | - bash | [] | - batchelor | | - bfd | | - binutils | | - bison | [] [] [] [] | - bluez-pin | [] | - clisp | | - clisp | [] | - coreutils | [] | - cpio | [] [] [] | - darkstat | [] [] [] [] | - diffutils | [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] | - fetchmail | () () | - fileutils | [] | - findutils | [] [] [] [] | - flex | [] | - gas | | - gawk | [] | - gcal | | - gcc | | - gettext | [] | - gettext-runtime | [] | - gettext-tools | | - gimp-print | [] | - gliv | [] | - glunarclock | [] | - gnucash | | - gnucash-glossary | [] [] | - gnupg | | - gpe-calendar | [] [] | - gpe-conf | [] [] | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-sketchbook | [] [] | - gpe-timesheet | [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | | - gprof | [] | - gpsdrive | () () () | - grep | [] [] [] [] | - gretl | | - hello | [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] | - jpilot | () () | - jwhois | [] [] [] | - kbd | | - ld | | - libc | [] [] [] [] | - libgpewidget | [] [] | - libiconv | [] [] | - lifelines | | - lilypond | [] | - lingoteach | | - lingoteach_lessons | | - lynx | [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] | - man-db | [] | - mysecretdiary | [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] | - screem | | - sed | [] [] | - sh-utils | [] | - sharutils | [] | - sketch | [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] | - texinfo | [] | - textutils | [] | - tin | | - util-linux | [] [] | - vorbis-tools | [] [] | - wastesedge | | - wdiff | [] [] [] [] | - wget | [] [] [] | - xchat | [] [] | - xpad | [] | - +----------------------------------------+ - lg lt lv ms nb nl nn no pl pt pt_BR ro - 0 0 2 11 7 26 3 4 18 15 34 34 - - ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - +-------------------------------------------+ - a2ps | [] [] [] [] [] | 16 - aegis | () | 0 - anubis | [] [] | 5 - ap-utils | () | 1 - bash | [] | 7 - batchelor | | 1 - bfd | [] [] [] | 7 - binutils | [] [] [] | 7 - bison | [] [] | 13 - bluez-pin | | 7 - clisp | | 0 - clisp | | 5 - coreutils | [] [] [] [] [] | 14 - cpio | [] [] [] | 13 - darkstat | [] () () | 9 - diffutils | [] [] [] [] | 21 - e2fsprogs | [] | 3 - enscript | [] [] [] | 11 - error | [] [] [] | 14 - fetchmail | [] | 7 - fileutils | [] [] [] [] [] [] | 15 - findutils | [] [] [] [] [] [] | 27 - flex | [] [] [] | 10 - gas | [] | 3 - gawk | [] [] | 9 - gcal | [] [] | 4 - gcc | [] | 4 - gettext | [] [] [] [] [] [] | 15 - gettext-runtime | [] [] [] [] [] [] | 16 - gettext-tools | [] [] | 5 - gimp-print | [] [] | 10 - gliv | | 1 - glunarclock | [] [] [] | 11 - gnucash | [] [] | 4 - gnucash-glossary | [] [] [] | 8 - gnupg | [] [] [] [] | 16 - gpe-calendar | [] | 5 - gpe-conf | | 3 - gpe-contacts | [] | 4 - gpe-edit | [] | 5 - gpe-login | [] | 5 - gpe-ownerinfo | [] | 7 - gpe-sketchbook | [] | 5 - gpe-timesheet | [] | 6 - gpe-today | [] | 6 - gpe-todo | [] | 6 - gphoto2 | [] [] | 9 - gprof | [] [] | 7 - gpsdrive | [] [] | 3 - grep | [] [] [] [] | 24 - gretl | | 2 - hello | [] [] [] [] [] | 33 - id-utils | [] [] [] | 11 - indent | [] [] [] [] | 19 - jpilot | [] [] [] [] [] | 10 - jwhois | () () [] [] | 10 - kbd | [] [] | 8 - ld | [] [] | 5 - libc | [] [] [] [] | 20 - libgpewidget | | 6 - libiconv | [] [] [] [] [] [] | 21 - lifelines | [] | 2 - lilypond | [] | 4 - lingoteach | | 2 - lingoteach_lessons | () | 0 - lynx | [] [] [] [] | 14 - m4 | [] [] [] | 15 - mailutils | | 2 - make | [] [] [] [] | 15 - man-db | [] | 6 - mysecretdiary | [] [] | 8 - nano | [] [] [] | 15 - nano_1_0 | [] [] [] | 15 - opcodes | [] [] | 9 - parted | [] [] | 13 - ptx | [] [] [] | 22 - python | | 0 - radius | | 0 - recode | [] [] [] [] | 19 - screem | [] | 1 - sed | [] [] [] [] [] | 20 - sh-utils | [] [] [] | 13 - sharutils | [] [] [] [] | 16 - sketch | [] | 5 - soundtracker | [] | 7 - sp | [] | 3 - tar | [] [] [] [] [] | 24 - texinfo | [] [] [] [] | 13 - textutils | [] [] [] [] [] | 15 - tin | | 1 - util-linux | [] [] | 14 - vorbis-tools | [] | 7 - wastesedge | | 0 - wdiff | [] [] [] [] | 17 - wget | [] [] [] [] [] [] [] | 25 - xchat | [] [] [] | 11 - xpad | | 1 - +-------------------------------------------+ - 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + GNUnet | [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] [] | + bash | [] [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bison-runtime | | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | [] | + gliv | [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | () () [] | + gnucash-glossary | [] () | + gnuedu | | + gnulib | [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | | + gss | | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | () | + gtkam | [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] [] | + iso_3166 | [] [] | + iso_3166_2 | | + iso_4217 | [] | + iso_639 | [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | | + keytouch-editor | | + keytouch-keyboa... | | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | [] [] | + libidn | [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] [] | + mysecretdiary | [] [] | + nano | [] [] [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | | + pilot-qof | [] | + psmisc | [] | + pwdutils | | + python | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + silky | | + skencil | [] () | + sketch | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | () () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] | + xchat | [] [] [] [] [] [] | + xkeyboard-config | | + xpad | [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 10 0 1 2 9 22 1 42 41 2 60 95 16 1 17 16 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + darkstat | [] () [] [] [] | + dialog | [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnucash-glossary | [] [] | + gnuedu | [] | + gnulib | [] [] [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | () () [] () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] [] | + gsasl | [] [] | + gss | [] | + gst-plugins | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gstreamer | [] [] [] | + gtick | [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] [] | + impost | [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] [] | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | [] [] | + libidn | [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] [] | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | () | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] [] [] [] [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | | + silky | [] | + skencil | [] [] | + sketch | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + tp-robot | [] [] [] [] | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 88 22 14 2 40 115 61 14 1 8 1 6 59 31 0 52 + + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + +-------------------------------------------------+ + GNUnet | | + a2ps | () [] [] () | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | | + cpplib | [] | + cryptonit | [] | + darkstat | [] [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + error | [] | + fetchmail | [] [] | + fileutils | [] [] | + findutils | [] | + flex | [] [] | + fslint | [] [] | + gas | | + gawk | [] [] | + gbiff | [] | + gcal | | + gcc | | + gettext-examples | [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] | + gnubiff | | + gnucash | () () | + gnucash-glossary | [] | + gnuedu | | + gnulib | [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] | + gphoto2 | [] [] | + gprof | | + gpsdrive | () () () | + gramadoir | () | + grep | [] [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] | + gst-plugins-base | | + gst-plugins-good | [] | + gstreamer | [] | + gtick | | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | | + hello | [] [] [] [] [] [] | + id-utils | [] | + impost | | + indent | [] [] | + iso_3166 | [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] | + jpilot | () () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | | + libidn | [] [] | + lifelines | [] | + lilypond | | + lingoteach | [] | + lynx | [] [] | + m4 | [] [] | + mailutils | | + make | [] [] [] | + man-db | () | + minicom | [] | + mysecretdiary | [] | + nano | [] [] [] | + nano_1_0 | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] | + shishi | | + silky | [] | + skencil | | + sketch | | + solfege | | + soundtracker | | + sp | () | + stardict | [] [] | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + vorbis-tools | [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +-------------------------------------------------+ + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + 52 24 2 2 1 3 0 2 3 21 0 15 1 97 5 1 + + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +------------------------------------------------------+ + GNUnet | | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + darkstat | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] [] [] [] | + gas | | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gimp-print | [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () | + gnucash | () [] | + gnucash-glossary | [] [] [] | + gnuedu | | + gnulib | [] [] [] [] [] | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] | + gretl | [] | + gsasl | [] [] [] | + gss | [] [] [] | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] | + gst-plugins-good | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] | + gtkam | [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | [] | + indent | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] [] | + make | [] [] [] [] | + man-db | [] [] | + minicom | [] [] [] [] [] | + mysecretdiary | [] [] [] [] | + nano | [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | [] | + psmisc | [] [] | + pwdutils | [] [] | + python | | + qof | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + silky | [] | + skencil | [] [] [] | + sketch | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + stardict | [] [] [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] | + tin | () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | + xpad | [] [] [] | + +------------------------------------------------------+ + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 2 3 58 30 54 5 73 72 4 40 46 11 50 128 2 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + GNUnet | [] | 2 + a2ps | [] [] [] | 19 + aegis | | 0 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 15 + bash | [] | 11 + batchelor | [] [] | 9 + bfd | | 1 + bibshelf | [] | 7 + binutils | [] [] [] | 9 + bison | [] [] [] | 19 + bison-runtime | [] [] [] | 15 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 5 + clisp | | 6 + console-tools | [] [] | 5 + coreutils | [] [] | 16 + cpio | [] [] [] | 9 + cpplib | [] [] [] [] | 11 + cryptonit | | 5 + darkstat | [] () () | 15 + dialog | [] [] [] [] [] | 30 + diffutils | [] [] [] [] | 28 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + error | [] [] [] [] | 18 + fetchmail | [] [] | 12 + fileutils | [] [] [] | 18 + findutils | [] [] [] | 17 + flex | [] [] | 15 + fslint | [] | 9 + gas | [] | 3 + gawk | [] [] | 15 + gbiff | [] | 5 + gcal | [] | 5 + gcc | [] [] [] | 6 + gettext-examples | [] [] [] [] [] [] | 27 + gettext-runtime | [] [] [] [] [] [] | 28 + gettext-tools | [] [] [] [] [] | 19 + gimp-print | [] [] | 12 + gip | [] [] | 12 + gliv | [] [] | 8 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 15 + gnubiff | [] | 1 + gnucash | () | 2 + gnucash-glossary | [] [] | 9 + gnuedu | [] | 2 + gnulib | [] [] [] [] [] | 28 + gnunet-gtk | | 1 + gnutls | | 2 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] | 3 + gpe-clock | [] [] [] [] | 21 + gpe-conf | [] [] | 14 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] | 20 + gpe-filemanager | [] | 6 + gpe-go | [] [] | 15 + gpe-login | [] [] [] [] [] | 21 + gpe-ownerinfo | [] [] [] [] | 21 + gpe-package | [] | 6 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] | 20 + gpe-taskmanager | [] [] [] | 20 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 21 + gpe-todo | [] | 7 + gphoto2 | [] [] [] [] | 20 + gprof | [] [] | 11 + gpsdrive | | 4 + gramadoir | [] | 7 + grep | [] [] [] [] | 34 + gretl | | 4 + gsasl | [] [] | 8 + gss | [] | 5 + gst-plugins | [] [] [] | 15 + gst-plugins-base | [] [] [] | 9 + gst-plugins-good | [] [] [] [] [] | 20 + gstreamer | [] [] [] | 17 + gtick | [] | 3 + gtkam | [] | 13 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 26 + gutenprint | | 3 + hello | [] [] [] [] [] | 37 + id-utils | [] [] | 14 + impost | [] | 4 + indent | [] [] [] [] | 25 + iso_3166 | [] [] [] [] | 16 + iso_3166_2 | | 2 + iso_4217 | [] [] | 14 + iso_639 | [] | 14 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] | 12 + keytouch | [] | 4 + keytouch-editor | | 2 + keytouch-keyboa... | [] | 3 + latrine | [] [] | 8 + ld | [] [] [] [] | 8 + leafpad | [] [] [] [] | 23 + libc | [] [] [] | 23 + libexif | [] | 4 + libextractor | [] | 5 + libgpewidget | [] [] [] | 19 + libgpg-error | [] | 4 + libgphoto2 | [] | 8 + libgphoto2_port | [] [] [] | 11 + libgsasl | [] | 8 + libiconv | [] | 7 + libidn | [] [] | 10 + lifelines | | 4 + lilypond | | 2 + lingoteach | [] | 6 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailutils | [] | 8 + make | [] [] [] | 20 + man-db | [] | 6 + minicom | [] | 14 + mysecretdiary | [] [] | 12 + nano | [] [] | 17 + nano_1_0 | [] [] [] | 18 + opcodes | [] [] | 10 + parted | [] [] [] | 10 + pilot-qof | [] | 3 + psmisc | [] | 10 + pwdutils | [] | 3 + python | | 0 + qof | [] | 4 + radius | [] | 6 + recode | [] [] [] | 25 + rpm | [] [] [] [] | 14 + screem | [] | 2 + scrollkeeper | [] [] [] [] | 26 + sed | [] [] [] | 22 + sh-utils | [] | 15 + shared-mime-info | [] [] [] [] | 24 + sharutils | [] [] [] | 23 + shishi | | 1 + silky | [] | 4 + skencil | [] | 7 + sketch | | 6 + solfege | | 2 + soundtracker | [] [] | 9 + sp | [] | 3 + stardict | [] [] [] [] | 11 + system-tools-ba... | [] [] [] [] [] [] [] | 37 + tar | [] [] [] [] | 20 + texinfo | [] [] [] | 15 + textutils | [] [] [] | 17 + tin | | 1 + tp-robot | [] [] [] | 10 + tuxpaint | [] [] [] | 16 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] [] | 20 + vorbis-tools | [] [] | 11 + wastesedge | | 1 + wdiff | [] [] | 22 + wget | [] [] [] | 19 + xchat | [] [] [] [] | 29 + xkeyboard-config | [] [] [] [] | 11 + xpad | [] [] [] | 14 + +---------------------------------------------------+ + 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + 170 domains 0 1 1 77 39 0 136 10 1 48 5 54 0 2028 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -562,15 +1075,15 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If May 2003 seems to be old, you may fetch a more recent copy of + If October 2006 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. -Using `gettext' in new packages -=============================== +1.6 Using `gettext' in new packages +=================================== - If you are writing a freely available program and want to +If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your package. Of course you have to respect the GNU Library General Public License which covers the use of the GNU `gettext' library. This means @@ -1,265 +1,147 @@ -LOCAL_PATH:= $(call my-dir) +LOCAL_PATH := $(call my-dir) -COMMON_SOURCES:=\ - lib/xmalloc.c \ - lib/xstrdup.c \ - lib/xstrndup.c +supported_platforms := linux-x86 darwin-x86 +cur_platform := $(filter $(HOST_OS)-$(HOST_ARCH),$(supported_platforms)) +ifdef cur_platform # -# libelf +# host libelf # include $(CLEAR_VARS) -LOCAL_SRC_FILES:=$(COMMON_SOURCES) -LOCAL_SRC_FILES+=\ - libelf/elf32_checksum.c \ - libelf/elf32_fsize.c \ - libelf/elf32_getehdr.c \ - libelf/elf32_getphdr.c \ - libelf/elf32_getshdr.c \ - libelf/elf32_newehdr.c \ - libelf/elf32_newphdr.c \ - libelf/elf32_updatefile.c \ - libelf/elf32_updatenull.c \ - libelf/elf32_xlatetof.c \ - libelf/elf32_xlatetom.c \ - libelf/elf64_checksum.c \ - libelf/elf64_fsize.c \ - libelf/elf64_getehdr.c \ - libelf/elf64_getphdr.c \ - libelf/elf64_getshdr.c \ - libelf/elf64_newehdr.c \ - libelf/elf64_newphdr.c \ - libelf/elf64_updatefile.c \ - libelf/elf64_updatenull.c \ - libelf/elf64_xlatetof.c \ - libelf/elf64_xlatetom.c \ - libelf/elf_begin.c \ - libelf/elf_clone.c \ - libelf/elf_cntl.c \ - libelf/elf_end.c \ - libelf/elf_error.c \ - libelf/elf_fill.c \ - libelf/elf_flagdata.c \ - libelf/elf_flagehdr.c \ - libelf/elf_flagelf.c \ - libelf/elf_flagphdr.c \ - libelf/elf_flagscn.c \ - libelf/elf_flagshdr.c \ - libelf/elf_getarhdr.c \ - libelf/elf_getarsym.c \ - libelf/elf_getbase.c \ - libelf/elf_getdata.c \ - libelf/elf_getident.c \ - libelf/elf_getscn.c \ - libelf/elf_getshnum.c \ - libelf/elf_getshstrndx.c \ - libelf/elf_hash.c \ - libelf/elf_kind.c \ - libelf/elf_memory.c \ - libelf/elf_ndxscn.c \ - libelf/elf_newdata.c \ - libelf/elf_newscn.c \ - libelf/elf_next.c \ - libelf/elf_nextscn.c \ - libelf/elf_rand.c \ - libelf/elf_rawdata.c \ - libelf/elf_rawfile.c \ - libelf/elf_readall.c \ - libelf/elf_strptr.c \ - libelf/elf_update.c \ - libelf/elf_version.c \ - libelf/gelf_checksum.c \ - libelf/gelf_freechunk.c \ - libelf/gelf_fsize.c \ - libelf/gelf_getclass.c \ - libelf/gelf_getdyn.c \ - libelf/gelf_getehdr.c \ - libelf/gelf_getlib.c \ - libelf/gelf_getmove.c \ - libelf/gelf_getphdr.c \ - libelf/gelf_getrel.c \ - libelf/gelf_getrela.c \ - libelf/gelf_getshdr.c \ - libelf/gelf_getsym.c \ - libelf/gelf_getsyminfo.c \ - libelf/gelf_getsymshndx.c \ - libelf/gelf_getverdaux.c \ - libelf/gelf_getverdef.c \ - libelf/gelf_getvernaux.c \ - libelf/gelf_getverneed.c \ - libelf/gelf_getversym.c \ - libelf/gelf_newehdr.c \ - libelf/gelf_newphdr.c \ - libelf/gelf_rawchunk.c \ - libelf/gelf_update_dyn.c \ - libelf/gelf_update_ehdr.c \ - libelf/gelf_update_lib.c \ - libelf/gelf_update_move.c \ - libelf/gelf_update_phdr.c \ - libelf/gelf_update_rel.c \ - libelf/gelf_update_rela.c \ - libelf/gelf_update_shdr.c \ - libelf/gelf_update_sym.c \ - libelf/gelf_update_syminfo.c \ - libelf/gelf_update_symshndx.c \ - libelf/gelf_update_verdaux.c \ - libelf/gelf_update_verdef.c \ - libelf/gelf_update_vernaux.c \ - libelf/gelf_update_verneed.c \ - libelf/gelf_update_versym.c \ - libelf/gelf_xlate.c \ - libelf/gelf_xlatetof.c \ - libelf/gelf_xlatetom.c \ - libelf/libelf_crc32.c \ - libelf/libelf_next_prime.c \ - libelf/nlist.c +LIBELF_SRC_FILES := \ + libelf/elf32_checksum.c \ + libelf/elf32_fsize.c \ + libelf/elf32_getehdr.c \ + libelf/elf32_getphdr.c \ + libelf/elf32_getshdr.c \ + libelf/elf32_newehdr.c \ + libelf/elf32_newphdr.c \ + libelf/elf32_offscn.c \ + libelf/elf32_updatefile.c \ + libelf/elf32_updatenull.c \ + libelf/elf32_xlatetof.c \ + libelf/elf32_xlatetom.c \ + libelf/elf64_checksum.c \ + libelf/elf64_fsize.c \ + libelf/elf64_getehdr.c \ + libelf/elf64_getphdr.c \ + libelf/elf64_getshdr.c \ + libelf/elf64_newehdr.c \ + libelf/elf64_newphdr.c \ + libelf/elf64_offscn.c \ + libelf/elf64_updatefile.c \ + libelf/elf64_updatenull.c \ + libelf/elf64_xlatetof.c \ + libelf/elf64_xlatetom.c \ + libelf/elf_begin.c \ + libelf/elf_clone.c \ + libelf/elf_cntl.c \ + libelf/elf_end.c \ + libelf/elf_error.c \ + libelf/elf_fill.c \ + libelf/elf_flagdata.c \ + libelf/elf_flagehdr.c \ + libelf/elf_flagelf.c \ + libelf/elf_flagphdr.c \ + libelf/elf_flagscn.c \ + libelf/elf_flagshdr.c \ + libelf/elf_getarhdr.c \ + libelf/elf_getaroff.c \ + libelf/elf_getarsym.c \ + libelf/elf_getbase.c \ + libelf/elf_getdata.c \ + libelf/elf_getdata_rawchunk.c \ + libelf/elf_getident.c \ + libelf/elf_getscn.c \ + libelf/elf_getshnum.c \ + libelf/elf_getshstrndx.c \ + libelf/elf_gnu_hash.c \ + libelf/elf_hash.c \ + libelf/elf_kind.c \ + libelf/elf_memory.c \ + libelf/elf_ndxscn.c \ + libelf/elf_newdata.c \ + libelf/elf_newscn.c \ + libelf/elf_next.c \ + libelf/elf_nextscn.c \ + libelf/elf_rand.c \ + libelf/elf_rawdata.c \ + libelf/elf_rawfile.c \ + libelf/elf_readall.c \ + libelf/elf_scnshndx.c \ + libelf/elf_strptr.c \ + libelf/elf_update.c \ + libelf/elf_version.c \ + libelf/gelf_checksum.c \ + libelf/gelf_fsize.c \ + libelf/gelf_getauxv.c \ + libelf/gelf_getclass.c \ + libelf/gelf_getdyn.c \ + libelf/gelf_getehdr.c \ + libelf/gelf_getlib.c \ + libelf/gelf_getmove.c \ + libelf/gelf_getnote.c \ + libelf/gelf_getphdr.c \ + libelf/gelf_getrela.c \ + libelf/gelf_getrel.c \ + libelf/gelf_getshdr.c \ + libelf/gelf_getsym.c \ + libelf/gelf_getsyminfo.c \ + libelf/gelf_getsymshndx.c \ + libelf/gelf_getverdaux.c \ + libelf/gelf_getverdef.c \ + libelf/gelf_getvernaux.c \ + libelf/gelf_getverneed.c \ + libelf/gelf_getversym.c \ + libelf/gelf_newehdr.c \ + libelf/gelf_newphdr.c \ + libelf/gelf_offscn.c \ + libelf/gelf_update_auxv.c \ + libelf/gelf_update_dyn.c \ + libelf/gelf_update_ehdr.c \ + libelf/gelf_update_lib.c \ + libelf/gelf_update_move.c \ + libelf/gelf_update_phdr.c \ + libelf/gelf_update_rela.c \ + libelf/gelf_update_rel.c \ + libelf/gelf_update_shdr.c \ + libelf/gelf_update_sym.c \ + libelf/gelf_update_syminfo.c \ + libelf/gelf_update_symshndx.c \ + libelf/gelf_update_verdaux.c \ + libelf/gelf_update_verdef.c \ + libelf/gelf_update_vernaux.c \ + libelf/gelf_update_verneed.c \ + libelf/gelf_update_versym.c \ + libelf/gelf_xlate.c \ + libelf/gelf_xlatetof.c \ + libelf/gelf_xlatetom.c \ + libelf/libelf_crc32.c \ + libelf/libelf_next_prime.c \ + libelf/nlist.c + +LOCAL_SRC_FILES := $(LIBELF_SRC_FILES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/lib $(LOCAL_PATH)/libelf + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/host-$(HOST_OS)-fixup + +LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE + +# to suppress the "pointer of type ‘void *’ used in arithmetic" warning +LOCAL_CFLAGS += -Wno-pointer-arith -ifeq ($(HOST_OS),linux) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-linux.h -endif -ifeq ($(HOST_OS),darwin) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-darwin.h -endif -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-cygwin.h -endif -ifeq ($(HOST_OS),freebsd) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-freebsd.h -endif - -LOCAL_MODULE:= libelf - -LOCAL_CFLAGS += -include $(LOCAL_PATH)/config.h -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -Doff64_t=_off64_t -else -LOCAL_CFLAGS += -Doff64_t=__off64_t -endif - -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/lib/ $(LOCAL_PATH)/libelf/ - -include $(BUILD_HOST_STATIC_LIBRARY) - -# -# libebl -# - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:=$(COMMON_SOURCES) -LOCAL_SRC_FILES+=\ - libebl/eblbackendname.c \ - libebl/eblclosebackend.c \ - libebl/eblcorenote.c \ - libebl/eblcorenotetypename.c \ - libebl/ebldebugscnp.c \ - libebl/ebldynamictagcheck.c \ - libebl/ebldynamictagname.c \ - libebl/eblgotpcreloccheck.c \ - libebl/eblgstrtab.c \ - libebl/eblmachineflagcheck.c \ - libebl/eblmachineflagname.c \ - libebl/eblobjecttypename.c \ - libebl/eblobjnote.c \ - libebl/eblobjnotetypename.c \ - libebl/eblopenbackend.c \ - libebl/eblosabiname.c \ - libebl/eblreloctypecheck.c \ - libebl/eblreloctypename.c \ - libebl/eblrelocvaliduse.c \ - libebl/eblsectionname.c \ - libebl/eblsectiontypename.c \ - libebl/eblsegmenttypename.c \ - libebl/eblshflagscombine.c \ - libebl/eblstrtab.c \ - libebl/eblsymbolbindingname.c \ - libebl/eblsymboltypename.c \ - libebl/eblwstrtab.c - -ifeq ($(HOST_OS),linux) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-linux.h -endif ifeq ($(HOST_OS),darwin) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-darwin.h -endif -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-cygwin.h -endif -ifeq ($(HOST_OS),freebsd) -LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-freebsd.h + LOCAL_CFLAGS += -fnested-functions endif -LOCAL_MODULE:=libebl +# to fix machine-dependent issues +LOCAL_CFLAGS += -include $(LOCAL_PATH)/host-$(HOST_OS)-fixup/AndroidFixup.h -LOCAL_CFLAGS += -include $(LOCAL_PATH)/config.h -DLIBSTR=\"$(LOCAL_MODULE)\" -Dstpcpy=strcpy -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -Doff64_t=_off64_t -else -LOCAL_CFLAGS += -Doff64_t=__off64_t -endif - -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/lib/ $(LOCAL_PATH)/libelf/ $(LOCAL_PATH)/libebl/ +LOCAL_MODULE := libelf include $(BUILD_HOST_STATIC_LIBRARY) -# -# libebl_arm -# - -include $(CLEAR_VARS) - -#LOCAL_SRC_FILES:=$(COMMON_SOURCES) -LOCAL_SRC_FILES+=\ - libebl/arm_destr.c \ - libebl/arm_init.c \ - libebl/arm_symbol.c - -ifeq ($(HOST_OS),linux) -endif -ifeq ($(HOST_OS),darwin) -endif - -LOCAL_MODULE:=libebl_arm - -LOCAL_CFLAGS += -include $(LOCAL_PATH)/config.h -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -Doff64_t=_off64_t -else -LOCAL_CFLAGS += -Doff64_t=__off64_t -endif - -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/lib/ $(LOCAL_PATH)/libelf/ $(LOCAL_PATH)/libebl/ - -include $(BUILD_HOST_STATIC_LIBRARY) - - -# -# libebl_sh -# - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES+=\ - libebl/sh_destr.c \ - libebl/sh_init.c \ - libebl/sh_symbol.c - -ifeq ($(HOST_OS),linux) -endif -ifeq ($(HOST_OS),darwin) -endif - -LOCAL_MODULE:=libebl_sh - -LOCAL_CFLAGS += -include $(LOCAL_PATH)/config.h -ifeq ($(HOST_OS),windows) -LOCAL_CFLAGS += -Doff64_t=_off64_t -else -LOCAL_CFLAGS += -Doff64_t=__off64_t -endif - -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/lib/ $(LOCAL_PATH)/libelf/ $(LOCAL_PATH)/libebl/ - -include $(BUILD_HOST_STATIC_LIBRARY) +endif #cur_platform @@ -1,162 +1,340 @@ - The Open Software License - v. 1.0 - -This Open Software License (the "License") applies to any original -work of authorship (the "Original Work") whose owner (the "Licensor") -has placed the following notice immediately following the copyright -notice for the Original Work: "Licensed under the Open Software -License version 1.0" - -License Terms - -1) Grant of Copyright License. Licensor hereby grants You a -world-wide, royalty-free, non-exclusive, perpetual, non-sublicenseable -license to do the following: - - a) to reproduce the Original Work in copies; - - b) to prepare derivative works ("Derivative Works") based upon the - Original Work; - - c) to distribute copies of the Original Work and Derivative Works - to the public, with the proviso that copies of Original Work or - Derivative Works that You distribute shall be licensed under the - Open Software License; - - d) to perform the Original Work publicly; and - - e) to display the Original Work publicly. - -2) Grant of Patent License. Licensor hereby grants You a world-wide, -royalty-free, non-exclusive, perpetual, non-sublicenseable license, -under patent claims owned or controlled by the Licensor that are -embodied in the Original Work as furnished by the Licensor ("Licensed -Claims") to make, use, sell and offer for sale the Original Work. -Licensor hereby grants You a world-wide, royalty-free, non-exclusive, -perpetual, non-sublicenseable license under the Licensed Claims to -make, use, sell and offer for sale Derivative Works. - -3) Grant of Source Code License. The term "Source Code" means the -preferred form of the Original Work for making modifications to it and -all available documentation describing how to access and modify the -Original Work. Licensor hereby agrees to provide a machine-readable -copy of the Source Code of the Original Work along with each copy of -the Original Work that Licensor distributes. Licensor reserves the -right to satisfy this obligation by placing a machine-readable copy of -the Source Code in an information repository reasonably calculated to -permit inexpensive and convenient access by You for as long as -Licensor continues to distribute the Original Work, and by publishing -the address of that information repository in a notice immediately -following the copyright notice that applies to the Original Work. - -4) Exclusions From License Grant. Nothing in this License shall be -deemed to grant any rights to trademarks, copyrights, patents, trade -secrets or any other intellectual property of Licensor except as -expressly stated herein. No patent license is granted to make, use, -sell or offer to sell embodiments of any patent claims other than the -Licensed Claims defined in Section 2. No right is granted to the -trademarks of Licensor even if such marks are included in the Original -Work. Nothing in this License shall be interpreted to prohibit -Licensor from licensing under different terms from this License any -Original Work that Licensor otherwise would have a right to license. - -5) External Deployment. The term "External Deployment" means the use -or distribution of the Original Work or Derivative Works in any way -such that the Original Work or Derivative Works may be accessed or -used by anyone other than You, whether the Original Work or Derivative -Works are distributed to those persons, made available as an -application intended for use over a computer network, or used to -provide services or otherwise deliver content to anyone other than -You. As an express condition for the grants of license hereunder, You -agree that any External Deployment by You shall be deemed a -distribution and shall be licensed to all under the terms of this -License, as prescribed in section 1(c) herein. - -6) Warranty and Disclaimer of Warranty. LICENSOR WARRANTS THAT THE -COPYRIGHT IN AND TO THE ORIGINAL WORK IS OWNED BY THE LICENSOR OR THAT -THE ORIGINAL WORK IS DISTRIBUTED BY LICENSOR UNDER A VALID CURRENT -LICENSE FROM THE COPYRIGHT OWNER. EXCEPT AS EXPRESSLY STATED IN THE -IMMEDIATELY PRECEEDING SENTENCE, THE ORIGINAL WORK IS PROVIDED UNDER -THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY, EITHER EXPRESS OR -IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTY OF -NON-INFRINGEMENT AND WARRANTIES THAT THE ORIGINAL WORK IS MERCHANTABLE -OR FIT FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF -THE ORIGINAL WORK IS WITH YOU. THIS DISCLAIMER OF WARRANTY CONSTITUTES -AN ESSENTIAL PART OF THIS LICENSE. NO LICENSE TO ORIGINAL WORK IS -GRANTED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -7) Limitation of Liability. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL -THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, -SHALL THE LICENSOR BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING -AS A RESULT OF THIS LICENSE OR THE USE OF THE ORIGINAL WORK INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, -COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL -DAMAGES OR LOSSES, EVEN IF SUCH PERSON SHALL HAVE BEEN INFORMED OF THE -POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT -APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH -PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH -LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR -LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION -AND LIMITATION MAY NOT APPLY TO YOU. - -8) Acceptance and Termination. Nothing else but this License (or -another written agreement between Licensor and You) grants You -permission to create Derivative Works based upon the Original Work, -and any attempt to do so except under the terms of this License (or -another written agreement between Licensor and You) is expressly -prohibited by U.S. copyright law, the equivalent laws of other -countries, and by international treaty. Therefore, by exercising any -of the rights granted to You in Sections 1 and 2 herein, You indicate -Your acceptance of this License and all of its terms and conditions. -This license shall terminate immediately and you may no longer -exercise any of the rights granted to You by this License upon Your -failure to honor the proviso in Section 1(c) herein. - -9) Mutual Termination for Patent Action. This License shall terminate -automatically and You may no longer exercise any of the rights granted -to You by this License if You file a lawsuit in any court alleging -that any OSI Certified open source software that is licensed under any -license containing this "Mutual Termination for Patent Action" clause -infringes any patent claims that are essential to use that software. - -10) Jurisdiction, Venue and Governing Law. You agree that any lawsuit -arising under or relating to this License shall be maintained in the -courts of the jurisdiction wherein the Licensor resides or in which -Licensor conducts its primary business, and under the laws of that -jurisdiction excluding its conflict-of-law provisions. The application -of the United Nations Convention on Contracts for the International -Sale of Goods is expressly excluded. Any use of the Original Work -outside the scope of this License or after its termination shall be -subject to the requirements and penalties of the U.S. Copyright Act, -17 U.S.C. § 101 et seq., the equivalent laws of other countries, and -international treaty. This section shall survive the termination of + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to this License. -11) Attorneys Fees. In any action to enforce the terms of this License -or seeking damages relating thereto, the prevailing party shall be -entitled to recover its costs and expenses, including, without -limitation, reasonable attorneys' fees and costs incurred in -connection with such action, including any appeal of such action. This -section shall survive the termination of this License. - -12) Miscellaneous. This License represents the complete agreement -concerning the subject matter hereof. If any provision of this License -is held to be unenforceable, such provision shall be reformed only to -the extent necessary to make it enforceable. - -13) Definition of "You" in This License. "You" throughout this -License, whether in upper or lower case, means an individual or a -legal entity exercising rights under, and complying with all of the -terms of, this License. For legal entities, "You" includes any entity -that controls, is controlled by, or is under common control with you. -For purposes of this definition, "control" means (i) the power, direct -or indirect, to cause the direction or management of such entity, -whether by contract or otherwise, or (ii) ownership of fifty percent -(50%) or more of the outstanding shares, or (iii) beneficial ownership -of such entity. - -This license is Copyright (C) 2002 Lawrence E. Rosen. All rights -reserved. Permission is hereby granted to copy and distribute this -license without modification. This license may not be modified without -the express written permission of its copyright owner. + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING.GPL b/COPYING.GPL deleted file mode 100644 index 60549be5..00000000 --- a/COPYING.GPL +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. @@ -1,3 +1,130 @@ +2008-12-30 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: We need automake 1.8 now. + +2008-12-24 Roland McGrath <roland@redhat.com> + + * configure.ac: Use automake flags dist-bzip2 no-dist-gzip, + distribute only in .tar.bz2 form now. + +2008-12-16 Roland McGrath <roland@redhat.com> + + * Makefile.am (pkginclude_HEADERS): New variable, install version.h. + * configure.ac: Create it, substituting @eu_version@ with + PACKAGE_VERSION canonicalized to four digits of decimal. + +2008-08-25 Roland McGrath <roland@redhat.com> + + * configure.ac (--enable-tls): Set AM_CONDITIONAL USE_TLS too. + +2008-08-21 Roland McGrath <roland@redhat.com> + + * configure.ac (AH_BOTTOM): Emit #include <eu-config.h> and + move the contents to lib/eu-config.h instead of keeping them here. + +2007-12-20 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Add support for --enable-debugpred. + Update likely/unlikely macros for it. + +2007-06-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Remove traces of mini builds. + * configure.ac: Don't use libelf-po/POTFILES.in as config file + anymore. + +2007-05-16 Roland McGrath <roland@redhat.com> + + * configure.ac (AM_INIT_AUTOMAKE): Use -Wno-portability. + +2006-11-02 Roland McGrath <roland@redhat.com> + + * Makefile.am (EXTRA_DIST): Add EXCEPTION file. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * configure.ac: Use AM_MAINTAINER_MODE. + +2006-07-12 Ulrich Drepper <drepper@redhat.com> + + * configure.ac (internal_function): Don't use internal visibility. + +2006-07-05 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Add dummy automake conditional to get dependencies + for non-generic linker right. See src/Makefile.am. + +2005-11-18 Roland McGrath <roland@redhat.com> + + * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. + +2005-11-16 Roland McGrath <roland@redhat.com> + + * configure.ac: Define HAVE_LIBASM and STANDALONE conditionals. + In config.h, define ELFUTILS_HEADER macro. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * Makefile.am (all_SUBDIRS): Add backends. + * configure.ac: Write backends/Makefile. + + * configure.ac: Add --enable-tests-rpath option. + +2005-09-16 Roland McGrath <roland@redhat.com> + + * configure.ac (ALLOW_UNALIGNED) [__ia64__ || __alpha__]: + Don't set it, since on IA64 you get error messages for unaligned + accesses, and on Alpha it's at least very slow. + +2005-08-29 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Fix GCOV make condition generation. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Add --enable-gcov option. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Add --enable-gprof option. + +2005-07-27 Roland McGrath <roland@redhat.com> + + * Makefile.am (all_SUBDIRS): Put libdwfl before libdw. + +2005-07-21 Roland McGrath <roland@redhat.com> + + * configure.ac: Take --enable-libebl-subdir=DIR to set LIBEBL_SUBDIR. + +2005-06-01 Roland McGrath <roland@redhat.com> + + * Makefile.am (all_SUBDIRS): Add libdwfl. + * configure.ac: Write libdwfl/Makefile. + +2005-05-19 Roland McGrath <roland@redhat.com> + + * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros. + +2005-05-10 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Define MODVERSION in config.h. + +2005-02-22 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (all_SUBDIRS): Don't add doc subdir for now. + * configure.ac: Don't use doc subdir for now. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Remove AM_GNU_GETTEXT use. Use only AM_PO_SUBDIRS. + +2005-02-06 Ulrich Drepper <drepper@redhat.com> + + * configure.ac (AM_INIT_AUTOMAKE): Removed dist-bzip2. + + * Makefile.am (EXTRA_DIST): Remove splint.rc. + * splint.rc: Removed. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * configure.ac: Make compile with gcc 4.0. diff --git a/EXCEPTION b/EXCEPTION new file mode 100644 index 00000000..491c5764 --- /dev/null +++ b/EXCEPTION @@ -0,0 +1,11 @@ +This file describes the limits of the Exception under which you are allowed +to distribute Non-GPL Code in linked combination with Red Hat elfutils. +For the full text of the license, please see one of the header files +included with the source distribution or the file COPYING found in the +top level directory of the source. + +The Approved Interfaces are the functions declared in the files: + +libelf.h +libdw.h +libdwfl.h @@ -1,38 +1,54 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + Basic Installation ================== - These are generic installation instructions. +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. + `./configure' to configure the package for your system. - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. 2. Type `make' to compile the package. @@ -51,52 +67,55 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the +You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the +own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. Installation Names ================== - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular +options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -107,7 +126,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= - Some packages pay attention to `--enable-FEATURE' options to +Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -122,48 +141,86 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + CPU-COMPANY-SYSTEM -See the file `config.sub' for the possible values of each field. If +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't -need to know the host type. +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. -Operation Controls +Defining Variables ================== - `configure' recognizes the following options to control how it -operates. +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. `--help' +`-h' Print a summary of the options to `configure', and exit. +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + `--quiet' `--silent' `-q' @@ -175,8 +232,6 @@ operates. Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. -`configure' also accepts some other, not widely useful, options. diff --git a/MODULE_LICENSE_OSL1 b/MODULE_LICENSE_OSL1 deleted file mode 100644 index e69de29b..00000000 --- a/MODULE_LICENSE_OSL1 +++ /dev/null diff --git a/Makefile.am b/Makefile.am index 069b07f3..44d67d50 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,28 +1,46 @@ ## Process this file with automake to create Makefile.in ## Configure input file for elfutils. ## -## Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## 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, version 2. +## Red Hat elfutils 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; version 2 of the License. ## -## 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. +## Red Hat elfutils is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software Foundation, -## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## ACLOCAL_AMFLAGS = -I m4 -mini_SUBDIRS = config m4 lib libelf libelf-po -all_SUBDIRS = doc libebl libdw libcpu libasm src po tests -SUBDIRS = $(mini_SUBDIRS) $(all_SUBDIRS) +pkginclude_HEADERS = version.h + +# Add doc back when we have some real content. +SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \ + src po tests + +EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION -EXTRA_DIST = splint.rc elfutils.spec GPG-KEY NOTES COPYING.GPL +# Make sure the test install uses lib64 when $LIB will yield lib64. +# Make sure the test build uses the same compiler, which on e.g. ppc64 +# determines which platform we are actually testing. +DISTCHECK_CONFIGURE_FLAGS = \ + --libdir=`echo $(libdir) | sed "s,^$(exec_prefix),$$dc_install_base,"`\ + CC="$(CC)" distcheck-hook: chmod -R u+w $(distdir) diff --git a/Makefile.in b/Makefile.in index c00bd846..d7c9306c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -13,15 +13,12 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -36,30 +33,41 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/config/elfutils.spec.in $(top_srcdir)/configure \ +DIST_COMMON = README $(am__configure_deps) $(pkginclude_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/config/elfutils.spec.in \ + $(top_srcdir)/config/version.h.in $(top_srcdir)/configure \ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = elfutils.spec +CONFIG_CLEAN_FILES = elfutils.spec version.h SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-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 uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgincludedir)" +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(pkginclude_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -70,13 +78,11 @@ am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.bz2 distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -85,43 +91,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -130,7 +132,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -138,12 +139,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -156,40 +159,64 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ 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@ ACLOCAL_AMFLAGS = -I m4 -mini_SUBDIRS = config m4 lib libelf libelf-po -all_SUBDIRS = doc libebl libdw libcpu libasm src po tests -SUBDIRS = $(mini_SUBDIRS) $(all_SUBDIRS) -EXTRA_DIST = splint.rc elfutils.spec GPG-KEY NOTES COPYING.GPL +pkginclude_HEADERS = version.h + +# Add doc back when we have some real content. +SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \ + src po tests + +EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION + +# Make sure the test install uses lib64 when $LIB will yield lib64. +# Make sure the test build uses the same compiler, which on e.g. ppc64 +# determines which platform we are actually testing. +DISTCHECK_CONFIGURE_FLAGS = \ + --libdir=`echo $(libdir) | sed "s,^$(exec_prefix),$$dc_install_base,"`\ + CC="$(CC)" + all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -216,21 +243,21 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ @@ -239,7 +266,25 @@ distclean-hdr: -rm -f config.h stamp-h1 elfutils.spec: $(top_builddir)/config.status $(top_srcdir)/config/elfutils.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ -uninstall-info-am: +version.h: $(top_builddir)/config.status $(top_srcdir)/config/version.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -248,7 +293,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -260,15 +311,20 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -289,7 +345,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -305,8 +361,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -331,8 +387,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -342,13 +398,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -369,24 +424,22 @@ distdir: $(DISTFILES) exit 1;; \ esac $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/config $(distdir)/libelf-po $(distdir)/m4 $(distdir)/po - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + test -d $(distdir) || mkdir $(distdir) + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -400,7 +453,7 @@ distdir: $(DISTFILES) list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -408,6 +461,8 @@ distdir: $(DISTFILES) $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ @@ -415,7 +470,7 @@ distdir: $(DISTFILES) -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz @@ -424,6 +479,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -438,7 +497,6 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) @@ -451,6 +509,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -491,7 +551,7 @@ distcheck: dist $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -512,9 +572,12 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h +all-am: Makefile $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: + for dir in "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -558,14 +621,22 @@ info: info-recursive info-am: -install-data-am: +install-data-am: install-pkgincludeHEADERS + +install-dvi: install-dvi-recursive install-exec-am: +install-html: install-html-recursive + install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -586,24 +657,27 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-recursive distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am +uninstall-am: uninstall-pkgincludeHEADERS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-tags distcleancheck \ + distdir distuninstallcheck 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-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am \ + uninstall-pkgincludeHEADERS distcheck-hook: @@ -1,3 +1,360 @@ +Version 0.138: + +Install <elfutils/version.h> header file for applications to use in source +version compatibility checks. + +libebl: backend fixes for i386 TLS relocs; backend support for NT_386_IOPERM + +libcpu: disassembler fixes + +libdwfl: bug fixes + +libelf: bug fixes + +nm: bug fixes for handling corrupt input files + +Version 0.137: + +Minor fixes for unreleased 0.136 release. + +Version 0.136: + +libdwfl: bug fixes; new "segment" interfaces; + all the libdwfl-based tools now support --core=COREFILE option + +Version 0.135: + +libdwfl: bug fixes + +strip: changed handling of ET_REL files wrt symbol tables and relocs + +Version 0.134: + +elflint: backend improvements for sparc, alpha + +libdwfl, libelf: bug fixes + +Version 0.133: + +readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling (readelf -A) + +readelf: core note handling for NT_386_TLS, NT_PPC_SPE, Alpha NT_AUXV + +libdwfl: bug fixes and optimization in relocation handling + +elfcmp: bug fix for non-allocated section handling + +ld: implement newer features of binutils linker. + +Version 0.132: + +libcpu: Implement x86 and x86-64 disassembler. +libasm: Add interface for disassembler. + +all programs: add debugging of branch prediction. + +libelf: new function elf_scnshndx. + +Version 0.131: + +libdw: DW_FORM_ref_addr support; dwarf_formref entry point now deprecated; + bug fixes for oddly-formatted DWARF + +libdwfl: bug fixes in offline archive support, symbol table handling; + apply partial relocations for dwfl_module_address_section on ET_REL + +libebl: powerpc backend support for Altivec registers + +Version 0.130: + +readelf: -p option can take an argument like -x for one section, + or no argument (as before) for all SHF_STRINGS sections; + new option --archive-index (or -c); + improved -n output for core files, on many machines + +libelf: new function elf_getdata_rawchunk, replaces gelf_rawchunk; + new functions gelf_getnote, gelf_getauxv, gelf_update_auxv + +readelf, elflint: handle SHT_NOTE sections without requiring phdrs + +elflint: stricter checks on debug sections + +libdwfl: new functions dwfl_build_id_find_elf, dwfl_build_id_find_debuginfo, + dwfl_module_build_id, dwfl_module_report_build_id; + support dynamic symbol tables found via phdrs; + dwfl_standard_find_debuginfo now uses build IDs when available + +unstrip: new option --list (or -n) + +libebl: backend improvements for sparc, alpha, powerpc + +Version 0.129: + +readelf: new options --hex-dump (or -x), --strings (or -p) + +addr2line: new option --symbols (or -S) + +Version 0.128: + +new program: unstrip + +elfcmp: new option --hash-inexact + +Version 0.127: + +libdw: new function dwarf_getsrcdirs + +libdwfl: new functions dwfl_module_addrsym, dwfl_report_begin_add, + dwfl_module_address_section + +Version 0.126: + +new program: ar + +Version 0.125: + +elflint: Compare DT_GNU_HASH tests. + +move archives into -static RPMs + +libelf, elflint: better support for core file handling + +Version 0.124: + +libebl: sparc backend support for return value location + +libebl, libdwfl: backend register name support extended with more info + +libelf, libdw: bug fixes for unaligned accesses on machines that care + +readelf, elflint: trivial bugs fixed + +Version 0.123: + +libebl: Backend build fixes, thanks to Stepan Kasal. + +libebl: ia64 backend support for register names, return value location + +libdwfl: Handle truncated linux kernel module section names. + +libdwfl: Look for linux kernel "vmlinux" files with ".debug" suffix. + +elflint: Fix checks to permit --hash-style=gnu format. + +Version 0.122: + +libebl: add function to test for relative relocation + +elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks + +elflint, readelf: add support for DT_GNU_HASH +libelf: add elf_gnu_hash + +elflint, readelf: add support for 64-bit SysV-style hash tables + +libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym. + +Version 0.121: + +libelf: bug fixes for rewriting existing files when using mmap. + +make all installed headers usable in C++ code. + +readelf: better output format. + +elflint: fix tests of dynamic section content. + +ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patches. + +libdw, libdwfl: handle files without aranges info. + +Version 0.120: + +Bug fixes. + +dwarf.h updated for DWARF 3.0 final specification. + +libdwfl: New function dwfl_version. + +The license is now GPL for most files. The libelf, libebl, libdw, +and libdwfl libraries have additional exceptions. Add reference to +OIN. + +Version 0.119: + +bug fixes + +Version 0.118: + +elflint: more tests. + +libdwfl: New function dwfl_module_register_names. + +libebl: New backend hook for register names. + +Version 0.117: + +libdwfl: New function dwfl_module_return_value_location. + +libebl: Backend improvements for several CPUs. + +Version 0.116: + +libdw: New functions dwarf_ranges, dwarf_entrypc, dwarf_diecu, + dwarf_entry_breakpoints. Removed Dwarf_Func type and functions + dwarf_func_name, dwarf_func_lowpc, dwarf_func_highpc, + dwarf_func_entrypc, dwarf_func_die; dwarf_getfuncs callback now uses + Dwarf_Die, and dwarf_func_file, dwarf_func_line, dwarf_func_col + replaced by dwarf_decl_file, dwarf_decl_line, dwarf_decl_column; + dwarf_func_inline, dwarf_func_inline_instances now take Dwarf_Die. + Type Dwarf_Loc renamed to Dwarf_Op; dwarf_getloclist, + dwarf_addrloclists renamed dwarf_getlocation, dwarf_getlocation_addr. + +Version 0.115: + +libelf: speed-ups of non-mmap reading. + +strings: New program. + +Implement --enable-gcov option for configure. + +libdw: New function dwarf_getscopes_die. + +Version 0.114: + +libelf: new function elf_getaroff + +libdw: Added dwarf_func_die, dwarf_func_inline, dwarf_func_inline_instances. + +libdwfl: New functions dwfl_report_offline, dwfl_offline_section_address, + dwfl_linux_kernel_report_offline. + +ranlib: new program + +Version 0.113: + +elflint: relax a bit. Allow version definitions for defined symbols against +DSO versions also for symbols in nobits sections. Allow .rodata section +to have STRINGS and MERGE flag set. + +strip: add some more compatibility with binutils. + +Version 0.112: + +elfcmp: some more relaxation. + +elflint: many more tests, especially regarding to symbol versioning. + +libelf: Add elfXX_offscn and gelf_offscn. + +libasm: asm_begin interface changes. + +libebl: Add three new interfaces to directly access machine, class, and +data encoding information. + +objdump: New program. Just the beginning. + +Version 0.111: + +libdw: now contains all of libdwfl. The latter is not installed anymore. + +elfcmp: little usability tweak, name and index of differing section is printed. + +Version 0.110: + +libelf: fix a number of problems with elf_update + +elfcmp: fix a few bugs. Compare gaps. + +Fix a few PLT problems and mudflap build issues. + +libebl: Don't expose Ebl structure definition in libebl.h. It's now private. + +Version 0.109: + +libebl: Check for matching modules. + +elflint: Check that copy relocations only happen for OBJECT or NOTYPE symbols. + +elfcmp: New program. + +libdwfl: New library. + +Version 0.108: + +strip: fix bug introduced in last change + +libdw: records returned by dwarf_getsrclines are now sorted by address + +Version 0.107: + +readelf: improve DWARF output format + +strip: support Linux kernel modules + +Version 0.106: + +libdw: Updated dwarf.h from DWARF3 spec +libdw: add new funtions dwarf_func_entrypc, dwarf_func_file, dwarf_func_line, +dwarf_func_col, dwarf_getsrc_file + +Version 0.105: + +addr2line: New program + +libdw: add new functions: dwarf_addrdie, dwarf_macro_*, dwarf_getfuncs, +dwarf_func_*. + +findtextrel: use dwarf_addrdie + +Version 0.104: + +findtextrel: New program. + +Version 0.103: + +libdw: Fix using libdw.h with gcc < 4 and C++ code. Compiler bug. + +Version 0.102: + +More Makefile and spec file cleanups. + +Version 0.101: + +Remove most gettext autoconf handling. + +Add more warnings + +Fix resulting problems. One actual bug found and fixed this way + +Version 0.100: + +libebl: Fix x86-64 relocations. + +Add -Wunused -Wextra warnings. + +Some cleanups resulting from those additional warnings. + +Lots of Makefile cleanup. + +Version 0.99: + +libelf: add gelf_checksum prototype to <libelf.h> + +libelf: fix elf*_checksum handling of NOBITS sections + +Finish mudflap support. + +Fix three bugs found by mudflap. + +ld: add as_needed support + +Version 0.98: + +readelf: in section to segment mapping, indicate read-only sections. + +elflint: more relaxation for GNU ld + Version 0.97: Fix compiling with gcc 4.0. @@ -3,3 +3,4 @@ At least the following have submitted valuable patches: Jeff Johnson building. rpm wrestling Alexander Larsson separate debug info Jakub Jelinek bug fixes, testing +Roland McGrath lots of libdw{,fl} hacking @@ -1,7 +1,7 @@ ToDo list for elfutils -*-outline-*- ---------------------- -Time-stamp: <2003-08-07 12:52:49 drepper> +Time-stamp: <2008-02-03 14:15:41 drepper> * mkinstalldirs @@ -23,15 +23,7 @@ Time-stamp: <2003-08-07 12:52:49 drepper> remains maintainable. -* libdwarf - -** Should we do more error checking? - - Most functions don't check whether they get a NULL value passed for - a pointer argument. It could be argued that this is OK since it's - a bug inthe program. But perhaps one could catch the case and return - an error which would allow the program using libdwarf to have fewer - places with error checking. +* libdw ** More memory access checks needed @@ -45,12 +37,6 @@ Time-stamp: <2003-08-07 12:52:49 drepper> ** Rename dwarf_getabbrev -** dwarf_loclist() - - This function and its interface seem to be misdesigned. The specification - is unclear and its changed between v2 and v2.1. Other implementation - implement even different behavior. - * nm: @@ -93,22 +79,22 @@ Time-stamp: <2003-08-07 12:52:49 drepper> The old mapping should be reused in that case. The problem is worse for files which are not mapped read-only (archives again). - ** size for STT_SECTION entries The STT_SECTION entries have zero for the size but can easily get the size of the section. +** .eh_frame_hdr + + Not implemented at all in the moment except for recognition of the option + itself. + * elflint ** additional checks 1st GOT entry == _DYNAMIC - if TEXTREL check whether any relocation touches RO segment - - if TEXTREL not set check that no relocation touches RO segment - check versioning info: always BASE in verdef @@ -116,14 +102,24 @@ Time-stamp: <2003-08-07 12:52:49 drepper> check whether any relocation is for a merge-able section -** possibly missing tests + check TLS relocation depencies + +*** for x86 + + check that R_386_TLS_GD is followed by R_386_PLT32 for __tls_get_addr + +** relax - at most one extended section index table for a symtab + prelink generated files - no extended section index table != ET_REL +* elfcmp - no extended section index table for SHT_DYNSYM +** treat relocation sections special + Differences in the relocation sections can be ignored if all + the same symbols with the same targets are present and the order + of overlapping relocations doesn't change. There really never + should be overlapping relocations but who knows. * mcs diff --git a/ThirdPartyProject.prop b/ThirdPartyProject.prop deleted file mode 100644 index 666ecc19..00000000 --- a/ThirdPartyProject.prop +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2010 Google Inc. All Rights Reserved. -#Fri Jul 16 10:03:08 PDT 2010 -currentVersion=0.144 -version=0.97 -isNative=true -feedurl=\ http\://rhn.redhat.com/errata/ -name=elfutils -keywords=elfutils -onDevice=true -homepage=https\://fedorahosted.org/elfutils @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 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. @@ -11,55 +11,57 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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. +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.63],, +[m4_warning([this file was generated for autoconf 2.63. +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'.])]) -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# Copyright (C) 2002, 2003, 2005, 2006, 2007 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. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +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.10.1], [], + [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 so it can be traced. +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.2])]) - -# AM_AUX_DIR_EXPAND +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 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 @@ -106,26 +108,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004 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. +# AM_CONDITIONAL -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# 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 6 +# serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -134,8 +126,10 @@ AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' @@ -149,26 +143,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # 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 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# serial 9 # 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, @@ -177,7 +159,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -197,6 +178,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" 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=]) @@ -262,6 +244,7 @@ AC_CACHE_CHECK([dependency style of $depcc], depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -314,30 +297,20 @@ if test "x$enable_dependency_tracking" != xno; then AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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. +# Generate code to set up dependency tracking. -*- Autoconf -*- -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -350,8 +323,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -396,30 +370,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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. +# Do all the work for Automake. -*- Autoconf -*- -# 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. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 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. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# serial 13 -# serial 11 +# 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -433,16 +396,20 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # 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.58])dnl +[AC_PREREQ([2.60])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 -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +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 @@ -462,6 +429,9 @@ m4_ifval([$2], 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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [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 @@ -497,6 +467,10 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) @@ -510,62 +484,39 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX], # 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 - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 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. - -# Copyright (C) 2001, 2003 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# -*- Autoconf -*- -# Copyright (C) 2003 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2003, 2005 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 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -580,26 +531,14 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) - -# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 # 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 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 4 +# serial 5 # AM_PROG_LEX # ----------- @@ -613,26 +552,44 @@ if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering -# 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. +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# 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; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# serial 4 -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 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 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -676,27 +633,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# 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. +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# 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. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -712,6 +658,7 @@ AC_SUBST($1)]) # If it does, 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 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then @@ -722,100 +669,41 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005, 2006 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_MKDIR_P # --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) +# Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 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. +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) -# 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. +# Helper functions for option handling. -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2002, 2003, 2005 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 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -840,28 +728,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# -# Check to make sure that the build environment is sane. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 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. +# Check to make sure that the build environment is sane. -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# 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 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -904,25 +780,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 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 @@ -940,30 +805,30 @@ 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="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004 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. +# Copyright (C) 2006 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; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Check how to create a tarball. -*- Autoconf -*- -# serial 1 +# Copyright (C) 2004, 2005 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 2 # _AM_PROG_TAR(FORMAT) # -------------------- @@ -1051,9 +916,6 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/gettext.m4]) -m4_include([m4/iconv.m4]) -m4_include([m4/lib-ld.m4]) -m4_include([m4/lib-link.m4]) -m4_include([m4/lib-prefix.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/po.m4]) m4_include([m4/progtest.m4]) diff --git a/android.patch b/android.patch new file mode 100644 index 00000000..40219013 --- /dev/null +++ b/android.patch @@ -0,0 +1,329 @@ +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/dwarf_begin.c ./libdw/dwarf_begin.c +--- /home/bccheng/local/elfutils-0.138/libdw/dwarf_begin.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdw/dwarf_begin.c 2012-03-07 15:56:49.000000000 -0800 +@@ -94,7 +94,9 @@ + /* Get an ELF descriptor. */ + elf = elf_begin (fd, elfcmd, NULL); + if (elf == NULL) ++ /* ANDROID_CHANGE_BEGIN */ + { ++#if 0 + /* Test why the `elf_begin" call failed. */ + struct stat64 st; + +@@ -104,6 +106,10 @@ + __libdw_seterrno (DWARF_E_INVALID_FILE); + else + __libdw_seterrno (DWARF_E_IO_ERROR); ++#else ++ __libdw_seterrno (DWARF_E_IO_ERROR); ++#endif ++ /* ANDROID_CHANGE_END */ + } + else + { +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/dwarf_getpubnames.c ./libdw/dwarf_getpubnames.c +--- /home/bccheng/local/elfutils-0.138/libdw/dwarf_getpubnames.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdw/dwarf_getpubnames.c 2012-03-07 15:56:49.000000000 -0800 +@@ -60,6 +60,9 @@ + #include <libdwP.h> + #include <dwarf.h> + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ + + static int + get_offsets (Dwarf *dbg) +@@ -235,7 +238,13 @@ + gl.die_offset += dbg->pubnames_sets[cnt].cu_offset; + + gl.name = (char *) readp; ++ /* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ readp = gl.name + strlen(gl.name) + 1; ++#else + readp = (unsigned char *) rawmemchr (gl.name, '\0') + 1; ++#endif ++ /* ANDROID_CHANGE_END */ + + /* We found name and DIE offset. Report it. */ + if (callback (dbg, &gl, arg) != DWARF_CB_OK) +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdw/libdw_alloc.c ./libdw/libdw_alloc.c +--- /home/bccheng/local/elfutils-0.138/libdw/libdw_alloc.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdw/libdw_alloc.c 2012-03-07 15:56:49.000000000 -0800 +@@ -58,6 +58,9 @@ + #include <sys/param.h> + #include "libdwP.h" + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ + + void * + __libdw_allocate (Dwarf *dbg, size_t minsize, size_t align) +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c ./libdwfl/dwfl_build_id_find_elf.c +--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_build_id_find_elf.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdwfl/dwfl_build_id_find_elf.c 2012-03-07 15:56:49.000000000 -0800 +@@ -52,6 +52,9 @@ + #include <fcntl.h> + #include <unistd.h> + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ + + int + internal_function +@@ -84,8 +87,16 @@ + ".debug"); + + const Dwfl_Callbacks *const cb = mod->dwfl->callbacks; ++ ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) ++ ?: DEFAULT_DEBUGINFO_PATH); ++#else + char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); ++#endif ++/* ANDROID_CHANGE_END */ + + int fd = -1; + char *dir; +@@ -103,7 +114,6 @@ + if (unlikely (name == NULL)) + break; + memcpy (mempcpy (name, dir, dirlen), id_name, sizeof id_name); +- + fd = TEMP_FAILURE_RETRY (open64 (name, O_RDONLY)); + if (fd >= 0) + { +@@ -119,6 +129,12 @@ + free (name); + } + ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ free(path); ++#endif ++/* ANDROID_CHANGE_END */ ++ + /* If we simply found nothing, clear errno. If we had some other error + with the file, report that. Possibly this should treat other errors + like ENOENT too. But ignoring all errors could mask some that should +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_build_id.c ./libdwfl/dwfl_module_build_id.c +--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_build_id.c 2008-12-30 21:48:23.000000000 -0800 ++++ ./libdwfl/dwfl_module_build_id.c 2012-03-07 15:56:49.000000000 -0800 +@@ -139,9 +139,16 @@ + return result; + } + ++/* ANDROID_CHANGE_BEGIN */ ++#if 0 + int + __dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) ++#else ++dwfl_module_build_id (Dwfl_Module *mod, ++ const unsigned char **bits, GElf_Addr *vaddr) ++#endif ++/* ANDROID_CHANGE_END */ + { + if (mod == NULL) + return -1; +@@ -164,6 +171,9 @@ + *vaddr = mod->build_id_vaddr; + return mod->build_id_len; + } ++ ++/* ANDROID_CHANGE_BEGIN */ ++#if 0 + extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id) + __attribute__ ((alias ("__dwfl_module_build_id"))); + asm (".symver " +@@ -180,3 +190,5 @@ + } + asm (".symver " + "_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130"); ++#endif ++/* ANDROID_CHANGE_END */ +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c ./libdwfl/dwfl_module_getdwarf.c +--- /home/bccheng/local/elfutils-0.138/libdwfl/dwfl_module_getdwarf.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdwfl/dwfl_module_getdwarf.c 2012-03-07 15:56:49.000000000 -0800 +@@ -53,6 +53,9 @@ + #include <unistd.h> + #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */ + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ + + /* Open libelf FILE->fd and compute the load base of ELF as loaded in MOD. + When we return success, FILE->elf and FILE->bias are set up. */ +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/find-debuginfo.c ./libdwfl/find-debuginfo.c +--- /home/bccheng/local/elfutils-0.138/libdwfl/find-debuginfo.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libdwfl/find-debuginfo.c 2012-03-07 15:56:49.000000000 -0800 +@@ -53,6 +53,9 @@ + #include <unistd.h> + #include "system.h" + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ + + /* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1. + On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file. */ +@@ -145,8 +148,15 @@ + indicated by the debug directory path setting. */ + + const Dwfl_Callbacks *const cb = mod->dwfl->callbacks; ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) ++ ?: DEFAULT_DEBUGINFO_PATH); ++#else + char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); ++#endif ++/* ANDROID_CHANGE_END */ + + /* A leading - or + in the whole path sets whether to check file CRCs. */ + bool defcheck = true; +@@ -156,8 +166,15 @@ + ++path; + } + ++ /* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ char *file_dirname = (file_basename == file_name ? NULL ++ : strndup (file_name, file_basename - 1 - file_name)); ++#else + char *file_dirname = (file_basename == file_name ? NULL + : strndupa (file_name, file_basename - 1 - file_name)); ++#endif ++ /* ANDROID_CHANGE_END */ + char *p; + while ((p = strsep (&path, ":")) != NULL) + { +@@ -201,17 +218,36 @@ + case ENOTDIR: + continue; + default: ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ free(path); ++ free(file_dirname); ++#endif ++/* ANDROID_CHANGE_END */ + return -1; + } + if (validate (mod, fd, check, debuglink_crc)) + { + *debuginfo_file_name = fname; ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ free(path); ++ free(file_dirname); ++#endif ++/* ANDROID_CHANGE_END */ + return fd; + } + free (fname); + close (fd); + } + ++/* ANDROID_CHANGE_BEGIN */ ++#ifdef __BIONIC__ ++ free(path); ++ free(file_dirname); ++#endif ++/* ANDROID_CHANGE_END */ ++ + /* No dice. */ + errno = 0; + return -1; +diff -r -u -d /home/bccheng/local/elfutils-0.138/libdwfl/offline.c ./libdwfl/offline.c +--- /home/bccheng/local/elfutils-0.138/libdwfl/offline.c 2008-12-17 16:29:37.000000000 -0800 ++++ ./libdwfl/offline.c 2012-03-07 15:56:49.000000000 -0800 +@@ -51,6 +51,10 @@ + #include <fcntl.h> + #include <unistd.h> + ++/* ANDROID_CHANGE_BEGIN */ ++#include <AndroidFixup.h> ++/* ANDROID_CHANGE_END */ ++ + /* Since dwfl_report_elf lays out the sections already, this will only be + called when the section headers of the debuginfo file are being + consulted instead, or for the section placed at 0. With binutils +diff -r -u -d /home/bccheng/local/elfutils-0.138/libebl/libeblP.h ./libebl/libeblP.h +--- /home/bccheng/local/elfutils-0.138/libebl/libeblP.h 2008-12-10 20:33:30.000000000 -0800 ++++ ./libebl/libeblP.h 2012-03-07 15:56:49.000000000 -0800 +@@ -55,7 +55,6 @@ + #include <libebl.h> + #include <libintl.h> + +- + /* Backend handle. */ + struct ebl + { +diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf32_fsize.c ./libelf/elf32_fsize.c +--- /home/bccheng/local/elfutils-0.138/libelf/elf32_fsize.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libelf/elf32_fsize.c 2012-03-08 15:00:38.000000000 -0800 +@@ -88,5 +88,9 @@ + * __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][type]); + #endif + } ++/* ANDROID_CHANGE_BEGIN */ ++#ifndef __APPLE__ + #define local_strong_alias(n1, n2) strong_alias (n1, n2) + local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize)) ++#endif ++/* ANDROID_CHANGE_END */ +diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf_begin.c ./libelf/elf_begin.c +--- /home/bccheng/local/elfutils-0.138/libelf/elf_begin.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libelf/elf_begin.c 2012-03-08 15:34:30.000000000 -0800 +@@ -68,7 +68,6 @@ + #include "libelfP.h" + #include "common.h" + +- + /* Create descriptor for archive in memory. */ + static inline Elf * + file_read_ar (int fildes, void *map_address, off_t offset, size_t maxsize, +diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/elf.h ./libelf/elf.h +--- /home/bccheng/local/elfutils-0.138/libelf/elf.h 2008-12-10 20:33:30.000000000 -0800 ++++ ./libelf/elf.h 2012-03-08 15:06:31.000000000 -0800 +@@ -21,7 +21,15 @@ + #ifndef _ELF_H + #define _ELF_H 1 + ++/* ANDROID_CHANGE_BEGIN */ ++/* ++ * elf.h may be directly included from a different project, and features.h does ++ * not exist on host Mac OS. ++ */ ++#ifndef __APPLE__ + #include <features.h> ++#endif ++/* ANDROID_CHANGE_END */ + + __BEGIN_DECLS + +diff -r -u -d /home/bccheng/local/elfutils-0.138/libelf/gelf_xlate.c ./libelf/gelf_xlate.c +--- /home/bccheng/local/elfutils-0.138/libelf/gelf_xlate.c 2008-12-10 20:33:30.000000000 -0800 ++++ ./libelf/gelf_xlate.c 2012-03-08 15:00:38.000000000 -0800 +@@ -229,7 +229,11 @@ + } + } + }; ++/* ANDROID_CHANGE_BEGIN */ ++#ifndef __APPLE__ + /* For now we only handle the case where the memory representation is the + same as the file representation. Should this change we have to define + separate functions. For now reuse them. */ + strong_alias (__elf_xfctstom, __elf_xfctstof) ++#endif ++/* ANDROID_CHANGE_END */ diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 deleted file mode 100644 index 76f8f33e..00000000 --- a/autom4te.cache/output.0 +++ /dev/null @@ -1,7272 +0,0 @@ -@%:@! /bin/sh -@%:@ From configure.ac Revision: 1.30 . -@%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.59 for Red Hat elfutils 0.97. -@%:@ -@%:@ Report bugs to <http://bugzilla.redhat.com/bugzilla/>. -@%:@ -@%:@ Copyright (C) 2003 Free Software Foundation, Inc. -@%:@ This configure script is free software; the Free Software Foundation -@%:@ gives unlimited permission to copy, distribute and modify it. -@%:@ -@%:@ Copyright (C) 1996-2003, 2004 Red Hat, Inc. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='Red Hat elfutils' -PACKAGE_TARNAME='elfutils' -PACKAGE_VERSION='0.97' -PACKAGE_STRING='Red Hat elfutils 0.97' -PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/' - -ac_unique_file="libelf/libelf.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE USE_NLS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu MUDFLAP_TRUE MUDFLAP_FALSE LIB@&t@OBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Red Hat elfutils 0.97 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -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 Red Hat elfutils 0.97:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-tls enable use of thread local storage - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --disable-nls do not use Native Language Support - --disable-largefile omit support for large files - --disable-generic do not build generic linker - --enable-mudflap build binaries with mudflap instrumentation - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld default=no - --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib - --without-libiconv-prefix don't search for libiconv in includedir and libdir - --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib - --without-libintl-prefix don't search for libintl in includedir and libdir - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have - headers in a nonstandard directory <include dir> - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to <http://bugzilla.redhat.com/bugzilla/>. -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -Red Hat elfutils configure 0.97 -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. - -Copyright (C) 1996-2003, 2004 Red Hat, Inc. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Red Hat elfutils $as_me 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -@%:@@%:@ --------- @%:@@%:@ -@%:@@%:@ Platform. @%:@@%:@ -@%:@@%:@ --------- @%:@@%:@ - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -@%:@@%:@ ----------- @%:@@%:@ -@%:@@%:@ Core tests. @%:@@%:@ -@%:@@%:@ ----------- @%:@@%:@ - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -@%:@@%:@ ---------------- @%:@@%:@ -@%:@@%:@ Cache variables. @%:@@%:@ -@%:@@%:@ ---------------- @%:@@%:@ -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -@%:@@%:@ ----------------- @%:@@%:@ -@%:@@%:@ Output variables. @%:@@%:@ -@%:@@%:@ ----------------- @%:@@%:@ -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -@%:@@%:@ ------------- @%:@@%:@ -@%:@@%:@ Output files. @%:@@%:@ -@%:@@%:@ ------------- @%:@@%:@ -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -@%:@@%:@ ----------- @%:@@%:@ -@%:@@%:@ confdefs.h. @%:@@%:@ -@%:@@%:@ ----------- @%:@@%:@ -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ac_aux_dir= -for ac_dir in config $srcdir/config; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - ac_config_files="$ac_config_files config/Makefile" - - - - - -am__api_version="1.9" -# 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. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/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_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# 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 ( - 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 - rm -f conftest.file - 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". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -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 $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -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='elfutils' - VERSION='0.97' - - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -@%:@define VERSION "$VERSION" -_ACEOF - -# 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"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - - - ac_config_files="$ac_config_files Makefile" - - ac_config_headers="$ac_config_headers config.h" - - -case m4 in - [\\/]* | ?:[\\/]* ) ac_macro_dir=m4 ;; - *) ac_macro_dir=$srcdir/m4 ;; -esac -if test -d "$ac_macro_dir"; then : -else - { { echo "$as_me:$LINENO: error: cannot find macro directory \`m4'" >&5 -echo "$as_me: error: cannot find macro directory \`m4'" >&2;} - { (exit 1); exit 1; }; } -fi - - ac_config_files="$ac_config_files m4/Makefile" - - - ac_config_files="$ac_config_files elfutils.spec:config/elfutils.spec.in" - - - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -# Check whether --enable-tls or --disable-tls was given. -if test "${enable_tls+set}" = set; then - enableval="$enable_tls" - cat >>confdefs.h <<\_ACEOF -@%:@define USE_TLS 1 -_ACEOF - -fi; - - - -ALL_LINGUAS= - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $@%:@ != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* 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 don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -@%:@ifndef __cplusplus - choke me -@%:@endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -@%:@include <stdlib.h> -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" - -fi; -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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'. - 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 - 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 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - 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 - ;; - none) break ;; - esac - # 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. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} 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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include <limits.h> -@%:@else -@%:@ include <assert.h> -@%:@endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sgtty.h> -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 - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <termio.h> -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 -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - - - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - rm -f messages.po - - # Extract the first word of "msgmerge", so it can be a program name with args. -set dummy msgmerge; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGMERGE" in - /*) - ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGMERGE="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" - ;; -esac -fi -MSGMERGE="$ac_cv_path_MSGMERGE" -if test "$MSGMERGE" != ":"; then - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - rm -f messages.po - fi - - ac_config_commands="$ac_config_commands default-1" - - - - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&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. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path 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 "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$acl_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - -fi -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" - sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" - - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='iconv ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "X$found_dir" = "X/usr/lib"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" - ;; - esac - done - fi - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" - done - fi - - - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - LIBINTL= - LTLIBINTL= - POSUB= - - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - - - - - - - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 - - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - - - - - - am_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCICONV; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <iconv.h> -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <iconv.h> -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then - -cat >>confdefs.h <<\_ACEOF -@%:@define HAVE_ICONV 1 -_ACEOF - - fi - if test "$am_cv_lib_iconv" = yes; then - echo "$as_me:$LINENO: checking how to link with libiconv" >&5 -echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBICONV" >&5 -echo "${ECHO_T}$LIBICONV" >&6 - else - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libintl-prefix or --without-libintl-prefix was given. -if test "${with_libintl_prefix+set}" = set; then - withval="$with_libintl_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBINTL= - LTLIBINTL= - INCINTL= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='intl ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "X$found_dir" = "X/usr/lib"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" - ;; - esac - done - fi - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" - done - fi - - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - gt_use_preinstalled_gnugettext=yes - else - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -@%:@define ENABLE_NLS 1 -_ACEOF - - else - USE_NLS=no - fi - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - echo "$as_me:$LINENO: checking how to link with libintl" >&5 -echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBINTL" >&5 -echo "${ECHO_T}$LIBINTL" >&6 - - for element in $INCINTL; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - fi - - -cat >>confdefs.h <<\_ACEOF -@%:@define HAVE_GETTEXT 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -@%:@define HAVE_DCGETTEXT 1 -_ACEOF - - fi - - POSUB=po - fi - - - - INTLLIBS="$LIBINTL" - - - - - - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test -z "$LEXLIB" -then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fl_yywrap=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi - -fi - -fi - -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" -cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -cat >>confdefs.h <<\_ACEOF -@%:@define YYTEXT_POINTER 1 -_ACEOF - -fi - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi - -echo "$as_me:$LINENO: checking for gcc with C99 support" >&5 -echo $ECHO_N "checking for gcc with C99 support... $ECHO_C" >&6 -if test "${ac_cv_c99+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -std=gnu99" -cat >conftest.$ac_ext <<_ACEOF -int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c99=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c99=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$old_CFLAGS" -fi -echo "$as_me:$LINENO: result: $ac_cv_c99" >&5 -echo "${ECHO_T}$ac_cv_c99" >&6 -if test "x$ac_cv_c99" != xyes; then - { { echo "$as_me:$LINENO: error: gcc with C99 support required" >&5 -echo "$as_me: error: gcc with C99 support required" >&2;} - { (exit 1); exit 1; }; } -fi - - -LOCALEDIR=$datadir - -cat >>confdefs.h <<_ACEOF -@%:@define LOCALEDIR "$LOCALEDIR" -_ACEOF - - - - -DATADIRNAME=$datadir - - -# Check whether --enable-largefile or --disable-largefile was given. -if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" - -fi; -if test "$enable_largefile" != no; then - - echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 -echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 -if test "${ac_cv_sys_largefile_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@include <sys/types.h> - /* 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 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_largefile_CC=' -n32'; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 -echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - - echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 -if test "${ac_cv_sys_file_offset_bits+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - while :; do - ac_cv_sys_file_offset_bits=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@include <sys/types.h> - /* 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 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@define _FILE_OFFSET_BITS 64 -@%:@include <sys/types.h> - /* 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 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_file_offset_bits=64; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - break -done -fi -echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 -echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 -if test "$ac_cv_sys_file_offset_bits" != no; then - -cat >>confdefs.h <<_ACEOF -@%:@define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF - -fi -rm -f conftest* - echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 -echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 -if test "${ac_cv_sys_large_files+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - while :; do - ac_cv_sys_large_files=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@include <sys/types.h> - /* 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 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -@%:@define _LARGE_FILES 1 -@%:@include <sys/types.h> - /* 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 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sys_large_files=1; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - break -done -fi -echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 -echo "${ECHO_T}$ac_cv_sys_large_files" >&6 -if test "$ac_cv_sys_large_files" != no; then - -cat >>confdefs.h <<_ACEOF -@%:@define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF - -fi -rm -f conftest* -fi - - -native_ld=no -# Check whether --enable-generic or --disable-generic was given. -if test "${enable_generic+set}" = set; then - enableval="$enable_generic" - if test "$enable_generic" = no; then - case "$host_cpu" in - i?86) - cat >>confdefs.h <<\_ACEOF -@%:@define NATIVE_ELF 32 -_ACEOF - - native_ld=yes - base_cpu=i386 - ;; - *) - { { echo "$as_me:$LINENO: error: no machine-specific linker for this configuration available" >&5 -echo "$as_me: error: no machine-specific linker for this configuration available" >&2;} - { (exit 1); exit 1; }; } - ;; - esac -fi -fi; - - - - -if test "$native_ld" = yes; then - NATIVE_LD_TRUE= - NATIVE_LD_FALSE='#' -else - NATIVE_LD_TRUE='#' - NATIVE_LD_FALSE= -fi - -if test -z "$base_cpu"; then - base_cpu=none -fi - - - -use_mudflap=no -# Check whether --enable-mudflap or --disable-mudflap was given. -if test "${enable_mudflap+set}" = set; then - enableval="$enable_mudflap" - if test "x$enable_mudflap" = xyes; then - # Check whether the compiler support -fmudflap. - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fmudflap" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - use_mudflap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -use_mudflap=fail -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$old_CFLAGS" -fi -fi; -if test "$use_mudflap" = fail; then - { { echo "$as_me:$LINENO: error: --enable-mudflap requires a compiler which understands this option -See \`config.log' for more details." >&5 -echo "$as_me: error: --enable-mudflap requires a compiler which understands this option -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - - -if test "$use_mudflap" = yes; then - MUDFLAP_TRUE= - MUDFLAP_FALSE='#' -else - MUDFLAP_TRUE='#' - MUDFLAP_FALSE= -fi - - - - - ac_config_files="$ac_config_files doc/Makefile" - - - ac_config_files="$ac_config_files lib/Makefile" - - - ac_config_files="$ac_config_files libelf/Makefile libelf-po/Makefile.in" - - - ac_config_files="$ac_config_files libebl/Makefile" - - - ac_config_files="$ac_config_files libdw/Makefile" - - - ac_config_files="$ac_config_files libcpu/Makefile" - - - ac_config_files="$ac_config_files libasm/Makefile" - - - ac_config_files="$ac_config_files src/Makefile po/Makefile.in" - - - ac_config_files="$ac_config_files tests/Makefile" - - - - - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIB@&t@OBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${NATIVE_LD_TRUE}" && test -z "${NATIVE_LD_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"NATIVE_LD\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"NATIVE_LD\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${MUDFLAP_TRUE}" && test -z "${MUDFLAP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MUDFLAP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MUDFLAP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX -@%:@@%:@ Running $as_me. @%:@@%:@ -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by Red Hat elfutils $as_me 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -Red Hat elfutils config.status 0.97 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" -# Capture the value of obsolete $ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; - "elfutils.spec" ) CONFIG_FILES="$CONFIG_FILES elfutils.spec:config/elfutils.spec.in" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "libelf/Makefile" ) CONFIG_FILES="$CONFIG_FILES libelf/Makefile" ;; - "libelf-po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES libelf-po/Makefile.in" ;; - "libebl/Makefile" ) CONFIG_FILES="$CONFIG_FILES libebl/Makefile" ;; - "libdw/Makefile" ) CONFIG_FILES="$CONFIG_FILES libdw/Makefile" ;; - "libcpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES libcpu/Makefile" ;; - "libasm/Makefile" ) CONFIG_FILES="$CONFIG_FILES libasm/Makefile" ;; - "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t -s,@XGETTEXT@,$XGETTEXT,;t t -s,@MSGMERGE@,$MSGMERGE,;t t -s,@USE_NLS@,$USE_NLS,;t t -s,@LIBICONV@,$LIBICONV,;t t -s,@LTLIBICONV@,$LTLIBICONV,;t t -s,@INTLLIBS@,$INTLLIBS,;t t -s,@LIBINTL@,$LIBINTL,;t t -s,@LTLIBINTL@,$LTLIBINTL,;t t -s,@POSUB@,$POSUB,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@YACC@,$YACC,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@LOCALEDIR@,$LOCALEDIR,;t t -s,@DATADIRNAME@,$DATADIRNAME,;t t -s,@NATIVE_LD_TRUE@,$NATIVE_LD_TRUE,;t t -s,@NATIVE_LD_FALSE@,$NATIVE_LD_FALSE,;t t -s,@base_cpu@,$base_cpu,;t t -s,@MUDFLAP_TRUE@,$MUDFLAP_TRUE,;t t -s,@MUDFLAP_FALSE@,$MUDFLAP_FALSE,;t t -s,@LIB@&t@OBJS@,$LIB@&t@OBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #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. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - default-1 ) - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/autom4te.cache/requests b/autom4te.cache/requests deleted file mode 100644 index f0e4b0f3..00000000 --- a/autom4te.cache/requests +++ /dev/null @@ -1,116 +0,0 @@ -# This file was generated by Autom4te Thu Nov 25 00:39:59 GMT 2004. -# It contains the lists of macros which have been traced. -# It can be safely removed. - -@request = ( - bless( [ - '0', - 1, - [ - '/usr/share/autoconf' - ], - [ - '/usr/share/autoconf/autoconf/autoconf.m4f', - 'aclocal.m4', - 'configure.ac' - ], - { - 'm4_pattern_forbid' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AC_C_VOLATILE' => 1, - 'AC_TYPE_OFF_T' => 1, - 'AC_FUNC_CLOSEDIR_VOID' => 1, - 'AC_REPLACE_FNMATCH' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AC_FUNC_STAT' => 1, - 'AC_FUNC_WAIT3' => 1, - 'AC_HEADER_TIME' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_STRUCT_TM' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AC_FUNC_GETMNTENT' => 1, - 'AC_TYPE_MODE_T' => 1, - 'AC_FUNC_STRTOD' => 1, - 'AC_CHECK_HEADERS' => 1, - 'AC_FUNC_STRNLEN' => 1, - 'm4_sinclude' => 1, - 'AC_PROG_CXX' => 1, - 'AC_PATH_X' => 1, - 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, - 'AC_PROG_AWK' => 1, - '_m4_warn' => 1, - 'AC_HEADER_STDC' => 1, - 'AC_HEADER_MAJOR' => 1, - 'AC_FUNC_ERROR_AT_LINE' => 1, - 'AC_PROG_GCC_TRADITIONAL' => 1, - 'AC_LIBSOURCE' => 1, - 'AC_FUNC_MBRTOWC' => 1, - 'AC_STRUCT_ST_BLOCKS' => 1, - 'AC_TYPE_SIGNAL' => 1, - 'AC_TYPE_UID_T' => 1, - 'AC_PROG_MAKE_SET' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'm4_pattern_allow' => 1, - 'sinclude' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_FUNC_STRERROR_R' => 1, - 'AC_PROG_CC' => 1, - 'AC_DECL_SYS_SIGLIST' => 1, - 'AC_FUNC_FORK' => 1, - 'AC_FUNC_STRCOLL' => 1, - 'AC_FUNC_VPRINTF' => 1, - 'AC_PROG_YACC' => 1, - 'AC_INIT' => 1, - 'AC_STRUCT_TIMEZONE' => 1, - 'AC_FUNC_CHOWN' => 1, - 'AC_SUBST' => 1, - 'AC_FUNC_ALLOCA' => 1, - 'AC_CANONICAL_HOST' => 1, - 'AC_FUNC_GETPGRP' => 1, - 'AC_PROG_RANLIB' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_FUNC_SETPGRP' => 1, - 'AC_CONFIG_SUBDIRS' => 1, - 'AC_FUNC_MMAP' => 1, - 'AC_FUNC_REALLOC' => 1, - 'AC_TYPE_SIZE_T' => 1, - 'AC_CONFIG_LINKS' => 1, - 'AC_CHECK_TYPES' => 1, - 'AC_CHECK_MEMBERS' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AC_FUNC_UTIME_NULL' => 1, - 'AC_FUNC_SELECT_ARGTYPES' => 1, - 'AC_HEADER_STAT' => 1, - 'AC_FUNC_STRFTIME' => 1, - 'AC_PROG_CPP' => 1, - 'AC_C_INLINE' => 1, - 'AC_PROG_LEX' => 1, - 'AC_C_CONST' => 1, - 'AC_TYPE_PID_T' => 1, - 'AC_CONFIG_FILES' => 1, - 'include' => 1, - 'AC_FUNC_SETVBUF_REVERSED' => 1, - 'AC_PROG_INSTALL' => 1, - 'AM_GNU_GETTEXT' => 1, - 'AC_CHECK_LIB' => 1, - 'AC_FUNC_OBSTACK' => 1, - 'AC_FUNC_MALLOC' => 1, - 'AC_FUNC_GETGROUPS' => 1, - 'AC_FUNC_GETLOADAVG' => 1, - 'AH_OUTPUT' => 1, - 'AC_FUNC_FSEEKO' => 1, - 'AM_PROG_CC_C_O' => 1, - 'AC_FUNC_MKTIME' => 1, - 'AC_CANONICAL_SYSTEM' => 1, - 'AM_CONDITIONAL' => 1, - 'AC_CONFIG_HEADERS' => 1, - 'AC_HEADER_SYS_WAIT' => 1, - 'AC_PROG_LN_S' => 1, - 'AC_FUNC_MEMCMP' => 1, - 'm4_include' => 1, - 'AC_HEADER_DIRENT' => 1, - 'AC_CHECK_FUNCS' => 1 - } - ], 'Autom4te::Request' ) - ); - diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 deleted file mode 100644 index 659eef34..00000000 --- a/autom4te.cache/traces.0 +++ /dev/null @@ -1,356 +0,0 @@ -m4trace:aclocal.m4:1054: -1- m4_include([m4/gettext.m4]) -m4trace:aclocal.m4:1055: -1- m4_include([m4/iconv.m4]) -m4trace:aclocal.m4:1056: -1- m4_include([m4/lib-ld.m4]) -m4trace:aclocal.m4:1057: -1- m4_include([m4/lib-link.m4]) -m4trace:aclocal.m4:1058: -1- m4_include([m4/lib-prefix.m4]) -m4trace:aclocal.m4:1059: -1- m4_include([m4/progtest.m4]) -m4trace:configure.ac:20: -1- AC_INIT([Red Hat elfutils], [0.97], [http://bugzilla.redhat.com/bugzilla/], [elfutils]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([^_?A[CHUM]_]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([_AC_]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) -m4trace:configure.ac:20: -1- m4_pattern_allow([^AS_FLAGS$]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([^_?m4_]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([^dnl$]) -m4trace:configure.ac:20: -1- m4_pattern_forbid([^_?AS_]) -m4trace:configure.ac:20: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) -m4trace:configure.ac:20: -1- AC_SUBST([PATH_SEPARATOR]) -m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) -m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) -m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) -m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) -m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) -m4trace:configure.ac:20: -1- AC_SUBST([exec_prefix], [NONE]) -m4trace:configure.ac:20: -1- AC_SUBST([prefix], [NONE]) -m4trace:configure.ac:20: -1- AC_SUBST([program_transform_name], [s,x,x,]) -m4trace:configure.ac:20: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) -m4trace:configure.ac:20: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) -m4trace:configure.ac:20: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) -m4trace:configure.ac:20: -1- AC_SUBST([datadir], ['${prefix}/share']) -m4trace:configure.ac:20: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) -m4trace:configure.ac:20: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) -m4trace:configure.ac:20: -1- AC_SUBST([localstatedir], ['${prefix}/var']) -m4trace:configure.ac:20: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) -m4trace:configure.ac:20: -1- AC_SUBST([includedir], ['${prefix}/include']) -m4trace:configure.ac:20: -1- AC_SUBST([oldincludedir], ['/usr/include']) -m4trace:configure.ac:20: -1- AC_SUBST([infodir], ['${prefix}/info']) -m4trace:configure.ac:20: -1- AC_SUBST([mandir], ['${prefix}/man']) -m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) -m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ -#undef PACKAGE_NAME]) -m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) -m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME]) -m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) -m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ -#undef PACKAGE_VERSION]) -m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) -m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING]) -m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) -m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT]) -m4trace:configure.ac:20: -1- AC_SUBST([build_alias]) -m4trace:configure.ac:20: -1- AC_SUBST([host_alias]) -m4trace:configure.ac:20: -1- AC_SUBST([target_alias]) -m4trace:configure.ac:20: -1- AC_SUBST([DEFS]) -m4trace:configure.ac:20: -1- AC_SUBST([ECHO_C]) -m4trace:configure.ac:20: -1- AC_SUBST([ECHO_N]) -m4trace:configure.ac:20: -1- AC_SUBST([ECHO_T]) -m4trace:configure.ac:20: -1- AC_SUBST([LIBS]) -m4trace:configure.ac:22: -1- AC_CONFIG_AUX_DIR([config]) -m4trace:configure.ac:23: -1- AC_CONFIG_FILES([config/Makefile]) -m4trace:configure.ac:29: -1- AM_INIT_AUTOMAKE([gnits 1.7 dist-bzip2]) -m4trace:configure.ac:29: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) -m4trace:configure.ac:29: -1- AM_AUTOMAKE_VERSION([1.9.2]) -m4trace:configure.ac:29: -1- AC_PROG_INSTALL -m4trace:configure.ac:29: -1- AC_SUBST([INSTALL_PROGRAM]) -m4trace:configure.ac:29: -1- AC_SUBST([INSTALL_SCRIPT]) -m4trace:configure.ac:29: -1- AC_SUBST([INSTALL_DATA]) -m4trace:configure.ac:29: -1- AC_SUBST([CYGPATH_W]) -m4trace:configure.ac:29: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME']) -m4trace:configure.ac:29: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION']) -m4trace:configure.ac:29: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) -m4trace:configure.ac:29: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ -#undef PACKAGE]) -m4trace:configure.ac:29: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) -m4trace:configure.ac:29: -1- AH_OUTPUT([VERSION], [/* Version number of package */ -#undef VERSION]) -m4trace:configure.ac:29: -1- AC_SUBST([ACLOCAL]) -m4trace:configure.ac:29: -1- AC_SUBST([AUTOCONF]) -m4trace:configure.ac:29: -1- AC_SUBST([AUTOMAKE]) -m4trace:configure.ac:29: -1- AC_SUBST([AUTOHEADER]) -m4trace:configure.ac:29: -1- AC_SUBST([MAKEINFO]) -m4trace:configure.ac:29: -1- AC_SUBST([install_sh]) -m4trace:configure.ac:29: -1- AC_SUBST([STRIP]) -m4trace:configure.ac:29: -1- AC_SUBST([ac_ct_STRIP]) -m4trace:configure.ac:29: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) -m4trace:configure.ac:29: -1- AC_SUBST([mkdir_p]) -m4trace:configure.ac:29: -1- AC_PROG_AWK -m4trace:configure.ac:29: -1- AC_SUBST([AWK]) -m4trace:configure.ac:29: -1- AC_PROG_MAKE_SET -m4trace:configure.ac:29: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.ac:29: -1- AC_SUBST([am__leading_dot]) -m4trace:configure.ac:29: -1- AC_SUBST([AMTAR]) -m4trace:configure.ac:29: -1- AC_SUBST([am__tar]) -m4trace:configure.ac:29: -1- AC_SUBST([am__untar]) -m4trace:configure.ac:32: -1- AC_CONFIG_FILES([Makefile]) -m4trace:configure.ac:33: -1- AC_CONFIG_HEADERS([config.h]) -m4trace:configure.ac:36: -1- AC_CONFIG_FILES([m4/Makefile]) -m4trace:configure.ac:39: -1- AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) -m4trace:configure.ac:42: -1- AC_CANONICAL_HOST -m4trace:configure.ac:42: -1- AC_SUBST([build], [$ac_cv_build]) -m4trace:configure.ac:42: -1- AC_SUBST([build_cpu], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) -m4trace:configure.ac:42: -1- AC_SUBST([build_vendor], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) -m4trace:configure.ac:42: -1- AC_SUBST([build_os], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) -m4trace:configure.ac:42: -1- AC_SUBST([host], [$ac_cv_host]) -m4trace:configure.ac:42: -1- AC_SUBST([host_cpu], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) -m4trace:configure.ac:42: -1- AC_SUBST([host_vendor], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) -m4trace:configure.ac:42: -1- AC_SUBST([host_os], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) -m4trace:configure.ac:46: -2- AC_DEFINE_TRACE_LITERAL([USE_TLS]) -m4trace:configure.ac:47: -1- AH_OUTPUT([USE_TLS], [/* Defined if thread local storage should be used. */ -#undef USE_TLS]) -m4trace:configure.ac:52: -1- AC_PROG_CC -m4trace:configure.ac:52: -1- AC_SUBST([CC]) -m4trace:configure.ac:52: -1- AC_SUBST([CFLAGS]) -m4trace:configure.ac:52: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.ac:52: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.ac:52: -1- AC_SUBST([CC]) -m4trace:configure.ac:52: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.ac:52: -1- AC_SUBST([CC]) -m4trace:configure.ac:52: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.ac:52: -1- AC_SUBST([CC]) -m4trace:configure.ac:52: -1- AC_SUBST([CC]) -m4trace:configure.ac:52: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.ac:52: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) -m4trace:configure.ac:52: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) -m4trace:configure.ac:52: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) -m4trace:configure.ac:52: -1- AC_SUBST([am__include]) -m4trace:configure.ac:52: -1- AC_SUBST([am__quote]) -m4trace:configure.ac:52: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -m4trace:configure.ac:52: -1- AC_SUBST([AMDEP_TRUE]) -m4trace:configure.ac:52: -1- AC_SUBST([AMDEP_FALSE]) -m4trace:configure.ac:52: -1- AC_SUBST([AMDEPBACKSLASH]) -m4trace:configure.ac:52: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) -m4trace:configure.ac:52: -1- AM_CONDITIONAL([am__fastdepCC], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) -m4trace:configure.ac:52: -1- AC_SUBST([am__fastdepCC_TRUE]) -m4trace:configure.ac:52: -1- AC_SUBST([am__fastdepCC_FALSE]) -m4trace:configure.ac:53: -1- AC_PROG_CPP -m4trace:configure.ac:53: -1- AC_SUBST([CPP]) -m4trace:configure.ac:53: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.ac:53: -1- AC_SUBST([CPP]) -m4trace:configure.ac:54: -1- AC_PROG_GCC_TRADITIONAL -m4trace:configure.ac:54: -1- AC_SUBST([EGREP]) -m4trace:configure.ac:55: -1- AM_GNU_GETTEXT([external]) -m4trace:configure.ac:55: -1- AC_SUBST([MKINSTALLDIRS]) -m4trace:configure.ac:55: -1- AC_SUBST([MSGFMT]) -m4trace:configure.ac:55: -1- AC_SUBST([GMSGFMT], [$ac_cv_path_GMSGFMT]) -m4trace:configure.ac:55: -1- AC_SUBST([XGETTEXT]) -m4trace:configure.ac:55: -1- AC_SUBST([MSGMERGE]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_OUTPUT_COMMANDS' is obsolete. -You should run autoupdate.], [autoconf/status.m4:318: AC_OUTPUT_COMMANDS is expanded from... -m4/gettext.m4:498: AM_PO_SUBDIRS is expanded from... -configure.ac:55: AM_PO_SUBDIRS is required by... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -3- _m4_warn([obsolete], [The macro `_AC_OUTPUT_COMMANDS_CNT' is obsolete. -You should run autoupdate.], [autoconf/status.m4:321: _AC_OUTPUT_COMMANDS_CNT is expanded from... -autoconf/status.m4:318: AC_OUTPUT_COMMANDS is expanded from... -m4/gettext.m4:498: AM_PO_SUBDIRS is expanded from... -configure.ac:55: AM_PO_SUBDIRS is required by... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- AC_SUBST([USE_NLS]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... -autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... -autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... -autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... -autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... -m4/iconv.m4:75: AM_ICONV_LINK is expanded from... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... -autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... -autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... -m4/iconv.m4:75: AM_ICONV_LINK is expanded from... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ICONV]) -m4trace:configure.ac:55: -1- AH_OUTPUT([HAVE_ICONV], [/* Define if you have the iconv() function. */ -#undef HAVE_ICONV]) -m4trace:configure.ac:55: -1- AC_SUBST([LIBICONV]) -m4trace:configure.ac:55: -1- AC_SUBST([LTLIBICONV]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... -autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... -autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... -autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... -autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... -m4/gettext.m4:325: AM_GNU_GETTEXT is expanded from... -configure.ac:55: the top level]) -m4trace:configure.ac:55: -1- AC_DEFINE_TRACE_LITERAL([ENABLE_NLS]) -m4trace:configure.ac:55: -1- AH_OUTPUT([ENABLE_NLS], [/* Define to 1 if translation of program messages to the user\'s native - language is requested. */ -#undef ENABLE_NLS]) -m4trace:configure.ac:55: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETTEXT]) -m4trace:configure.ac:55: -1- AH_OUTPUT([HAVE_GETTEXT], [/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT]) -m4trace:configure.ac:55: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DCGETTEXT]) -m4trace:configure.ac:55: -1- AH_OUTPUT([HAVE_DCGETTEXT], [/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#undef HAVE_DCGETTEXT]) -m4trace:configure.ac:55: -1- AC_SUBST([INTLLIBS]) -m4trace:configure.ac:55: -1- AC_SUBST([LIBINTL]) -m4trace:configure.ac:55: -1- AC_SUBST([LTLIBINTL]) -m4trace:configure.ac:55: -1- AC_SUBST([POSUB]) -m4trace:configure.ac:56: -1- AC_PROG_RANLIB -m4trace:configure.ac:56: -1- AC_SUBST([RANLIB]) -m4trace:configure.ac:56: -1- AC_SUBST([ac_ct_RANLIB]) -m4trace:configure.ac:57: -1- AC_PROG_YACC -m4trace:configure.ac:57: -1- AC_SUBST([YACC]) -m4trace:configure.ac:58: -1- AC_PROG_LEX -m4trace:configure.ac:58: -1- AC_SUBST([LEX]) -m4trace:configure.ac:58: -1- AC_CHECK_LIB([fl], [yywrap], [LEXLIB="-lfl"], [AC_CHECK_LIB(l, yywrap, LEXLIB="-ll")]) -m4trace:configure.ac:58: -1- AC_CHECK_LIB([l], [yywrap], [LEXLIB="-ll"]) -m4trace:configure.ac:58: -1- AC_SUBST([LEXLIB]) -m4trace:configure.ac:58: -1- AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root]) -m4trace:configure.ac:58: -1- AC_DEFINE_TRACE_LITERAL([YYTEXT_POINTER]) -m4trace:configure.ac:58: -1- AH_OUTPUT([YYTEXT_POINTER], [/* Define to 1 if `lex\' declares `yytext\' as a `char *\' by default, not a - `char[]\'. */ -#undef YYTEXT_POINTER]) -m4trace:configure.ac:71: -1- AC_SUBST([LOCALEDIR]) -m4trace:configure.ac:72: -1- AC_DEFINE_TRACE_LITERAL([LOCALEDIR]) -m4trace:configure.ac:73: -1- AH_OUTPUT([LOCALEDIR], [/* Directory to place translation files in. */ -#undef LOCALEDIR]) -m4trace:configure.ac:76: -1- AC_SUBST([DATADIRNAME]) -m4trace:configure.ac:81: -1- AC_DEFINE_TRACE_LITERAL([_FILE_OFFSET_BITS]) -m4trace:configure.ac:81: -1- AH_OUTPUT([_FILE_OFFSET_BITS], [/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS]) -m4trace:configure.ac:81: -1- AC_DEFINE_TRACE_LITERAL([_LARGE_FILES]) -m4trace:configure.ac:81: -1- AH_OUTPUT([_LARGE_FILES], [/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES]) -m4trace:configure.ac:100: -1- AC_DEFINE_TRACE_LITERAL([NATIVE_ELF]) -m4trace:configure.ac:102: -1- AH_OUTPUT([NATIVE_ELF], [/* Define to 32 or 64 if a specific implementation is wanted. */ -#undef NATIVE_ELF]) -m4trace:configure.ac:103: -1- AM_CONDITIONAL([NATIVE_LD], [test "$native_ld" = yes]) -m4trace:configure.ac:103: -1- AC_SUBST([NATIVE_LD_TRUE]) -m4trace:configure.ac:103: -1- AC_SUBST([NATIVE_LD_FALSE]) -m4trace:configure.ac:108: -1- AC_SUBST([base_cpu]) -m4trace:configure.ac:124: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. -You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... -autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... -configure.ac:124: the top level]) -m4trace:configure.ac:128: -1- AM_CONDITIONAL([MUDFLAP], [test "$use_mudflap" = yes]) -m4trace:configure.ac:128: -1- AC_SUBST([MUDFLAP_TRUE]) -m4trace:configure.ac:128: -1- AC_SUBST([MUDFLAP_FALSE]) -m4trace:configure.ac:134: -1- AC_CONFIG_FILES([doc/Makefile]) -m4trace:configure.ac:137: -1- AC_CONFIG_FILES([lib/Makefile]) -m4trace:configure.ac:140: -1- AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in]) -m4trace:configure.ac:143: -1- AC_CONFIG_FILES([libebl/Makefile]) -m4trace:configure.ac:146: -1- AC_CONFIG_FILES([libdw/Makefile]) -m4trace:configure.ac:149: -1- AC_CONFIG_FILES([libcpu/Makefile]) -m4trace:configure.ac:152: -1- AC_CONFIG_FILES([libasm/Makefile]) -m4trace:configure.ac:155: -1- AC_CONFIG_FILES([src/Makefile po/Makefile.in]) -m4trace:configure.ac:158: -1- AC_CONFIG_FILES([tests/Makefile]) -m4trace:configure.ac:251: -1- AH_OUTPUT([zzzz1], [ -/* Eventually we will allow multi-threaded applications to use the - libraries. Therefore we will add the necessary locking although - the macros used expand to nothing for now. */ -#define lock_lock(lock) ((void) (lock)) -#define rwlock_define(class,name) class int name -#define rwlock_init(lock) ((void) (lock)) -#define rwlock_fini(lock) ((void) (lock)) -#define rwlock_rdlock(lock) ((void) (lock)) -#define rwlock_wrlock(lock) ((void) (lock)) -#define rwlock_unlock(lock) ((void) (lock)) -#define tls_key_t void * -#define key_create(keyp, freefct) (1) -#define getspecific(key) key -#define setspecific(key,val) key = val -#define once_define(class,name) class int name -#define once_execute(name,fct) \\ - do { \\ - if (name == 0) \\ - fct (); \\ - name = 1; \\ - } while (0) - -/* gettext helper macro. */ -#define N_(Str) Str - -/* Compiler-specific definitions. */ -#define strong_alias(name, aliasname) \\ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -#ifdef __i386__ -# define internal_function_def __attribute__ ((regparm (3), stdcall)) -#else -# define internal_function_def /* nothing */ -#endif - -# define internal_function \\ - internal_function_def __attribute__ ((visibility ("internal"))) -# define internal_strong_alias(name, aliasname) \\ - extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def; - -#define attribute_hidden \\ - __attribute__ ((visibility ("hidden"))) - -/* Define ALLOW_UNALIGNED if the architecture allows operations on - unaligned memory locations. */ -#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__ -# define ALLOW_UNALIGNED 1 -#else -# define ALLOW_UNALIGNED 0 -#endif - -#define unlikely(expr) __builtin_expect (expr, 0) -#define likely(expr) __builtin_expect (expr, 1) - -#define obstack_calloc(ob, size) \\ - ({ size_t _s = (size); memset (obstack_alloc (ob, _s), \'\\0\', _s); }) -#define obstack_strdup(ob, str) \\ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) -#define obstack_strndup(ob, str, n) \\ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) - -#if __STDC_VERSION__ >= 199901L -# define flexarr_size /* empty */ -#else -# define flexarr_size 0 -#endif - -/* Calling conventions. */ -#ifdef __i386__ -# define CALLING_CONVENTION regparm (3), stdcall -# define AND_CALLING_CONVENTION , regparm (3), stdcall -#else -# define CALLING_CONVENTION -# define AND_CALLING_CONVENTION -#endif - -/* Avoid PLT entries. */ -#ifdef PIC -# define INTUSE(name) _INTUSE(name) -# define _INTUSE(name) __##name##_internal -# define INTDEF(name) _INTDEF(name) -# define _INTDEF(name) \\ - extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); -#else -# define INTUSE(name) name -# define INTDEF(name) /* empty */ -#endif -]) -m4trace:configure.ac:253: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) -m4trace:configure.ac:253: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) diff --git a/backends/ChangeLog b/backends/ChangeLog new file mode 100644 index 00000000..85609b15 --- /dev/null +++ b/backends/ChangeLog @@ -0,0 +1,355 @@ +2008-10-04 Ulrich Drepper <drepper@redhat.com> + + * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and + TLS_DESC. + +2008-08-01 Roland McGrath <roland@redhat.com> + + * x86_corenote.c: New file. + * Makefile.am (noinst_HEADERS): Add it. + * i386_corenote.c: Include it, use EXTRA_NOTES_IOPERM in EXTRA_NOTES. + * x86_64_corenote.c: Likewise. + + * linux-core-note.c (prstatus_items): Use 'B' instead of 'b' + for sigpend and sighold. + +2008-07-04 Roland McGrath <roland@redhat.com> + + * i386_syscall.c: New file. + * x86_64_syscall.c: New file. + * ppc_syscall.c: New file. + * Makefile.am (i386_SRCS, x86_64_SRCS, ppc_SRCS, ppc64_SRCS): Add them. + * i386_init.c (i386_init): Initialize syscall_abi hook. + * x86_64_init.c (x86_64_init): Likewise. + * ppc_init.c (ppc_init): Likewise. + * ppc64_init.c (ppc64_init): Likewise. + + * ppc_corenote.c (PRSTATUS_REGSET_ITEMS): Add nip. + Fix offset calculation for 64-bit case. + +2008-04-04 Roland McGrath <roland@redhat.com> + + * alpha_symbol.c (alpha_check_special_section): New function. + * alpha_init.c (alpha_init): Initialize check_special_section hook. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * sparc_symbol.c (sparc_symbol_type_name): New function. + (sparc_dynamic_tag_name): New function. + (sparc_dynamic_tag_check): New function. + * sparc_init.c (sparc_init): Initialize those hooks. + + * sparc_symbol.c (sparc_check_special_section): New function. + * sparc_init.c (sparc_init): Initialize check_special_section hook. + +2008-02-20 Roland McGrath <roland@redhat.com> + + * ppc_attrs.c: New file. + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add it. + * ppc_init.c (ppc_init): Initialize check_object_attribute hook. + +2008-02-14 Roland McGrath <roland@redhat.com> + + * alpha_auxv.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize auxv_info hook. + +2008-02-08 Roland McGrath <roland@redhat.com> + + * ppc_corenote.c (spe_regs): New const variable. + (EXTRA_NOTES): Use it for NT_PPC_SPE. + +2008-01-02 Roland McGrath <roland@redhat.com> + + * i386_corenote.c (tls_items): New const table. + (tls_info): New function, uses it. + (EXTRA_NOTES): Use it to handle NT_386_TLS. + +2008-01-08 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add x86-64 disassembler. + * x86_64_init.c (x86_64_init): Hook up disassembler. + +2007-12-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add x86 disassembler. + * i386_init.c (i386_init): Hook up disassembler. + +2007-12-15 Roland McGrath <roland@redhat.com> + + * ppc_regs.c (ppc_register_info): Return "spefscr", not "spr512". + +2007-10-18 Roland McGrath <roland@redhat.com> + + * ppc_regs.c (ppc_register_info): Assign 67 to "vscr". + Return "vector" and 32 bits for vscr and vrsave. + * ppc_corenote.c (altivec_regs): New variable. + (EXTRA_NOTES): New macro, handle NT_PPC_VMX. + + * linux-core-note.c (EXTRA_REGSET): New macro. + Remove NT_PRXFPREG case. Instead, use EXTRA_NOTES if defined. + * i386_corenote.c (EXTRA_NOTES): Define it. + +2007-10-09 Roland McGrath <roland@redhat.com> + + * sparc_auxv.c: New file. + * Makefile.am (sparc_SRCS): Add it. + * sparc_init.c (sparc_init): Initialize auxv_info hook. + +2007-10-08 Roland McGrath <roland@redhat.com> + + * linux-core-note.c (TIMEVAL_FIELD): New macro. + (prstatus_items): Use it. + * sparc_corenote.c: New file. + * sparc64_corenote.c: New file. + * Makefile.am (sparc_SRCS): Add them. + * sparc_init.c (sparc_init): Initialize core_note hook. + + * sparc_symbol.c (sparc_machine_flag_check): New function. + * sparc_init.c (sparc_init): Use it. + +2007-09-27 Roland McGrath <roland@redhat.com> + + * alpha_retval.c: Use dwarf_attr_integrate and dwarf_hasattr_integrate. + * i386_retval.c: Likewise. + * ia64_retval.c: Likewise. + * ppc64_retval.c: Likewise. + * ppc_retval.c: Likewise. + * s390_retval.c: Likewise. + * sparc_retval.c: Likewise. + * x86_64_retval.c: Likewise. + +2007-10-31 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: More dependencies for the libebl_* libraries. + +2007-08-23 Roland McGrath <roland@redhat.com> + + * x86_64_regs.c (x86_64_register_info): Put %rflags in "integer" set. + +2007-08-22 Roland McGrath <roland@redhat.com> + + * linux-core-note.c (prstatus_items): Add .group initializers. + (prpsinfo_items): Likewise. + * x86_64_corenote.c (PRSTATUS_REGSET_ITEMS): Likewise. + * i386_corenote.c (PRSTATUS_REGSET_ITEMS): Likewise. + * ppc_corenote.c (PRSTATUS_REGSET_ITEMS): Likewise. + +2007-08-20 Roland McGrath <roland@redhat.com> + + * ppc_symbol.c (ppc_check_special_symbol): For _GLOBAL_OFFSET_TABLE_ + when DT_PPC_GOT is not found, anywhere in the section is valid. + +2007-08-19 Roland McGrath <roland@redhat.com> + + * i386_auxv.c: New file. + * Makefile.am (i386_SRCS, x86_64_SRCS): Add it. + * ppc_auxv.c: New file. + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add it. + * i386_init.c (i386_init): Initialize auxv_info hook. + * x86_64_init.c (x86_64_init): Likewise. + * ppc_init.c (ppc_init): Likewise. + * ppc64_init.c (ppc64_init): Likewise. + + * alpha_corenote.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize core_note hook. + + * ppc_corenote.c: New file. + * ppc64_corenote.c: New file. + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add them. + * ppc_init.c (ppc_init): Initialize core_note hook. + * ppc64_init.c (ppc64_init): Likewise. + + * linux-core-note.c: New file. + * Makefile.am (noinst_HEADERS): Add it. + * i386_corenote.c: Rewritten. + * x86_64_corenote.c: Likewise. + +2007-05-23 Roland McGrath <roland@redhat.com> + + * alpha_regs.c (alpha_register_info): fp -> s6 + +2007-04-26 Roland McGrath <roland@redhat.com> + + * alpha_symbol.c (alpha_machine_section_flag_check): New function. + * alpha_init.c (alpha_init): Initialize hook. + + * alpha_regs.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize register_info hook. + +2007-04-22 Roland McGrath <roland@redhat.com> + + * ppc_regs.c (ppc_register_info): Use some names instead of sprNNN: + mq, xer, lr, ctr, dsisr, dar, dec, vrsave. + Set *BITS to 64 for FPU registers. + + * i386_regs.c (i386_register_info): Set *BITS to 16 for fctrl, fstat. + * x86_64_regs.c (x86_64_register_info): Likewise for fcw, fsw. + +2007-04-01 Roland McGrath <roland@redhat.com> + + * x86_64_regs.c (x86_64_register_info): Add more registers from newer + ABI spec. + +2007-01-11 Roland McGrath <roland@redhat.com> + + * ia64_symbol.c (ia64_machine_section_flag_check): New function. + * ia64_init.c (ia64_init): Use it. + + * ia64_symbol.c (ia64_section_type_name): Typo fix in string. + +2006-10-09 Roland McGrath <roland@redhat.com> + + * ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * sparc_retval.c: New file. + * Makefile.am (sparc_SRCS): Add it. + * sparc_init.c (sparc_init): Initialize return_value_location hook. + +2006-08-22 Roland McGrath <roland@redhat.com> + + * i386_regs.c (i386_register_name): Renamed i386_register_info. + Take new args, yield more info. + * i386_init.c (i386_init): Update initializer. + * ia64_regs.c (ia64_register_name): Likewise. + * ia64_init.c (ia64_init): Likewise. + * ppc_regs.c (ppc_register_name): Likewise. + * ppc64_init.c (ppc64_init): Likewise. + * ppc_init.c (ppc_init): Likewise. + * s390_regs.c (s390_register_name): Likewise. + * s390_init.c (s390_init): Likewise. + * sparc_regs.c (sparc_register_name): Likewise. + * sparc_init.c (sparc_init): Likewise. + * x86_64_regs.c (x86_64_register_name): Likewise. + * x86_64_init.c (x86_64_init): Likewise. + +2006-08-08 Roland McGrath <roland@redhat.com> + + * Makefile.am (%.os): Don't depend on %.o, since we don't actually + need static object for anything here. This rule is the only source of + .deps/ files. + +2006-06-23 Stepan Kasal <skasal@redhat.com> + + * Makefile.am (PACKAGE_VERSION): Remove superfluous definition. + +2006-08-03 Roland McGrath <roland@redhat.com> + + * sparc_regs.c (sparc_register_name): List 32 FPU regs only for + EM_SPARC. EM_SPARC32PLUS also has 64. + +2006-07-21 Roland McGrath <roland@redhat.com> + + * i386_regs.c (i386_register_name): Fix return value when using stpcpy. + * ppc_regs.c (ppc_register_name): Likewise. + * s390_regs.c (s390_register_name): Likewise. + + * ia64_retval.c: New file. + * Makefile.am (ia64_SRCS): Add it. + * ia64_init.c (ia64_init): Install return_value_location hook. + + * ia64_regs.c: New file. + * Makefile.am (ia64_SRCS): Add it. + * ia64_init.c (ia64_init): Install register_name hook. + +2006-07-05 Ulrich Drepper <drepper@redhat.com> + + * alpha_init.c: Initialize sysvhash_entrysize. + * s390_init.c: Likewise. + +2006-07-04 Ulrich Drepper <drepper@redhat.com> + + * common-reloc.c (relative_reloc_p): New function. + (init_reloc): Hook it up. + * ia64_reloc.def: Define NO_RELATIVE_RELOC. + +2006-06-13 Roland McGrath <roland@redhat.com> + + * ppc64_retval.c: Remove SVR4_STRUCT_RETURN braino. + +2006-06-12 Ulrich Drepper <drepper@redhat.com> + + * common-reloc.c (none_reloc_p): New function. + (init_reloc): Hook it up. + +2006-02-22 Roland McGrath <roland@redhat.com> + + * ppc64_retval.c (SVR4_STRUCT_RETURN): New macro. + (ppc64_return_value_location): Use registers for aggregate conditional + on that. + * ppc_retval.c (SVR4_STRUCT_RETURN): New macro. + (ppc_return_value_location): Use registers for aggregate conditional + on that. + +2006-01-12 Roland McGrath <roland@redhat.com> + + * s390_retval.c: New file. + * Makefile.am (s390_SRCS): Add it. + * s390_init.c (s390_init): Install return_value_location hook. + +2006-01-11 Roland McGrath <roland@redhat.com> + + * s390_regs.c: New file. + * Makefile.am (s390_SRCS): Add it. + * s390_init.c (s390_init): Install register_name hook. + + * s390_reloc.def: Update bits per + Martin Schwidefsky <schwidefsky@de.ibm.com>. + +2005-12-10 Ulrich Drepper + + * common-reloc.c (R_NAME): Generate string correctly. + +2005-12-05 Roland McGrath <roland@redhat.com> + + * i386_regs.c (i386_register_name): Use a table for the first 8 regs. + * x86_64_regs.c (x86_64_register_name): Likewise. + +2005-11-25 Roland McGrath <roland@redhat.com> + + * i386_regs.c (i386_register_name): Return 0, not 1, for gaps. + + * i386_regs.c: New file. + * ppc_regs.c: New file. + * sparc_regs.c: New file. + * x86_64_regs.c: New file. + * Makefile.am + (i386_SRCS, x86_64_SRCS, ppc_SRCS, ppc64_SRCS, sparc_SRCS): Add them. + * i386_init.c: Initialize register_name hook. + * ppc_init.c: Likewise. + * ppc64_init.c: Likewise. + * sparc_init.c: Likewise. + * x86_64_init.c: Likewise. + +2005-11-19 Roland McGrath <roland@redhat.com> + + * ppc64_reloc.def: REL30 -> ADDR30. + +2005-11-18 Roland McGrath <roland@redhat.com> + + * alpha_init.c: Use HOOK macro. + * arm_init.c: Likewise. + * i386_init.c: Likewise. + * ia64_init.c: Likewise. + * ppc64_init.c: Likewise. + * ppc_init.c: Likewise. + * s390_init.c: Likewise. + * sh_init.c: Likewise. + * sparc_init.c: Likewise. + * x86_64_init.c: Likewise. + +2005-11-17 Roland McGrath <roland@redhat.com> + + * Makefile.am (uninstall): Don't try to remove $(pkgincludedir). + (CLEANFILES): Add libebl_$(m).so. + + * ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>. + * ppc64_reloc.def: Likewise. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * Contents moved here from ../libebl. diff --git a/backends/Makefile.am b/backends/Makefile.am new file mode 100644 index 00000000..5b552946 --- /dev/null +++ b/backends/Makefile.am @@ -0,0 +1,154 @@ +## Process this file with automake to create Makefile.in +## +## Copyright (C) 2000-2006, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. +## +## Red Hat elfutils 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; version 2 of the License. +## +## Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" +if MUDFLAP +AM_CFLAGS = -fmudflap +else +AM_CFLAGS = +endif +AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \ + -std=gnu99 +INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. + + +modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 +libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ + libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ + libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ + libebl_s390_pic.a +noinst_LIBRARIES = $(libebl_pic) +noinst_DATA = $(libebl_pic:_pic.a=.so) + + +if MUDFLAP +libelf = ../libelf/libelf.a +libdw = ../libdw/libdw.a +libmudflap = -lmudflap +else +libelf = ../libelf/libelf.so +libdw = ../libdw/libdw.so +libmudflap = +endif + + +textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi + + +i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \ + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c +cpu_i386 = ../libcpu/libcpu_i386.a +libebl_i386_pic_a_SOURCES = $(i386_SRCS) +am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) + +sh_SRCS = sh_init.c sh_symbol.c +libebl_sh_pic_a_SOURCES = $(sh_SRCS) +am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) + +x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \ + x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c +cpu_x86_64 = ../libcpu/libcpu_x86_64.a +libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) +am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) + +ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c +libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) +am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) + +alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ + alpha_corenote.c alpha_auxv.c +libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) +am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) + +arm_SRCS = arm_init.c arm_symbol.c +libebl_arm_pic_a_SOURCES = $(arm_SRCS) +am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) + +sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ + sparc_corenote.c sparc64_corenote.c sparc_auxv.c +libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) +am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) + +ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c +libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) +am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) + +ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c +libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) +am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) + +s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c +libebl_s390_pic_a_SOURCES = $(s390_SRCS) +am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) + + +libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw) \ + $(cpu_$(@:libebl_%.so=%) + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ + -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) + $(textrel_check) + +# XXX Should not be needed... +libebl_i386.so: $(cpu_i386) +libebl_x86_64.so: $(cpu_x86_64) + +libebl_%.map: Makefile + echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@ + +%.os: %.c + if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + +install: install-am install-ebl-modules +install-ebl-modules: + $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + for m in $(modules); do \ + $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + +uninstall: uninstall-am + for m in $(modules); do \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + +noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c +EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) + +CLEANFILES = *.gcno *.gcda \ + $(foreach m,$(modules),\ + libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS)) diff --git a/backends/Makefile.in b/backends/Makefile.in new file mode 100644 index 00000000..6e1d3d7b --- /dev/null +++ b/backends/Makefile.in @@ -0,0 +1,675 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 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@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@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 = backends +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libebl_alpha_pic_a_AR = $(AR) $(ARFLAGS) +libebl_alpha_pic_a_LIBADD = +am__objects_1 = alpha_init.$(OBJEXT) alpha_symbol.$(OBJEXT) \ + alpha_retval.$(OBJEXT) alpha_regs.$(OBJEXT) \ + alpha_corenote.$(OBJEXT) alpha_auxv.$(OBJEXT) +libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) +libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) +libebl_arm_pic_a_LIBADD = +am__objects_2 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) +libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) +libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) +libebl_i386_pic_a_LIBADD = +am__objects_3 = i386_init.$(OBJEXT) i386_symbol.$(OBJEXT) \ + i386_corenote.$(OBJEXT) i386_retval.$(OBJEXT) \ + i386_regs.$(OBJEXT) i386_auxv.$(OBJEXT) i386_syscall.$(OBJEXT) +libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS) +libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ia64_pic_a_LIBADD = +am__objects_4 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT) \ + ia64_regs.$(OBJEXT) ia64_retval.$(OBJEXT) +libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS) +libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ppc64_pic_a_LIBADD = +am__objects_5 = ppc64_init.$(OBJEXT) ppc64_symbol.$(OBJEXT) \ + ppc64_retval.$(OBJEXT) ppc64_corenote.$(OBJEXT) \ + ppc_regs.$(OBJEXT) ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) \ + ppc_syscall.$(OBJEXT) +libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) +libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ppc_pic_a_LIBADD = +am__objects_6 = ppc_init.$(OBJEXT) ppc_symbol.$(OBJEXT) \ + ppc_retval.$(OBJEXT) ppc_regs.$(OBJEXT) ppc_corenote.$(OBJEXT) \ + ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) ppc_syscall.$(OBJEXT) +libebl_ppc_pic_a_OBJECTS = $(am_libebl_ppc_pic_a_OBJECTS) +libebl_s390_pic_a_AR = $(AR) $(ARFLAGS) +libebl_s390_pic_a_LIBADD = +am__objects_7 = s390_init.$(OBJEXT) s390_symbol.$(OBJEXT) \ + s390_regs.$(OBJEXT) s390_retval.$(OBJEXT) +libebl_s390_pic_a_OBJECTS = $(am_libebl_s390_pic_a_OBJECTS) +libebl_sh_pic_a_AR = $(AR) $(ARFLAGS) +libebl_sh_pic_a_LIBADD = +am__objects_8 = sh_init.$(OBJEXT) sh_symbol.$(OBJEXT) +libebl_sh_pic_a_OBJECTS = $(am_libebl_sh_pic_a_OBJECTS) +libebl_sparc_pic_a_AR = $(AR) $(ARFLAGS) +libebl_sparc_pic_a_LIBADD = +am__objects_9 = sparc_init.$(OBJEXT) sparc_symbol.$(OBJEXT) \ + sparc_regs.$(OBJEXT) sparc_retval.$(OBJEXT) \ + sparc_corenote.$(OBJEXT) sparc64_corenote.$(OBJEXT) \ + sparc_auxv.$(OBJEXT) +libebl_sparc_pic_a_OBJECTS = $(am_libebl_sparc_pic_a_OBJECTS) +libebl_x86_64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_x86_64_pic_a_LIBADD = +am__objects_10 = x86_64_init.$(OBJEXT) x86_64_symbol.$(OBJEXT) \ + x86_64_corenote.$(OBJEXT) x86_64_retval.$(OBJEXT) \ + x86_64_regs.$(OBJEXT) i386_auxv.$(OBJEXT) \ + x86_64_syscall.$(OBJEXT) +libebl_x86_64_pic_a_OBJECTS = $(am_libebl_x86_64_pic_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ + $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) \ + $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ + $(libebl_s390_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) \ + $(libebl_sparc_pic_a_SOURCES) $(libebl_x86_64_pic_a_SOURCES) +DIST_SOURCES = $(libebl_alpha_pic_a_SOURCES) \ + $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ + $(libebl_ia64_pic_a_SOURCES) $(libebl_ppc64_pic_a_SOURCES) \ + $(libebl_ppc_pic_a_SOURCES) $(libebl_s390_pic_a_SOURCES) \ + $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ + $(libebl_x86_64_pic_a_SOURCES) +DATA = $(noinst_DATA) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALEDIR = @LOCALEDIR@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +base_cpu = @base_cpu@ +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@ +eu_version = @eu_version@ +exec_prefix = @exec_prefix@ +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@ +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@ +@MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 -std=gnu99 +INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. + +modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 +libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ + libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ + libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ + libebl_s390_pic.a + +noinst_LIBRARIES = $(libebl_pic) +noinst_DATA = $(libebl_pic:_pic.a=.so) +@MUDFLAP_FALSE@libelf = ../libelf/libelf.so +@MUDFLAP_TRUE@libelf = ../libelf/libelf.a +@MUDFLAP_FALSE@libdw = ../libdw/libdw.so +@MUDFLAP_TRUE@libdw = ../libdw/libdw.a +@MUDFLAP_FALSE@libmudflap = +@MUDFLAP_TRUE@libmudflap = -lmudflap +textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi +i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \ + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c + +cpu_i386 = ../libcpu/libcpu_i386.a +libebl_i386_pic_a_SOURCES = $(i386_SRCS) +am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) +sh_SRCS = sh_init.c sh_symbol.c +libebl_sh_pic_a_SOURCES = $(sh_SRCS) +am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) +x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \ + x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c + +cpu_x86_64 = ../libcpu/libcpu_x86_64.a +libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) +am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) +ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c +libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) +am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) +alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ + alpha_corenote.c alpha_auxv.c + +libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) +am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) +arm_SRCS = arm_init.c arm_symbol.c +libebl_arm_pic_a_SOURCES = $(arm_SRCS) +am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) +sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ + sparc_corenote.c sparc64_corenote.c sparc_auxv.c + +libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) +am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) +ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + +libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) +am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) +ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + +libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) +am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) +s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c +libebl_s390_pic_a_SOURCES = $(s390_SRCS) +am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) +noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c +EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) +CLEANFILES = *.gcno *.gcda \ + $(foreach m,$(modules),\ + libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS)) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits backends/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits backends/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) + -rm -f libebl_alpha_pic.a + $(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) + $(RANLIB) libebl_alpha_pic.a +libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) + -rm -f libebl_arm_pic.a + $(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) + $(RANLIB) libebl_arm_pic.a +libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) + -rm -f libebl_i386_pic.a + $(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) + $(RANLIB) libebl_i386_pic.a +libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) + -rm -f libebl_ia64_pic.a + $(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) + $(RANLIB) libebl_ia64_pic.a +libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) + -rm -f libebl_ppc64_pic.a + $(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) + $(RANLIB) libebl_ppc64_pic.a +libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) + -rm -f libebl_ppc_pic.a + $(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) + $(RANLIB) libebl_ppc_pic.a +libebl_s390_pic.a: $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_DEPENDENCIES) + -rm -f libebl_s390_pic.a + $(libebl_s390_pic_a_AR) libebl_s390_pic.a $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_LIBADD) + $(RANLIB) libebl_s390_pic.a +libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) + -rm -f libebl_sh_pic.a + $(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) + $(RANLIB) libebl_sh_pic.a +libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) + -rm -f libebl_sparc_pic.a + $(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) + $(RANLIB) libebl_sparc_pic.a +libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) + -rm -f libebl_x86_64_pic.a + $(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) + $(RANLIB) libebl_x86_64_pic.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_attrs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc64_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_syscall.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(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 $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(DATA) $(HEADERS) +installdirs: +install-exec: install-exec-am +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +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 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic 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 maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw) \ + $(cpu_$(@:libebl_%.so=%) + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ + -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) + $(textrel_check) + +# XXX Should not be needed... +libebl_i386.so: $(cpu_i386) +libebl_x86_64.so: $(cpu_x86_64) + +libebl_%.map: Makefile + echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@ + +%.os: %.c + if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + +install: install-am install-ebl-modules +install-ebl-modules: + $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + for m in $(modules); do \ + $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + +uninstall: uninstall-am + for m in $(modules); do \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) +# 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/backends/alpha_auxv.c b/backends/alpha_auxv.c new file mode 100644 index 00000000..38a8bcdf --- /dev/null +++ b/backends/alpha_auxv.c @@ -0,0 +1,46 @@ +/* Alpha-specific auxv handling. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND alpha_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "bwx\0" "fix\0" "cix\0" "0x08\0" + "0x10\0" "0x20\0" "0x40\0" "0x80\0" + "max\0" "precise_trap\0" + "\0"; + return 1; +} diff --git a/backends/alpha_corenote.c b/backends/alpha_corenote.c new file mode 100644 index 00000000..dcc62e9e --- /dev/null +++ b/backends/alpha_corenote.c @@ -0,0 +1,67 @@ +/* PowerPC specific core note handling. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#define BACKEND alpha_ +#include "libebl_CPU.h" + +static const Ebl_Register_Location prstatus_regs[] = + { + { .offset = 0, .regno = 0, .count = 31, .bits = 64 }, /* r0-r30 */ + { .offset = 32 * 8, .regno = 64, .count = 1, .bits = 64 }, /* pc */ + { .offset = 33 * 8, .regno = 66, .count = 1, .bits = 64 }, /* unique */ + }; +#define PRSTATUS_REGS_SIZE (33 * 8) + +static const Ebl_Register_Location fpregset_regs[] = + { + { .offset = 0, .regno = 32, .count = 32, .bits = 64 }, /* f0-f30, fpcr */ + }; +#define FPREGSET_SIZE (32 * 8) + +#define ULONG uint64_t +#define ALIGN_ULONG 8 +#define TYPE_ULONG ELF_T_XWORD +#define TYPE_LONG ELF_T_SXWORD +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_WORD +#define TYPE_GID_T ELF_T_WORD + +#include "linux-core-note.c" diff --git a/backends/alpha_init.c b/backends/alpha_init.c new file mode 100644 index 00000000..1ca99abc --- /dev/null +++ b/backends/alpha_init.c @@ -0,0 +1,65 @@ +/* Initialization of Alpha specific backend library. + Copyright (C) 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND alpha_ +#define RELOC_PREFIX R_ALPHA_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on alpha_reloc.def. */ +#include "common-reloc.c" + + +const char * +alpha_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "Alpha"; + alpha_init_reloc (eh); + HOOK (eh, dynamic_tag_name); + HOOK (eh, dynamic_tag_check); + HOOK (eh, reloc_simple_type); + HOOK (eh, return_value_location); + HOOK (eh, machine_section_flag_check); + HOOK (eh, check_special_section); + HOOK (eh, register_info); + HOOK (eh, core_note); + HOOK (eh, auxv_info); + eh->sysvhash_entrysize = sizeof (Elf64_Xword); + + return MODVERSION; +} diff --git a/backends/alpha_regs.c b/backends/alpha_regs.c new file mode 100644 index 00000000..3bb9a6cd --- /dev/null +++ b/backends/alpha_regs.c @@ -0,0 +1,161 @@ +/* Register names and numbers for Alpha DWARF. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND alpha_ +#include "libebl_CPU.h" + +ssize_t +alpha_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 67; + + if (regno < 0 || regno > 66 || namelen < 7) + return -1; + + *prefix = "$"; + + *bits = 64; + *type = DW_ATE_signed; + *setname = "integer"; + if (regno >= 32 && regno < 64) + { + *setname = "FPU"; + *type = DW_ATE_float; + } + + switch (regno) + { + case 0: + name[0] = 'v'; + name[1] = '0'; + namelen = 2; + break; + + case 1 ... 8: + name[0] = 't'; + name[1] = regno - 1 + '0'; + namelen = 2; + break; + + case 9 ... 15: + name[0] = 's'; + name[1] = regno - 9 + '0'; + namelen = 2; + break; + + case 16 ... 21: + name[0] = 'a'; + name[1] = regno - 16 + '0'; + namelen = 2; + break; + + case 22 ... 23: + name[0] = 't'; + name[1] = regno - 22 + '8'; + namelen = 2; + break; + + case 24 ... 25: + name[0] = 't'; + name[1] = '1'; + name[2] = regno - 24 + '0'; + namelen = 3; + break; + + case 26: + *type = DW_ATE_address; + return stpcpy (name, "ra") + 1 - name; + + case 27: + return stpcpy (name, "t12") + 1 - name; + + case 28: + return stpcpy (name, "at") + 1 - name; + + case 29: + *type = DW_ATE_address; + return stpcpy (name, "gp") + 1 - name; + + case 30: + *type = DW_ATE_address; + return stpcpy (name, "sp") + 1 - name; + + case 31: + return stpcpy (name, "zero") + 1 - name; + + case 32 ... 32 + 9: + name[0] = 'f'; + name[1] = regno - 32 + '0'; + namelen = 2; + break; + + case 32 + 10 ... 32 + 19: + name[0] = 'f'; + name[1] = '1'; + name[2] = regno - 32 - 10 + '0'; + namelen = 3; + break; + + case 32 + 20 ... 32 + 29: + name[0] = 'f'; + name[1] = '2'; + name[2] = regno - 32 - 20 + '0'; + namelen = 3; + break; + + case 32 + 30: + return stpcpy (name, "f30") + 1 - name; + + case 32 + 31: + *type = DW_ATE_unsigned; + return stpcpy (name, "fpcr") + 1 - name; + + case 64: + *type = DW_ATE_address; + return stpcpy (name, "pc") + 1 - name; + + case 66: + *type = DW_ATE_address; + return stpcpy (name, "unique") + 1 - name; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/alpha_reloc.def b/backends/alpha_reloc.def new file mode 100644 index 00000000..347a483f --- /dev/null +++ b/backends/alpha_reloc.def @@ -0,0 +1,60 @@ +/* List the relocation types for alpha. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (REFLONG, REL|EXEC|DYN) +RELOC_TYPE (REFQUAD, REL|EXEC|DYN) +RELOC_TYPE (GPREL32, REL) +RELOC_TYPE (LITERAL, REL) +RELOC_TYPE (LITUSE, REL) +RELOC_TYPE (GPDISP, REL) +RELOC_TYPE (BRADDR, REL) +RELOC_TYPE (HINT, REL) +RELOC_TYPE (SREL16, REL) +RELOC_TYPE (SREL32, REL) +RELOC_TYPE (SREL64, REL) +RELOC_TYPE (GPRELHIGH, REL) +RELOC_TYPE (GPRELLOW, REL) +RELOC_TYPE (GPREL16, REL) +RELOC_TYPE (COPY, 0) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (TLS_GD_HI, REL) +RELOC_TYPE (TLSGD, REL) +RELOC_TYPE (TLS_LDM, REL) +RELOC_TYPE (DTPMOD64, REL|EXEC|DYN) +RELOC_TYPE (GOTDTPREL, REL) +RELOC_TYPE (DTPREL64, REL|EXEC|DYN) +RELOC_TYPE (DTPRELHI, REL) +RELOC_TYPE (DTPRELLO, REL) +RELOC_TYPE (DTPREL16, REL) +RELOC_TYPE (GOTTPREL, REL) +RELOC_TYPE (TPREL64, REL|EXEC|DYN) +RELOC_TYPE (TPRELHI, REL) +RELOC_TYPE (TPRELLO, REL) +RELOC_TYPE (TPREL16, REL) diff --git a/backends/alpha_retval.c b/backends/alpha_retval.c new file mode 100644 index 00000000..57ba867b --- /dev/null +++ b/backends/alpha_retval.c @@ -0,0 +1,162 @@ +/* Function return value location for Alpha ELF ABI. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND alpha_ +#include "libebl_CPU.h" + + +/* $0. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 } + }; +#define nloc_intreg 1 + +/* $f0, or pair $f0, $f1. */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_fpreg 1 +#define nloc_fpregpair 4 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in $0. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + +int +alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + { + Dwarf_Word size; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + + *locp = loc_fpreg; + if (encoding == DW_ATE_float) + { + if (size <= 8) + return nloc_fpreg; + goto aggregate; + } + if (encoding == DW_ATE_complex_float) + { + if (size <= 8 * 2) + return nloc_fpregpair; + goto aggregate; + } + } + if (size <= 8) + { + *locp = loc_intreg; + return nloc_intreg; + } + } + + /* Else fall through. */ + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_string_type: + case DW_TAG_array_type: + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/alpha_symbol.c b/backends/alpha_symbol.c new file mode 100644 index 00000000..aa45c61e --- /dev/null +++ b/backends/alpha_symbol.c @@ -0,0 +1,123 @@ +/* Alpha specific symbolic name handling. + Copyright (C) 2002,2005,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND alpha_ +#include "libebl_CPU.h" + + +const char * +alpha_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_ALPHA_PLTRO: + return "ALPHA_PLTRO"; + default: + break; + } + return NULL; +} + +bool +alpha_dynamic_tag_check (int64_t tag) +{ + return tag == DT_ALPHA_PLTRO; +} + +/* Check for the simple reloc types. */ +Elf_Type +alpha_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_ALPHA_REFLONG: + return ELF_T_WORD; + case R_ALPHA_REFQUAD: + return ELF_T_XWORD; + default: + return ELF_T_NUM; + } +} + + +/* Check whether SHF_MASKPROC flags are valid. */ +bool +alpha_machine_section_flag_check (GElf_Xword sh_flags) +{ + return (sh_flags &~ (SHF_ALPHA_GPREL)) == 0; +} + +bool +alpha_check_special_section (Ebl *ebl, + int ndx __attribute__ ((unused)), + const GElf_Shdr *shdr, + const char *sname __attribute__ ((unused))) +{ + if ((shdr->sh_flags + & (SHF_WRITE | SHF_EXECINSTR)) == (SHF_WRITE | SHF_EXECINSTR) + && shdr->sh_addr != 0) + { + /* This is ordinarily flagged, but is valid for an old-style PLT. + + Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it. + Its d_ptr should match the .plt section's sh_addr. */ + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr scn_shdr; + if (likely (gelf_getshdr (scn, &scn_shdr) != NULL) + && scn_shdr.sh_type == SHT_DYNAMIC + && scn_shdr.sh_entsize != 0) + { + GElf_Addr pltgot = 0; + Elf_Data *data = elf_getdata (scn, NULL); + if (data != NULL) + for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i) + { + GElf_Dyn dyn; + if (unlikely (gelf_getdyn (data, i, &dyn) == NULL)) + break; + if (dyn.d_tag == DT_PLTGOT) + pltgot = dyn.d_un.d_ptr; + else if (dyn.d_tag == DT_ALPHA_PLTRO && dyn.d_un.d_val != 0) + return false; /* This PLT should not be writable. */ + } + return pltgot == shdr->sh_addr; + } + } + } + + return false; +} diff --git a/backends/arm_init.c b/backends/arm_init.c new file mode 100644 index 00000000..172af198 --- /dev/null +++ b/backends/arm_init.c @@ -0,0 +1,56 @@ +/* Initialization of Arm specific backend library. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND arm_ +#define RELOC_PREFIX R_ARM_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on arm_reloc.def. */ +#include "common-reloc.c" + + +const char * +arm_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "ARM"; + arm_init_reloc (eh); + HOOK (eh, reloc_simple_type); + + return MODVERSION; +} diff --git a/backends/arm_reloc.def b/backends/arm_reloc.def new file mode 100644 index 00000000..c5a72cc0 --- /dev/null +++ b/backends/arm_reloc.def @@ -0,0 +1,77 @@ +/* List the relocation types for arm. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, REL) /* It really is used in ET_REL on ARM. */ +RELOC_TYPE (PC24, REL) +RELOC_TYPE (ABS32, REL) +RELOC_TYPE (REL32, REL) +RELOC_TYPE (PC13, REL) +RELOC_TYPE (ABS16, REL) +RELOC_TYPE (ABS12, REL) +RELOC_TYPE (THM_ABS5, REL) +RELOC_TYPE (ABS8, REL) +RELOC_TYPE (SBREL32, REL) +RELOC_TYPE (THM_PC22, REL) +RELOC_TYPE (THM_PC8, REL) +RELOC_TYPE (AMP_VCALL9, REL) +RELOC_TYPE (SWI24, REL) +RELOC_TYPE (THM_SWI8, REL) +RELOC_TYPE (XPC25, REL) +RELOC_TYPE (THM_XPC22, REL) +RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JUMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (GOTOFF, REL) +RELOC_TYPE (GOTPC, REL) +RELOC_TYPE (GOT32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (ALU_PCREL_7_0, REL) +RELOC_TYPE (ALU_PCREL_15_8, REL) +RELOC_TYPE (ALU_PCREL_23_15, REL) +RELOC_TYPE (LDR_SBREL_11_0, REL) +RELOC_TYPE (ALU_SBREL_19_12, REL) +RELOC_TYPE (ALU_SBREL_27_20, REL) +RELOC_TYPE (GNU_VTENTRY, REL) +RELOC_TYPE (GNU_VTINHERIT, REL) +RELOC_TYPE (THM_PC11, REL) +RELOC_TYPE (THM_PC9, REL) +RELOC_TYPE (TLS_GD32, REL) +RELOC_TYPE (TLS_LDM32, REL) +RELOC_TYPE (TLS_LDO32, REL) +RELOC_TYPE (TLS_IE32, REL) +RELOC_TYPE (TLS_LE32, REL) +RELOC_TYPE (RXPC25, REL) +RELOC_TYPE (RSBREL32, REL) +RELOC_TYPE (THM_RPC22, REL) +RELOC_TYPE (RREL32, REL) +RELOC_TYPE (RABS22, REL) +RELOC_TYPE (RPC24, REL) +RELOC_TYPE (RBASE, REL) diff --git a/backends/arm_symbol.c b/backends/arm_symbol.c new file mode 100644 index 00000000..6d2f56d3 --- /dev/null +++ b/backends/arm_symbol.c @@ -0,0 +1,52 @@ +/* Arm specific symbolic name handling. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND arm_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_ARM_ABS32: + return ELF_T_WORD; + case R_ARM_ABS16: + return ELF_T_HALF; + case R_ARM_ABS8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} diff --git a/backends/common-reloc.c b/backends/common-reloc.c new file mode 100644 index 00000000..191b22a2 --- /dev/null +++ b/backends/common-reloc.c @@ -0,0 +1,143 @@ +/* Common code for ebl reloc functions. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libebl_CPU.h" +#include <assert.h> + +#define R_TYPE(name) PASTE (RELOC_PREFIX, name) +#define PASTE(a, b) PASTE_1 (a, b) +#define PASTE_1(a, b) a##b +#define R_NAME(name) R_NAME_1 (RELOC_PREFIX, name) +#define R_NAME_1(prefix, type) R_NAME_2 (prefix, type) +#define R_NAME_2(prefix, type) #prefix #type + +#define RELOC_TYPES STRINGIFIED_PASTE (BACKEND, reloc.def) +#define STRINGIFIED_PASTE(a, b) STRINGIFY (PASTE (a, b)) +#define STRINGIFY(x) STRINGIFY_1 (x) +#define STRINGIFY_1(x) #x + +/* Provide a table of reloc type names, in a PIC-friendly fashion. */ + +static const struct EBLHOOK(reloc_nametable) +{ + char zero; +#define RELOC_TYPE(type, uses) \ + char name_##type[sizeof R_NAME (type)]; +#include RELOC_TYPES +#undef RELOC_TYPE +} EBLHOOK(reloc_nametable) = + { + '\0', +#define RELOC_TYPE(type, uses) R_NAME (type), +#include RELOC_TYPES +#undef RELOC_TYPE + }; +#define reloc_namestr (&EBLHOOK(reloc_nametable).zero) + +static const uint_fast16_t EBLHOOK(reloc_nameidx)[] = +{ +#define RELOC_TYPE(type, uses) \ + [R_TYPE (type)] = offsetof (struct EBLHOOK(reloc_nametable), name_##type), +#include RELOC_TYPES +#undef RELOC_TYPE +}; +#define nreloc \ + ((int) (sizeof EBLHOOK(reloc_nameidx) / sizeof EBLHOOK(reloc_nameidx)[0])) + +#define REL (1 << (ET_REL - 1)) +#define EXEC (1 << (ET_EXEC - 1)) +#define DYN (1 << (ET_DYN - 1)) +static const uint8_t EBLHOOK(reloc_valid)[] = +{ +#define RELOC_TYPE(type, uses) [R_TYPE (type)] = uses, +#include RELOC_TYPES +#undef RELOC_TYPE +}; +#undef REL +#undef EXEC +#undef DYN + +const char * +EBLHOOK(reloc_type_name) (int reloc, + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + if (reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0) + return &reloc_namestr[EBLHOOK(reloc_nameidx)[reloc]]; + return NULL; +} + +bool +EBLHOOK(reloc_type_check) (int reloc) +{ + return reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0; +} + +bool +EBLHOOK(reloc_valid_use) (Elf *elf, int reloc) +{ + uint8_t uses = EBLHOOK(reloc_valid)[reloc]; + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); + assert (ehdr != NULL); + uint8_t type = ehdr->e_type; + + return type > ET_NONE && type < ET_CORE && (uses & (1 << (type - 1))); +} + + +bool +EBLHOOK(copy_reloc_p) (int reloc) +{ + return reloc == R_TYPE (COPY); +} + +bool +EBLHOOK(none_reloc_p) (int reloc) +{ + return reloc == R_TYPE (NONE); +} + +#ifndef NO_RELATIVE_RELOC +bool +EBLHOOK(relative_reloc_p) (int reloc) +{ + return reloc == R_TYPE (RELATIVE); +} +#endif + +static void +EBLHOOK(init_reloc) (Ebl *ebl) +{ + ebl->reloc_type_name = EBLHOOK(reloc_type_name); + ebl->reloc_type_check = EBLHOOK(reloc_type_check); + ebl->reloc_valid_use = EBLHOOK(reloc_valid_use); + ebl->copy_reloc_p = EBLHOOK(copy_reloc_p); + ebl->none_reloc_p = EBLHOOK(none_reloc_p); +#ifndef NO_RELATIVE_RELOC + ebl->relative_reloc_p = EBLHOOK(relative_reloc_p); +#endif +} diff --git a/backends/i386_auxv.c b/backends/i386_auxv.c new file mode 100644 index 00000000..5f7b15ef --- /dev/null +++ b/backends/i386_auxv.c @@ -0,0 +1,49 @@ +/* i386 specific auxv handling. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND i386_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "fpu\0" "vme\0" "de\0" "pse\0" "tsc\0" "msr\0" "pae\0" "mce\0" + "cx8\0" "apic\0" "10\0" "sep\0" "mtrr\0" "pge\0" "mca\0" "cmov\0" + "pat\0" "pse36\0" "pn\0" "clflush\0" "20\0" "dts\0" "acpi\0" "mmx\0" + "fxsr\0" "sse\0" "sse2\0" "ss\0" "ht\0" "tm\0" "ia64\0" "pbe\0" "\0"; + return 1; +} + +__typeof (i386_auxv_info) x86_64_auxv_info + __attribute__ ((alias ("i386_auxv_info"))); diff --git a/backends/i386_corenote.c b/backends/i386_corenote.c new file mode 100644 index 00000000..c371c4c3 --- /dev/null +++ b/backends/i386_corenote.c @@ -0,0 +1,134 @@ +/* i386 specific core note handling. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#define BACKEND i386_ +#include "libebl_CPU.h" + + +static const Ebl_Register_Location prstatus_regs[] = + { +#define GR(at, n, dwreg) \ + { .offset = at * 4, .regno = dwreg, .count = n, .bits = 32 } +#define SR(at, n, dwreg) \ + { .offset = at * 4, .regno = dwreg, .count = n, .bits = 16, .pad = 2 } + + GR (0, 1, 3), /* %ebx */ + GR (1, 2, 1), /* %ecx-%edx */ + GR (3, 2, 6), /* %esi-%edi */ + GR (5, 1, 5), /* %ebp */ + GR (6, 1, 0), /* %eax */ + SR (7, 1, 43), /* %ds */ + SR (8, 1, 40), /* %es */ + SR (9, 1, 44), /* %fs */ + SR (10, 1, 45), /* %gs */ + /* 11, 1, orig_eax */ + GR (12, 1, 8), /* %eip */ + SR (13, 1, 41), /* %cs */ + GR (14, 1, 9), /* eflags */ + GR (15, 1, 4), /* %esp */ + SR (16, 1, 42), /* %ss */ + +#undef GR +#undef SR + }; +#define PRSTATUS_REGS_SIZE (17 * 4) + +#define ULONG uint32_t +#define PID_T int32_t +#define UID_T uint16_t +#define GID_T uint16_t +#define ALIGN_ULONG 4 +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 2 +#define ALIGN_GID_T 2 +#define TYPE_ULONG ELF_T_WORD +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_HALF +#define TYPE_GID_T ELF_T_HALF + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "orig_eax", .type = ELF_T_SWORD, .format = 'd', \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (4 * 11), \ + .group = "register" \ + } + +static const Ebl_Register_Location fpregset_regs[] = + { + { .offset = 0, .regno = 37, .count = 2, .bits = 32 }, /* fctrl-fstat */ + { .offset = 7 * 4, .regno = 11, .count = 8, .bits = 80 }, /* stN */ + }; +#define FPREGSET_SIZE 108 + +static const Ebl_Register_Location prxfpreg_regs[] = + { + { .offset = 0, .regno = 37, .count = 2, .bits = 16 }, /* fctrl-fstat */ + { .offset = 24, .regno = 39, .count = 1, .bits = 32 }, /* mxcsr */ + { .offset = 32, .regno = 11, .count = 8, .bits = 80, .pad = 6 }, /* stN */ + { .offset = 32 + 128, .regno = 21, .count = 8, .bits = 128 }, /* xmm */ + }; + +#define EXTRA_NOTES \ + EXTRA_REGSET (NT_PRFPXREG, 512, prxfpreg_regs) \ + case NT_386_TLS: \ + return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); \ + EXTRA_NOTES_IOPERM + +static const Ebl_Core_Item tls_items[] = + { + { .type = ELF_T_WORD, .offset = 0x0, .format = 'd', .name = "index" }, + { .type = ELF_T_WORD, .offset = 0x4, .format = 'x', .name = "base" }, + { .type = ELF_T_WORD, .offset = 0x8, .format = 'x', .name = "limit" }, + { .type = ELF_T_WORD, .offset = 0xc, .format = 'x', .name = "flags" }, + }; + +static int +tls_info (GElf_Word descsz, GElf_Word *regs_offset, + size_t *nregloc, const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **items) +{ + if (descsz % 16 != 0) + return 0; + + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + *nitems = sizeof tls_items / sizeof tls_items[0]; + *items = tls_items; + return 1; +} + +#include "x86_corenote.c" +#include "linux-core-note.c" diff --git a/backends/i386_init.c b/backends/i386_init.c new file mode 100644 index 00000000..f046dfb6 --- /dev/null +++ b/backends/i386_init.c @@ -0,0 +1,64 @@ +/* Initialization of i386 specific backend library. + Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND i386_ +#define RELOC_PREFIX R_386_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on i386_reloc.def. */ +#include "common-reloc.c" + +const char * +i386_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "Intel 80386"; + i386_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, gotpc_reloc_check); + HOOK (eh, core_note); + generic_debugscn_p = eh->debugscn_p; + HOOK (eh, debugscn_p); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, syscall_abi); + HOOK (eh, auxv_info); + HOOK (eh, disasm); + + return MODVERSION; +} diff --git a/backends/i386_regs.c b/backends/i386_regs.c new file mode 100644 index 00000000..5cf0d810 --- /dev/null +++ b/backends/i386_regs.c @@ -0,0 +1,149 @@ +/* Register names and numbers for i386 DWARF. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND i386_ +#include "libebl_CPU.h" + +ssize_t +i386_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 46; + + if (regno < 0 || regno > 45 || namelen < 6) + return -1; + + *prefix = "%"; + *bits = 32; + *type = DW_ATE_unsigned; + if (regno < 11) + { + *setname = "integer"; + if (regno < 9) + *type = DW_ATE_signed; + } + else if (regno < 19) + { + *setname = "x87"; + *type = DW_ATE_float; + *bits = 80; + } + else if (regno < 29) + { + *setname = "SSE"; + *bits = 128; + } + else if (regno < 37) + { + *setname = "MMX"; + *bits = 64; + } + else if (regno < 40) + *setname = "FPU-control"; + else + { + *setname = "segment"; + *bits = 16; + } + + switch (regno) + { + static const char baseregs[][2] = + { + "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip" + }; + + case 4: + case 5: + case 8: + *type = DW_ATE_address; + case 0 ... 3: + case 6 ... 7: + name[0] = 'e'; + name[1] = baseregs[regno][0]; + name[2] = baseregs[regno][1]; + namelen = 3; + break; + + case 9: + return stpcpy (name, "eflags") + 1 - name; + case 10: + return stpcpy (name, "trapno") + 1 - name; + + case 11 ... 18: + name[0] = 's'; + name[1] = 't'; + name[2] = regno - 11 + '0'; + namelen = 3; + break; + + case 21 ... 28: + name[0] = 'x'; + name[1] = 'm'; + name[2] = 'm'; + name[3] = regno - 21 + '0'; + namelen = 4; + break; + + case 29 ... 36: + name[0] = 'm'; + name[1] = 'm'; + name[2] = regno - 29 + '0'; + namelen = 3; + break; + + case 37: + *bits = 16; + return stpcpy (name, "fctrl") + 1 - name; + case 38: + *bits = 16; + return stpcpy (name, "fstat") + 1 - name; + case 39: + return stpcpy (name, "mxcsr") + 1 - name; + + case 40 ... 45: + name[0] = "ecsdfg"[regno - 40]; + name[1] = 's'; + namelen = 2; + break; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/i386_reloc.def b/backends/i386_reloc.def new file mode 100644 index 00000000..bc1b835d --- /dev/null +++ b/backends/i386_reloc.def @@ -0,0 +1,66 @@ +/* List the relocation types for i386. -*- C -*- + Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (32, REL|EXEC|DYN) +RELOC_TYPE (PC32, REL|EXEC|DYN) +RELOC_TYPE (GOT32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (GOTOFF, REL) +RELOC_TYPE (GOTPC, REL) +RELOC_TYPE (32PLT, REL) +RELOC_TYPE (TLS_TPOFF, EXEC|DYN) +RELOC_TYPE (TLS_IE, REL) +RELOC_TYPE (TLS_GOTIE, REL) +RELOC_TYPE (TLS_LE, REL) +RELOC_TYPE (TLS_GD, REL) +RELOC_TYPE (TLS_LDM, REL) +RELOC_TYPE (16, REL) +RELOC_TYPE (PC16, REL) +RELOC_TYPE (8, REL) +RELOC_TYPE (PC8, REL) +RELOC_TYPE (TLS_GD_32, REL) +RELOC_TYPE (TLS_GD_PUSH, REL) +RELOC_TYPE (TLS_GD_CALL, REL) +RELOC_TYPE (TLS_GD_POP, REL) +RELOC_TYPE (TLS_LDM_32, REL) +RELOC_TYPE (TLS_LDM_PUSH, REL) +RELOC_TYPE (TLS_LDM_CALL, REL) +RELOC_TYPE (TLS_LDM_POP, REL) +RELOC_TYPE (TLS_LDO_32, REL) +RELOC_TYPE (TLS_IE_32, REL) +RELOC_TYPE (TLS_LE_32, REL) +RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_GOTDESC, REL) +RELOC_TYPE (TLS_DESC_CALL, REL) +RELOC_TYPE (TLS_DESC, EXEC) diff --git a/backends/i386_retval.c b/backends/i386_retval.c new file mode 100644 index 00000000..c3bab108 --- /dev/null +++ b/backends/i386_retval.c @@ -0,0 +1,153 @@ +/* Function return value location for Linux/i386 ABI. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND i386_ +#include "libebl_CPU.h" + + +/* %eax, or pair %eax, %edx. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_intreg 1 +#define nloc_intregpair 4 + +/* %st(0). */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_reg11 } + }; +#define nloc_fpreg 1 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in %eax. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + +int +i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + { + Dwarf_Word size; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + if (encoding == DW_ATE_float) + { + if (size > 16) + return -2; + *locp = loc_fpreg; + return nloc_fpreg; + } + } + *locp = loc_intreg; + if (size <= 4) + return nloc_intreg; + if (size <= 8) + return nloc_intregpair; + + /* Else fall through. */ + } + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + *locp = loc_aggregate; + return nloc_aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/i386_symbol.c b/backends/i386_symbol.c new file mode 100644 index 00000000..5d6c0efd --- /dev/null +++ b/backends/i386_symbol.c @@ -0,0 +1,72 @@ +/* i386 specific symbolic name handling. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <elf.h> +#include <stddef.h> +#include <string.h> + +#define BACKEND i386_ +#include "libebl_CPU.h" + + +/* Return true if the symbol type is that referencing the GOT. */ +bool +i386_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type) +{ + return type == R_386_GOTPC; +} + +/* Check for the simple reloc types. */ +Elf_Type +i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_386_32: + return ELF_T_SWORD; + case R_386_16: + return ELF_T_HALF; + case R_386_8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} + +/* Check section name for being that of a debug information section. */ +bool (*generic_debugscn_p) (const char *); +bool +i386_debugscn_p (const char *name) +{ + return (generic_debugscn_p (name) + || strcmp (name, ".stab") == 0 + || strcmp (name, ".stabstr") == 0); +} diff --git a/backends/i386_syscall.c b/backends/i386_syscall.c new file mode 100644 index 00000000..4d6e438c --- /dev/null +++ b/backends/i386_syscall.c @@ -0,0 +1,47 @@ +/* Linux/i386 system call ABI in DWARF register numbers. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND i386_ +#include "libebl_CPU.h" + +int +i386_syscall_abi (Ebl *ebl __attribute__ ((unused)), + int *sp, int *pc, int *callno, int args[6]) +{ + *sp = 4; /* %esp */ + *pc = 8; /* %eip */ + *callno = 0; /* %eax */ + args[0] = 3; /* %ebx */ + args[1] = 1; /* %ecx */ + args[2] = 2; /* %edx */ + args[3] = 6; /* %esi */ + args[4] = 7; /* %edi */ + args[5] = 5; /* %ebp */ + return 0; +} diff --git a/backends/ia64_init.c b/backends/ia64_init.c new file mode 100644 index 00000000..290c192c --- /dev/null +++ b/backends/ia64_init.c @@ -0,0 +1,63 @@ +/* Initialization of IA-64 specific backend library. + Copyright (C) 2002, 2003, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ia64_ +#define RELOC_PREFIX R_IA64_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on ia64_reloc.def. */ +#include "common-reloc.c" + +const char * +ia64_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "Intel IA-64"; + ia64_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, segment_type_name); + HOOK (eh, section_type_name); + HOOK (eh, dynamic_tag_name); + HOOK (eh, dynamic_tag_check); + HOOK (eh, machine_flag_check); + HOOK (eh, machine_section_flag_check); + HOOK (eh, register_info); + HOOK (eh, return_value_location); + + return MODVERSION; +} diff --git a/backends/ia64_regs.c b/backends/ia64_regs.c new file mode 100644 index 00000000..0460739c --- /dev/null +++ b/backends/ia64_regs.c @@ -0,0 +1,270 @@ +/* Register names and numbers for IA64 DWARF. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND i386_ +#include "libebl_CPU.h" + +ssize_t +ia64_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 687 + 64; + + if (regno < 0 || regno > 687 + 63 || namelen < 12) + return -1; + + *prefix = "ar."; + *setname = "application"; + *bits = 64; + *type = DW_ATE_signed; + switch (regno) + { + case 0 ... 9: + name[0] = 'r'; + name[1] = (regno - 0) + '0'; + namelen = 2; + *setname = "integer"; + *prefix = ""; + break; + + case 10 ... 99: + name[0] = 'r'; + name[1] = (regno - 0) / 10 + '0'; + name[2] = (regno - 0) % 10 + '0'; + namelen = 3; + *setname = "integer"; + *prefix = ""; + break; + + case 100 ... 127: + name[0] = 'r'; + name[1] = '1'; + name[2] = (regno - 100) / 10 + '0'; + name[3] = (regno - 0) % 10 + '0'; + namelen = 4; + *setname = "integer"; + *prefix = ""; + break; + + case 128 + 0 ... 128 + 9: + name[0] = 'f'; + name[1] = (regno - 128) + '0'; + namelen = 2; + *type = DW_ATE_float; + *bits = 128; + *setname = "FPU"; + *prefix = ""; + break; + + case 128 + 10 ... 128 + 99: + name[0] = 'f'; + name[1] = (regno - 128) / 10 + '0'; + name[2] = (regno - 128) % 10 + '0'; + namelen = 3; + *setname = "FPU"; + *prefix = ""; + break; + + case 128 + 100 ... 128 + 127: + name[0] = 'f'; + name[1] = '1'; + name[2] = (regno - 128 - 100) / 10 + '0'; + name[3] = (regno - 128) % 10 + '0'; + namelen = 4; + *type = DW_ATE_float; + *bits = 128; + *setname = "FPU"; + *prefix = ""; + break; + + case 320 + 0 ... 320 + 7: + name[0] = 'b'; + name[1] = (regno - 320) + '0'; + namelen = 2; + *type = DW_ATE_address; + *setname = "branch"; + *prefix = ""; + break; + + case 328 ... 333: + { + static const char named_special[][5] = + { + "vfp", "vrap", "pr", "ip", "psr", "cfm" + }; + *setname = "special"; + *prefix = ""; + *type = regno == 331 ? DW_ATE_address : DW_ATE_unsigned; + return stpcpy (name, named_special[regno - 328]) + 1 - name; + } + + case 590: + *setname = "special"; + *prefix = ""; + *type = DW_ATE_unsigned; + return stpcpy (name, "bof") + 1 - name; + + case 334 + 0 ... 334 + 7: + name[0] = 'k'; + name[1] = 'r'; + name[2] = (regno - 334) + '0'; + namelen = 3; + *prefix = ""; + break; + + case 334 + 8 ... 334 + 127: + { + static const char named_ar[][9] = + { + [16 - 8] = "rsc", + [17 - 8] = "bsp", + [18 - 8] = "bspstore", + [19 - 8] = "rnat", + [21 - 8] = "fcr", + [24 - 8] = "eflag", + [25 - 8] = "csd", + [26 - 8] = "ssd", + [27 - 8] = "cflg", + [28 - 8] = "fsr", + [29 - 8] = "fir", + [30 - 8] = "fdr", + [32 - 8] = "ccv", + [36 - 8] = "unat", + [40 - 8] = "fpsr", + [44 - 8] = "itc", + [64 - 8] = "pfs", + [65 - 8] = "lc", + [66 - 8] = "ec", + }; + const size_t idx = regno - (334 + 8); + *type = DW_ATE_unsigned; + if (idx == 1 || idx == 2) + *type = DW_ATE_address; + if (idx < sizeof named_ar / sizeof named_ar[0] + && named_ar[idx][0] != '\0') + return stpcpy (name, named_ar[idx]) + 1 - name; + + name[0] = 'a'; + name[1] = 'r'; + switch (regno - 334) + { + case 0 ... 9: + name[2] = (regno - 334) + '0'; + namelen = 3; + break; + case 10 ... 99: + name[2] = (regno - 334) / 10 + '0'; + name[3] = (regno - 334) % 10 + '0'; + namelen = 4; + break; + case 100 ... 127: + name[2] = '1'; + name[3] = (regno - 334 - 100) / 10 + '0'; + name[4] = (regno - 334) % 10 + '0'; + namelen = 5; + break; + } + *prefix = ""; + break; + } + + case 462 + 0 ... 462 + 9: + name[0] = 'n'; + name[1] = 'a'; + name[2] = 't'; + name[3] = (regno - 462) + '0'; + namelen = 4; + *setname = "NAT"; + *type = DW_ATE_boolean; + *bits = 1; + *prefix = ""; + break; + + case 462 + 10 ... 462 + 99: + name[0] = 'n'; + name[1] = 'a'; + name[2] = 't'; + name[3] = (regno - 462) / 10 + '0'; + name[4] = (regno - 462) % 10 + '0'; + namelen = 5; + *setname = "NAT"; + *type = DW_ATE_boolean; + *bits = 1; + *prefix = ""; + break; + + case 462 + 100 ... 462 + 127: + name[0] = 'n'; + name[1] = 'a'; + name[2] = 't'; + name[3] = '1'; + name[4] = (regno - 462 - 100) / 10 + '0'; + name[5] = (regno - 462) % 10 + '0'; + namelen = 6; + *setname = "NAT"; + *type = DW_ATE_boolean; + *bits = 1; + *prefix = ""; + break; + + case 687 + 0 ... 687 + 9: + name[0] = 'p'; + name[1] = (regno - 687) + '0'; + namelen = 2; + *setname = "predicate"; + *type = DW_ATE_boolean; + *bits = 1; + *prefix = ""; + break; + + case 687 + 10 ... 687 + 63: + name[0] = 'p'; + name[1] = (regno - 687) / 10 + '0'; + name[2] = (regno - 687) % 10 + '0'; + namelen = 3; + *setname = "predicate"; + *type = DW_ATE_boolean; + *bits = 1; + *prefix = ""; + break; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/ia64_reloc.def b/backends/ia64_reloc.def new file mode 100644 index 00000000..a4234656 --- /dev/null +++ b/backends/ia64_reloc.def @@ -0,0 +1,110 @@ +/* List the relocation types for ia64. -*- C -*- + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (IMM14, REL) +RELOC_TYPE (IMM22, REL) +RELOC_TYPE (IMM64, REL) +RELOC_TYPE (DIR32MSB, REL|EXEC|DYN) +RELOC_TYPE (DIR32LSB, REL|EXEC|DYN) +RELOC_TYPE (DIR64MSB, REL|EXEC|DYN) +RELOC_TYPE (DIR64LSB, REL|EXEC|DYN) +RELOC_TYPE (GPREL22, REL) +RELOC_TYPE (GPREL64I, REL) +RELOC_TYPE (GPREL32MSB, REL) +RELOC_TYPE (GPREL32LSB, REL) +RELOC_TYPE (GPREL64MSB, REL) +RELOC_TYPE (GPREL64LSB, REL) +RELOC_TYPE (LTOFF22, REL) +RELOC_TYPE (LTOFF64I, REL) +RELOC_TYPE (PLTOFF22, REL) +RELOC_TYPE (PLTOFF64I, REL) +RELOC_TYPE (PLTOFF64MSB, REL) +RELOC_TYPE (PLTOFF64LSB, REL) +RELOC_TYPE (FPTR64I, REL) +RELOC_TYPE (FPTR32MSB, REL|EXEC|DYN) +RELOC_TYPE (FPTR32LSB, REL|EXEC|DYN) +RELOC_TYPE (FPTR64MSB, REL|EXEC|DYN) +RELOC_TYPE (FPTR64LSB, REL|EXEC|DYN) +RELOC_TYPE (PCREL60B, REL) +RELOC_TYPE (PCREL21B, REL) +RELOC_TYPE (PCREL21M, REL) +RELOC_TYPE (PCREL21F, REL) +RELOC_TYPE (PCREL32MSB, REL|EXEC|DYN) +RELOC_TYPE (PCREL32LSB, REL|EXEC|DYN) +RELOC_TYPE (PCREL64MSB, REL|EXEC|DYN) +RELOC_TYPE (PCREL64LSB, REL|EXEC|DYN) +RELOC_TYPE (LTOFF_FPTR22, REL) +RELOC_TYPE (LTOFF_FPTR64I, REL) +RELOC_TYPE (LTOFF_FPTR32MSB, REL) +RELOC_TYPE (LTOFF_FPTR32LSB, REL) +RELOC_TYPE (LTOFF_FPTR64MSB, REL) +RELOC_TYPE (LTOFF_FPTR64LSB, REL) +RELOC_TYPE (SEGREL32MSB, REL) +RELOC_TYPE (SEGREL32LSB, REL) +RELOC_TYPE (SEGREL64MSB, REL) +RELOC_TYPE (SEGREL64LSB, REL) +RELOC_TYPE (SECREL32MSB, REL) +RELOC_TYPE (SECREL32LSB, REL) +RELOC_TYPE (SECREL64MSB, REL) +RELOC_TYPE (SECREL64LSB, REL) +RELOC_TYPE (REL32MSB, EXEC|DYN) +RELOC_TYPE (REL32LSB, EXEC|DYN) +RELOC_TYPE (REL64MSB, EXEC|DYN) +RELOC_TYPE (REL64LSB, EXEC|DYN) +RELOC_TYPE (LTV32MSB, REL) +RELOC_TYPE (LTV32LSB, REL) +RELOC_TYPE (LTV64MSB, REL) +RELOC_TYPE (LTV64LSB, REL) +RELOC_TYPE (PCREL21BI, REL) +RELOC_TYPE (PCREL22, REL) +RELOC_TYPE (PCREL64I, REL) +RELOC_TYPE (IPLTMSB, REL|EXEC|DYN) +RELOC_TYPE (IPLTLSB, REL|EXEC|DYN) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (SUB, 0) +RELOC_TYPE (LTOFF22X, REL) +RELOC_TYPE (LDXMOV, REL) +RELOC_TYPE (TPREL14, REL) +RELOC_TYPE (TPREL22, REL) +RELOC_TYPE (TPREL64I, REL) +RELOC_TYPE (TPREL64MSB, REL|EXEC|DYN) +RELOC_TYPE (TPREL64LSB, REL|EXEC|DYN) +RELOC_TYPE (LTOFF_TPREL22, REL) +RELOC_TYPE (DTPMOD64MSB, REL|EXEC|DYN) +RELOC_TYPE (DTPMOD64LSB, REL|EXEC|DYN) +RELOC_TYPE (LTOFF_DTPMOD22, REL) +RELOC_TYPE (DTPREL14, REL) +RELOC_TYPE (DTPREL22, REL) +RELOC_TYPE (DTPREL64I, REL) +RELOC_TYPE (DTPREL32MSB, REL|EXEC|DYN) +RELOC_TYPE (DTPREL32LSB, REL|EXEC|DYN) +RELOC_TYPE (DTPREL64MSB, REL|EXEC|DYN) +RELOC_TYPE (DTPREL64LSB, REL|EXEC|DYN) +RELOC_TYPE (LTOFF_DTPREL22, REL) + +#define NO_RELATIVE_RELOC 1 diff --git a/backends/ia64_retval.c b/backends/ia64_retval.c new file mode 100644 index 00000000..238cd9ef --- /dev/null +++ b/backends/ia64_retval.c @@ -0,0 +1,371 @@ +/* Function return value location for IA64 ABI. + Copyright (C) 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND ia64_ +#include "libebl_CPU.h" + + +/* r8, or pair r8, r9, or aggregate up to r8-r11. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg8 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_reg9 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_reg10 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_reg11 }, { .atom = DW_OP_piece, .number = 8 }, + }; +#define nloc_intreg 1 +#define nloc_intregs(n) (2 * (n)) + +/* f8, or aggregate up to f8-f15. */ +#define DEFINE_FPREG(size) \ + static const Dwarf_Op loc_fpreg_##size[] = \ + { \ + { .atom = DW_OP_regx, .number = 128 + 8 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 9 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 10 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 11 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 12 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 13 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 14 }, \ + { .atom = DW_OP_piece, .number = size }, \ + { .atom = DW_OP_regx, .number = 128 + 15 }, \ + { .atom = DW_OP_piece, .number = size }, \ + } +#define nloc_fpreg 1 +#define nloc_fpregs(n) (2 * (n)) + +DEFINE_FPREG (4); +DEFINE_FPREG (8); +DEFINE_FPREG (10); + +#undef DEFINE_FPREG + + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in r8. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg8, .number = 0 } + }; +#define nloc_aggregate 1 + + +/* If this type is an HFA small enough to be returned in FP registers, + return the number of registers to use. Otherwise 9, or -1 for errors. */ +static int +hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) +{ + /* Descend the type structure, counting elements and finding their types. + If we find a datum that's not an FP type (and not quad FP), punt. + If we find a datum that's not the same FP type as the first datum, punt. + If we count more than eight total homogeneous FP data, punt. */ + + inline int hfa (const Dwarf_Op *loc, int nregs) + { + if (fpregs_used == 0) + *locp = loc; + else if (*locp != loc) + return 9; + return fpregs_used + nregs; + } + + int tag = dwarf_tag (typedie); + switch (tag) + { + Dwarf_Attribute attr_mem; + + case -1: + return -1; + + case DW_TAG_base_type:; + int size = dwarf_bytesize (typedie); + if (size < 0) + return -1; + + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), &encoding) != 0) + return -1; + + switch (encoding) + { + case DW_ATE_float: + switch (size) + { + case 4: /* float */ + return hfa (loc_fpreg_4, 1); + case 8: /* double */ + return hfa (loc_fpreg_8, 1); + case 10: /* x86-style long double, not really used */ + return hfa (loc_fpreg_10, 1); + } + break; + + case DW_ATE_complex_float: + switch (size) + { + case 4 * 2: /* complex float */ + return hfa (loc_fpreg_4, 2); + case 8 * 2: /* complex double */ + return hfa (loc_fpreg_8, 2); + case 10 * 2: /* complex long double (x86-style) */ + return hfa (loc_fpreg_10, 2); + } + break; + } + break; + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type:; + Dwarf_Die child_mem; + switch (dwarf_child (typedie, &child_mem)) + { + default: + return -1; + + case 1: /* No children: empty struct. */ + break; + + case 0:; /* Look at each element. */ + int max_used = fpregs_used; + do + switch (dwarf_tag (&child_mem)) + { + case -1: + return -1; + + case DW_TAG_member:; + Dwarf_Die child_type_mem; + Dwarf_Die *child_typedie + = dwarf_formref_die (dwarf_attr_integrate (&child_mem, + DW_AT_type, + &attr_mem), + &child_type_mem); + if (tag == DW_TAG_union_type) + { + int used = hfa_type (child_typedie, locp, fpregs_used); + if (used < 0 || used > 8) + return used; + if (used > max_used) + max_used = used; + } + else + { + fpregs_used = hfa_type (child_typedie, locp, fpregs_used); + if (fpregs_used < 0 || fpregs_used > 8) + return fpregs_used; + } + } + while (dwarf_siblingof (&child_mem, &child_mem) == 0); + if (tag == DW_TAG_union_type) + fpregs_used = max_used; + break; + } + break; + + case DW_TAG_array_type:; + size = dwarf_bytesize (typedie); + if (size < 0) + return 9; + if (size == 0) + break; + + Dwarf_Die base_type_mem; + Dwarf_Die *base_typedie + = dwarf_formref_die (dwarf_attr_integrate (typedie, DW_AT_type, + &attr_mem), + &base_type_mem); + + int used = hfa_type (base_typedie, locp, 0); + if (used < 0 || used > 8) + return used; + if (size % (*locp)[1].number != 0) + return 0; + size /= (*locp)[1].number; + fpregs_used += used * size; + break; + + default: + return 9; + } + + return fpregs_used; +} + +int +ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + + switch (encoding) + { + case DW_ATE_float: + switch (size) + { + case 4: /* float */ + *locp = loc_fpreg_4; + return nloc_fpreg; + case 8: /* double */ + *locp = loc_fpreg_8; + return nloc_fpreg; + case 10: /* x86-style long double, not really used */ + *locp = loc_fpreg_10; + return nloc_fpreg; + case 16: /* long double, IEEE quad format */ + *locp = loc_intreg; + return nloc_intregs (2); + } + return -2; + + case DW_ATE_complex_float: + switch (size) + { + case 4 * 2: /* complex float */ + *locp = loc_fpreg_4; + return nloc_fpregs (2); + case 8 * 2: /* complex double */ + *locp = loc_fpreg_8; + return nloc_fpregs (2); + case 10 * 2: /* complex long double (x86-style) */ + *locp = loc_fpreg_10; + return nloc_fpregs (2); + case 16 * 2: /* complex long double (IEEE quad) */ + *locp = loc_intreg; + return nloc_intregs (4); + } + return -2; + } + } + + intreg: + *locp = loc_intreg; + if (size <= 8) + return nloc_intreg; + if (size <= 32) + return nloc_intregs ((size + 7) / 8); + + large: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + return -1; + + /* If this qualifies as an homogeneous floating-point aggregate + (HFA), then it should be returned in FP regs. */ + int nfpreg = hfa_type (typedie, locp, 0); + if (nfpreg < 0) + return nfpreg; + else if (nfpreg > 0 && nfpreg <= 8) + return nfpreg == 1 ? nloc_fpreg : nloc_fpregs (nfpreg); + + if (size > 32) + goto large; + + goto intreg; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/ia64_symbol.c b/backends/ia64_symbol.c new file mode 100644 index 00000000..2609db0f --- /dev/null +++ b/backends/ia64_symbol.c @@ -0,0 +1,147 @@ +/* IA-64 specific symbolic name handling. + Copyright (C) 2002, 2003, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> +#include <assert.h> + +#define BACKEND ia64_ +#include "libebl_CPU.h" + + +const char * +ia64_segment_type_name (int segment, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (segment) + { + case PT_IA_64_ARCHEXT: + return "IA_64_ARCHEXT"; + case PT_IA_64_UNWIND: + return "IA_64_UNWIND"; + case PT_IA_64_HP_OPT_ANOT: + return "IA_64_HP_OPT_ANOT"; + case PT_IA_64_HP_HSL_ANOT: + return "IA_64_HP_HSL_ANOT"; + case PT_IA_64_HP_STACK: + return "IA_64_HP_STACK"; + default: + break; + } + return NULL; +} + +const char * +ia64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_IA_64_PLT_RESERVE: + return "IA_64_PLT_RESERVE"; + default: + break; + } + return NULL; +} + +/* Check dynamic tag. */ +bool +ia64_dynamic_tag_check (int64_t tag) +{ + return tag == DT_IA_64_PLT_RESERVE; +} + +/* Check whether machine flags are valid. */ +bool +ia64_machine_flag_check (GElf_Word flags) +{ + return ((flags &~ EF_IA_64_ABI64) == 0); +} + +/* Check whether SHF_MASKPROC flags are valid. */ +bool +ia64_machine_section_flag_check (GElf_Xword sh_flags) +{ + return (sh_flags &~ (SHF_IA_64_SHORT | SHF_IA_64_NORECOV)) == 0; +} + +/* Return symbolic representation of section type. */ +const char * +ia64_section_type_name (int type, + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (type) + { + case SHT_IA_64_EXT: + return "SHT_IA_64_EXT"; + case SHT_IA_64_UNWIND: + return "SHT_IA_64_UNWIND"; + } + + return NULL; +} + +/* Check for the simple reloc types. */ +Elf_Type +ia64_reloc_simple_type (Ebl *ebl, int type) +{ + switch (type) + { + /* The SECREL types when used with non-allocated sections + like .debug_* are the same as direct absolute relocs + applied to those sections, since a 0 section address is assumed. + So we treat them the same here. */ + + case R_IA64_SECREL32MSB: + case R_IA64_DIR32MSB: + if (ebl->data == ELFDATA2MSB) + return ELF_T_WORD; + break; + case R_IA64_SECREL32LSB: + case R_IA64_DIR32LSB: + if (ebl->data == ELFDATA2LSB) + return ELF_T_WORD; + break; + case R_IA64_DIR64MSB: + case R_IA64_SECREL64MSB: + if (ebl->data == ELFDATA2MSB) + return ELF_T_XWORD; + break; + case R_IA64_SECREL64LSB: + case R_IA64_DIR64LSB: + if (ebl->data == ELFDATA2LSB) + return ELF_T_XWORD; + break; + } + + return ELF_T_NUM; +} diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h new file mode 100644 index 00000000..b00e7231 --- /dev/null +++ b/backends/libebl_CPU.h @@ -0,0 +1,46 @@ +/* Common interface for libebl modules. + Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _LIBEBL_CPU_H +#define _LIBEBL_CPU_H 1 + +#include <libeblP.h> + +#define EBLHOOK(name) EBLHOOK_1(BACKEND, name) +#define EBLHOOK_1(a, b) EBLHOOK_2(a, b) +#define EBLHOOK_2(a, b) a##b + +/* Constructor. */ +extern const char *EBLHOOK(init) (Elf *elf, GElf_Half machine, + Ebl *eh, size_t ehlen); + +#include "ebl-hooks.h" + +#define HOOK(eh, name) eh->name = EBLHOOK(name) + +extern bool (*generic_debugscn_p) (const char *) attribute_hidden; + + +#endif /* libebl_CPU.h */ diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c new file mode 100644 index 00000000..7b1fc025 --- /dev/null +++ b/backends/linux-core-note.c @@ -0,0 +1,222 @@ +/* Common core note type descriptions for Linux. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* The including CPU_corenote.c file provides prstatus_regs and + defines macros ULONG, [PUG]ID_T, and ALIGN_*, TYPE_*. + + Here we describe the common layout used in <linux/elfcore.h>. */ + +#define CHAR int8_t +#define ALIGN_CHAR 1 +#define TYPE_CHAR ELF_T_BYTE +#define SHORT uint16_t +#define ALIGN_SHORT 2 +#define TYPE_SHORT ELF_T_HALF +#define INT int32_t +#define ALIGN_INT 4 +#define TYPE_INT ELF_T_SWORD + +#define FIELD(type, name) type name __attribute__ ((aligned (ALIGN_##type))) + +struct EBLHOOK(siginfo) +{ + FIELD (INT, si_signo); + FIELD (INT, si_code); + FIELD (INT, si_errno); +}; + +struct EBLHOOK(timeval) +{ + FIELD (ULONG, tv_sec); + FIELD (ULONG, tv_usec); +}; + +/* On sparc64, tv_usec (suseconds_t) is actually 32 bits with 32 bits padding. + The 'T'|0x80 value for .format indicates this as a special kludge. */ +#if SUSECONDS_HALF +# define TIMEVAL_FIELD(name) FIELD (time, ULONG, name, 'T'|0x80, .count = 2) +#else +# define TIMEVAL_FIELD(name) FIELD (time, ULONG, name, 'T', .count = 2) +#endif + + +struct EBLHOOK(prstatus) +{ + struct EBLHOOK(siginfo) pr_info; + FIELD (SHORT, pr_cursig); + FIELD (ULONG, pr_sigpend); + FIELD (ULONG, pr_sighold); + FIELD (PID_T, pr_pid); + FIELD (PID_T, pr_ppid); + FIELD (PID_T, pr_pgrp); + FIELD (PID_T, pr_sid); + struct EBLHOOK(timeval) pr_utime; + struct EBLHOOK(timeval) pr_stime; + struct EBLHOOK(timeval) pr_cutime; + struct EBLHOOK(timeval) pr_cstime; + FIELD (ULONG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (ULONG)]); + FIELD (INT, pr_fpvalid); +}; + +#define FNAMESZ 16 +#define PRARGSZ 80 + +struct EBLHOOK(prpsinfo) +{ + FIELD (CHAR, pr_state); + FIELD (CHAR, pr_sname); + FIELD (CHAR, pr_zomb); + FIELD (CHAR, pr_nice); + FIELD (ULONG, pr_flag); + FIELD (UID_T, pr_uid); + FIELD (GID_T, pr_gid); + FIELD (PID_T, pr_pid); + FIELD (PID_T, pr_ppid); + FIELD (PID_T, pr_pgrp); + FIELD (PID_T, pr_sid); + FIELD (CHAR, pr_fname[FNAMESZ]); + FIELD (CHAR, pr_psargs[PRARGSZ]); +}; + +#undef FIELD + +#define FIELD(igroup, itype, item, fmt, ...) \ + { \ + .name = #item, \ + .group = #igroup, \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_##item), \ + .type = TYPE_##itype, \ + .format = fmt, \ + __VA_ARGS__ \ + } + +static const Ebl_Core_Item prstatus_items[] = + { + FIELD (signal, INT, info.si_signo, 'd'), + FIELD (signal, INT, info.si_code, 'd'), + FIELD (signal, INT, info.si_errno, 'd'), + FIELD (signal, SHORT, cursig, 'd'), + FIELD (signal, ULONG, sigpend, 'B'), + FIELD (signal, ULONG, sighold, 'B'), + FIELD (identity, PID_T, pid, 'd', .thread_identifier = true), + FIELD (identity, PID_T, ppid, 'd'), + FIELD (identity, PID_T, pgrp, 'd'), + FIELD (identity, PID_T, sid, 'd'), + TIMEVAL_FIELD (utime), + TIMEVAL_FIELD (stime), + TIMEVAL_FIELD (cutime), + TIMEVAL_FIELD (cstime), +#ifdef PRSTATUS_REGSET_ITEMS + PRSTATUS_REGSET_ITEMS, +#endif + FIELD (register, INT, fpvalid, 'd'), + }; + +#undef FIELD + +#define FIELD(igroup, itype, item, fmt, ...) \ + { \ + .name = #item, \ + .group = #igroup, \ + .offset = offsetof (struct EBLHOOK(prpsinfo), pr_##item), \ + .type = TYPE_##itype, \ + .format = fmt, \ + __VA_ARGS__ \ + } + +static const Ebl_Core_Item prpsinfo_items[] = + { + FIELD (state, CHAR, state, 'd'), + FIELD (state, CHAR, sname, 'c'), + FIELD (state, CHAR, zomb, 'd'), + FIELD (state, CHAR, nice, 'd'), + FIELD (state, ULONG, flag, 'x'), + FIELD (identity, UID_T, uid, 'd'), + FIELD (identity, GID_T, gid, 'd'), + FIELD (identity, PID_T, pid, 'd'), + FIELD (identity, PID_T, ppid, 'd'), + FIELD (identity, PID_T, pgrp, 'd'), + FIELD (identity, PID_T, sid, 'd'), + FIELD (command, CHAR, fname, 's', .count = FNAMESZ), + FIELD (command, CHAR, psargs, 's', .count = PRARGSZ), + }; + +#undef FIELD + +int +EBLHOOK(core_note) (n_type, descsz, + regs_offset, nregloc, reglocs, nitems, items) + GElf_Word n_type; + GElf_Word descsz; + GElf_Word *regs_offset; + size_t *nregloc; + const Ebl_Register_Location **reglocs; + size_t *nitems; + const Ebl_Core_Item **items; +{ + switch (n_type) + { + case NT_PRSTATUS: + if (descsz != sizeof (struct EBLHOOK(prstatus))) + return 0; + *regs_offset = offsetof (struct EBLHOOK(prstatus), pr_reg); + *nregloc = sizeof prstatus_regs / sizeof prstatus_regs[0]; + *reglocs = prstatus_regs; + *nitems = sizeof prstatus_items / sizeof prstatus_items[0]; + *items = prstatus_items; + return 1; + + case NT_PRPSINFO: + if (descsz != sizeof (struct EBLHOOK(prpsinfo))) + return 0; + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + *nitems = sizeof prpsinfo_items / sizeof prpsinfo_items[0]; + *items = prpsinfo_items; + return 1; + +#define EXTRA_REGSET(type, size, table) \ + case type: \ + if (descsz != size) \ + return 0; \ + *regs_offset = 0; \ + *nregloc = sizeof table / sizeof table[0]; \ + *reglocs = table; \ + *nitems = 0; \ + *items = NULL; \ + return 1; + +#ifdef FPREGSET_SIZE + EXTRA_REGSET (NT_FPREGSET, FPREGSET_SIZE, fpregset_regs) +#endif + +#ifdef EXTRA_NOTES + EXTRA_NOTES +#endif + } + + return 0; +} diff --git a/backends/ppc64_corenote.c b/backends/ppc64_corenote.c new file mode 100644 index 00000000..9d6a6a44 --- /dev/null +++ b/backends/ppc64_corenote.c @@ -0,0 +1,2 @@ +#define BITS 64 +#include "ppc_corenote.c" diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c new file mode 100644 index 00000000..3060a605 --- /dev/null +++ b/backends/ppc64_init.c @@ -0,0 +1,66 @@ +/* Initialization of PPC64 specific backend library. + Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ppc64_ +#define RELOC_PREFIX R_PPC64_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on ppc64_reloc.def. */ +#include "common-reloc.c" + + +const char * +ppc64_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "PowerPC 64-bit"; + ppc64_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, dynamic_tag_name); + HOOK (eh, dynamic_tag_check); + HOOK (eh, copy_reloc_p); + HOOK (eh, check_special_symbol); + HOOK (eh, bss_plt_p); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, syscall_abi); + HOOK (eh, core_note); + HOOK (eh, auxv_info); + + return MODVERSION; +} diff --git a/backends/ppc64_reloc.def b/backends/ppc64_reloc.def new file mode 100644 index 00000000..e51512be --- /dev/null +++ b/backends/ppc64_reloc.def @@ -0,0 +1,143 @@ +/* List the relocation types for ppc64. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (ADDR32, REL|EXEC|DYN) +RELOC_TYPE (ADDR24, REL) +RELOC_TYPE (ADDR16, REL) /* note 1 */ +RELOC_TYPE (ADDR16_LO, REL) /* note 1 */ +RELOC_TYPE (ADDR16_HI, REL) /* note 1 */ +RELOC_TYPE (ADDR16_HA, REL) /* note 1 */ +RELOC_TYPE (ADDR14, REL) /* note 1 */ +RELOC_TYPE (ADDR14_BRTAKEN, REL) /* note 1 */ +RELOC_TYPE (ADDR14_BRNTAKEN, REL) /* note 1 */ +RELOC_TYPE (REL24, REL) +RELOC_TYPE (REL14, REL) +RELOC_TYPE (REL14_BRTAKEN, REL) +RELOC_TYPE (REL14_BRNTAKEN, REL) +RELOC_TYPE (GOT16, REL) +RELOC_TYPE (GOT16_LO, REL) +RELOC_TYPE (GOT16_HI, REL) +RELOC_TYPE (GOT16_HA, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (UADDR32, REL|EXEC|DYN) +RELOC_TYPE (UADDR16, REL) +RELOC_TYPE (REL32, REL|EXEC|DYN) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (PLTREL32, REL) +RELOC_TYPE (PLT16_LO, REL) +RELOC_TYPE (PLT16_HI, REL) +RELOC_TYPE (PLT16_HA, REL) +RELOC_TYPE (SECTOFF, REL) +RELOC_TYPE (SECTOFF_LO, REL) +RELOC_TYPE (SECTOFF_HI, REL) +RELOC_TYPE (SECTOFF_HA, REL) +RELOC_TYPE (ADDR30, REL) /* note 1 */ +RELOC_TYPE (ADDR64, REL|EXEC|DYN) +RELOC_TYPE (ADDR16_HIGHER, REL) /* note 1 */ +RELOC_TYPE (ADDR16_HIGHERA, REL) /* note 1 */ +RELOC_TYPE (ADDR16_HIGHEST, REL) /* note 1 */ +RELOC_TYPE (ADDR16_HIGHESTA, REL) /* note 1 */ +RELOC_TYPE (UADDR64, REL|EXEC|DYN) +RELOC_TYPE (REL64, REL|EXEC|DYN) +RELOC_TYPE (PLT64, REL) +RELOC_TYPE (PLTREL64, REL) +RELOC_TYPE (TOC16, REL) +RELOC_TYPE (TOC16_LO, REL) +RELOC_TYPE (TOC16_HI, REL) +RELOC_TYPE (TOC16_HA, REL) +RELOC_TYPE (TOC, REL) +RELOC_TYPE (PLTGOT16, REL) +RELOC_TYPE (PLTGOT16_LO, REL) +RELOC_TYPE (PLTGOT16_HI, REL) +RELOC_TYPE (PLTGOT16_HA, REL) +RELOC_TYPE (ADDR16_DS, REL) /* note 1 */ +RELOC_TYPE (ADDR16_LO_DS, REL) /* note 1 */ +RELOC_TYPE (GOT16_DS, REL) +RELOC_TYPE (GOT16_LO_DS, REL) +RELOC_TYPE (PLT16_LO_DS, REL) +RELOC_TYPE (SECTOFF_DS, REL) +RELOC_TYPE (SECTOFF_LO_DS, REL) +RELOC_TYPE (TOC16_DS, REL) +RELOC_TYPE (TOC16_LO_DS, REL) +RELOC_TYPE (PLTGOT16_DS, REL) +RELOC_TYPE (PLTGOT16_LO_DS, REL) +RELOC_TYPE (TLS, REL) +RELOC_TYPE (DTPMOD64, REL|EXEC|DYN) /* note 3 */ +RELOC_TYPE (TPREL16, REL) /* note 2 */ +RELOC_TYPE (TPREL16_LO, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HI, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HA, REL) /* note 2 */ +RELOC_TYPE (TPREL64, REL|EXEC|DYN) /* note 3 */ +RELOC_TYPE (DTPREL16, REL) +RELOC_TYPE (DTPREL16_LO, REL) +RELOC_TYPE (DTPREL16_HI, REL) +RELOC_TYPE (DTPREL16_HA, REL) +RELOC_TYPE (DTPREL64, REL|EXEC|DYN) /* note 3 */ +RELOC_TYPE (GOT_TLSGD16, REL) +RELOC_TYPE (GOT_TLSGD16_LO, REL) +RELOC_TYPE (GOT_TLSGD16_HI, REL) +RELOC_TYPE (GOT_TLSGD16_HA, REL) +RELOC_TYPE (GOT_TLSLD16, REL) +RELOC_TYPE (GOT_TLSLD16_LO, REL) +RELOC_TYPE (GOT_TLSLD16_HI, REL) +RELOC_TYPE (GOT_TLSLD16_HA, REL) +RELOC_TYPE (GOT_TPREL16_DS, REL) +RELOC_TYPE (GOT_TPREL16_LO_DS, REL) +RELOC_TYPE (GOT_TPREL16_HI, REL) +RELOC_TYPE (GOT_TPREL16_HA, REL) +RELOC_TYPE (GOT_DTPREL16_DS, REL) +RELOC_TYPE (GOT_DTPREL16_LO_DS, REL) +RELOC_TYPE (GOT_DTPREL16_HI, REL) +RELOC_TYPE (GOT_DTPREL16_HA, REL) +RELOC_TYPE (TPREL16_DS, REL) /* note 2 */ +RELOC_TYPE (TPREL16_LO_DS, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HIGHER, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HIGHERA, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HIGHEST, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HIGHESTA, REL) /* note 2 */ +RELOC_TYPE (DTPREL16_DS, REL) +RELOC_TYPE (DTPREL16_LO_DS, REL) +RELOC_TYPE (DTPREL16_HIGHER, REL) +RELOC_TYPE (DTPREL16_HIGHERA, REL) +RELOC_TYPE (DTPREL16_HIGHEST, REL) +RELOC_TYPE (DTPREL16_HIGHESTA, REL) + +/* Notes from Alan Modra: + + 1) These can appear in DYN and EXEC with improper assembly, but they + aren't really kosher. + + 2) These can appear in DYN with improper assembly (or silly gcc + attributes, I think). Again, not kosher. + + 3) These are legal in REL for PowerOpen compatible assembler syntax, + ie. TOC managed by compiler. +*/ diff --git a/backends/ppc64_retval.c b/backends/ppc64_retval.c new file mode 100644 index 00000000..454897cc --- /dev/null +++ b/backends/ppc64_retval.c @@ -0,0 +1,184 @@ +/* Function return value location for Linux/PPC64 ABI. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND ppc64_ +#include "libebl_CPU.h" + + +/* r3. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg3 } + }; +#define nloc_intreg 1 + +/* f1, or f1:f2, or f1:f4. */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_regx, .number = 36 }, { .atom = DW_OP_piece, .number = 8 }, + }; +#define nloc_fpreg 1 +#define nloc_fp2regs 4 +#define nloc_fp4regs 8 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in r3. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg3, .number = 0 } + }; +#define nloc_aggregate 1 + +int +ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + + if (encoding == DW_ATE_float || encoding == DW_ATE_complex_float) + { + *locp = loc_fpreg; + if (size <= 8) + return nloc_fpreg; + if (size <= 16) + return nloc_fp2regs; + if (size <= 32) + return nloc_fp4regs; + } + } + if (size <= 8) + { + intreg: + *locp = loc_intreg; + return nloc_intreg; + } + + /* Else fall through. */ + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_string_type: + case DW_TAG_array_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) == 0 + && size <= 8) + { + if (tag == DW_TAG_array_type) + { + /* Check if it's a character array. */ + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + if (tag != DW_TAG_base_type) + goto aggregate; + if (dwarf_formudata (dwarf_attr_integrate (typedie, + DW_AT_byte_size, + &attr_mem), + &size) != 0) + return -1; + if (size != 1) + goto aggregate; + } + goto intreg; + } + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/ppc64_symbol.c b/backends/ppc64_symbol.c new file mode 100644 index 00000000..49fde0ca --- /dev/null +++ b/backends/ppc64_symbol.c @@ -0,0 +1,109 @@ +/* PPC64 specific symbolic name handling. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <elf.h> +#include <stddef.h> +#include <string.h> + +#define BACKEND ppc64_ +#include "libebl_CPU.h" + + +/* Check for the simple reloc types. */ +Elf_Type +ppc64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_PPC64_ADDR64: + case R_PPC64_UADDR64: + return ELF_T_XWORD; + case R_PPC64_ADDR32: + case R_PPC64_UADDR32: + return ELF_T_WORD; + case R_PPC64_UADDR16: + return ELF_T_HALF; + default: + return ELF_T_NUM; + } +} + + +const char * +ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_PPC64_GLINK: + return "PPC64_GLINK"; + case DT_PPC64_OPD: + return "PPC64_OPD"; + case DT_PPC64_OPDSZ: + return "PPC64_OPDSZ"; + default: + break; + } + return NULL; +} + + +bool +ppc64_dynamic_tag_check (int64_t tag) +{ + return (tag == DT_PPC64_GLINK + || tag == DT_PPC64_OPD + || tag == DT_PPC64_OPDSZ); +} + + +/* Check whether given symbol's st_value and st_size are OK despite failing + normal checks. */ +bool +ppc64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, + const GElf_Sym *sym __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + const GElf_Shdr *destshdr) +{ + const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); + if (sname == NULL) + return false; + return strcmp (sname, ".opd") == 0; +} + + +/* Check if backend uses a bss PLT in this file. */ +bool +ppc64_bss_plt_p (Elf *elf __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused))) +{ + return true; +} diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c new file mode 100644 index 00000000..733b8749 --- /dev/null +++ b/backends/ppc_attrs.c @@ -0,0 +1,76 @@ +/* Object attribute tags for PowerPC. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +bool +ppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) + Ebl *ebl __attribute__ ((unused)); + const char *vendor; + int tag; + uint64_t value; + const char **tag_name; + const char **value_name; +{ + if (!strcmp (vendor, "gnu")) + switch (tag) + { + case 4: + *tag_name = "GNU_Power_ABI_FP"; + static const char *fp_kinds[] = + { + "Hard or soft float", + "Hard float", + "Soft float", + }; + if (value < sizeof fp_kinds / sizeof fp_kinds[0]) + *value_name = fp_kinds[value]; + return true; + + case 8: + *tag_name = "GNU_Power_ABI_Vector"; + static const char *vector_kinds[] = + { + "Any", "Generic", "AltiVec", "SPE" + }; + if (value < sizeof vector_kinds / sizeof vector_kinds[0]) + *value_name = vector_kinds[value]; + return true; + } + + return false; +} + +__typeof (ppc_check_object_attribute) + ppc64_check_object_attribute + __attribute__ ((alias ("ppc_check_object_attribute"))); diff --git a/backends/ppc_auxv.c b/backends/ppc_auxv.c new file mode 100644 index 00000000..1c0a5cfc --- /dev/null +++ b/backends/ppc_auxv.c @@ -0,0 +1,52 @@ +/* i386 specific auxv handling. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "ppcle\0" "truele\0" "3\0" "4\0" "5\0" "6\0" "7\0" "8\0" "9\0" + "power6x\0" "dfp\0" "pa6t\0" "arch_2_05\0" + "ic_snoop\0" "smt\0" "booke\0" "cellbe\0" + "power5+\0" "power5\0" "power4\0" "notb\0" + "efpdouble\0" "efpsingle\0" "spe\0" "ucache\0" + "4xxmac\0" "mmu\0" "fpu\0" "altivec\0" + "ppc601\0" "ppc64\0" "ppc32\0" "\0"; + return 1; +} + +__typeof (ppc_auxv_info) ppc64_auxv_info + __attribute__ ((alias ("ppc_auxv_info"))); diff --git a/backends/ppc_corenote.c b/backends/ppc_corenote.c new file mode 100644 index 00000000..af0c46aa --- /dev/null +++ b/backends/ppc_corenote.c @@ -0,0 +1,131 @@ +/* PowerPC specific core note handling. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#ifndef BITS +# define BITS 32 +# define BACKEND ppc_ +#else +# define BITS 64 +# define BACKEND ppc64_ +#endif +#include "libebl_CPU.h" + +static const Ebl_Register_Location prstatus_regs[] = + { +#define GR(at, n, dwreg) \ + { .offset = at * BITS/8, .regno = dwreg, .count = n, .bits = BITS } + + GR (0, 32, 0), /* r0-r31 */ + /* 32, 1, nip */ + GR (33, 1, 66), /* msr */ + /* 34, 1, orig_gpr3 */ + GR (35, 1, 109), /* ctr */ + GR (36, 1, 108), /* lr */ + GR (37, 1, 101), /* xer */ + GR (38, 1, 64), /* cr */ + GR (39, 1, 100), /* mq */ + /* 40, 1, trap */ + GR (41, 1, 119), /* dar */ + GR (42, 1, 118), /* dsisr */ + +#undef GR + }; +#define PRSTATUS_REGS_SIZE (BITS / 8 * 48) + +static const Ebl_Register_Location fpregset_regs[] = + { + { .offset = 0, .regno = 32, .count = 32, .bits = 64 }, /* f0-f31 */ + { .offset = 32 * 8 + 4, .regno = 65, .count = 1, .bits = 32 } /* fpscr */ + }; +#define FPREGSET_SIZE (33 * 8) + +static const Ebl_Register_Location altivec_regs[] = + { + /* vr0-vr31 */ + { .offset = 0, .regno = 1124, .count = 32, .bits = 128 }, + /* vscr XXX 67 is an unofficial assignment */ + { .offset = 32 * 16, .regno = 67, .count = 1, .bits = 32, .pad = 12 }, + /* vrsave */ + { .offset = 33 * 16, .regno = 356, .count = 1, .bits = 32, .pad = 12 } + }; + +static const Ebl_Register_Location spe_regs[] = + { + /* evr0-evr31 + { .offset = 0, .regno = ???, .count = 32, .bits = 32 }, + * acc * + { .offset = 32 * 4, .regno = ???, .count = 1, .bits = 64 }, */ + /* spefscr */ + { .offset = 34 * 4, .regno = 612, .count = 1, .bits = 32 } + }; + +#define EXTRA_NOTES \ + EXTRA_REGSET (NT_PPC_VMX, 34 * 16, altivec_regs) \ + EXTRA_REGSET (NT_PPC_SPE, 35 * 4, spe_regs) + +#if BITS == 32 +# define ULONG uint32_t +# define ALIGN_ULONG 4 +# define TYPE_ULONG ELF_T_WORD +# define TYPE_LONG ELF_T_SWORD +#else +# define ULONG uint64_t +# define ALIGN_ULONG 8 +# define TYPE_ULONG ELF_T_XWORD +# define TYPE_LONG ELF_T_SXWORD +#endif +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_WORD +#define TYPE_GID_T ELF_T_WORD + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "nip", .type = ELF_T_ADDR, .format = 'x', \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[32]), \ + .group = "register" \ + }, \ + { \ + .name = "orig_gpr3", .type = TYPE_LONG, .format = 'd', \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[34]), \ + .group = "register" \ + } + +#include "linux-core-note.c" diff --git a/backends/ppc_init.c b/backends/ppc_init.c new file mode 100644 index 00000000..523c6583 --- /dev/null +++ b/backends/ppc_init.c @@ -0,0 +1,66 @@ +/* Initialization of PPC specific backend library. + Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ppc_ +#define RELOC_PREFIX R_PPC_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on ppc_reloc.def. */ +#include "common-reloc.c" + + +const char * +ppc_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "PowerPC"; + ppc_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, dynamic_tag_name); + HOOK (eh, dynamic_tag_check); + HOOK (eh, check_special_symbol); + HOOK (eh, bss_plt_p); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, syscall_abi); + HOOK (eh, core_note); + HOOK (eh, auxv_info); + HOOK (eh, check_object_attribute); + + return MODVERSION; +} diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c new file mode 100644 index 00000000..637c25d1 --- /dev/null +++ b/backends/ppc_regs.c @@ -0,0 +1,197 @@ +/* Register names and numbers for PowerPC DWARF. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +ssize_t +ppc_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 1156; + + if (regno < 0 || regno > 1155 || namelen < 8) + return -1; + + *prefix = NULL; + *bits = ebl->machine == EM_PPC64 ? 64 : 32; + *type = (regno < 32 ? DW_ATE_signed + : regno < 64 ? DW_ATE_float : DW_ATE_unsigned); + + if (regno < 32 || regno == 64 || regno == 66) + *setname = "integer"; + else if (regno < 64 || regno == 65) + { + *setname = "FPU"; + if (ebl->machine != EM_PPC64 && regno < 64) + *bits = 64; + } + else if (regno == 67 || regno == 356 || regno == 612 || regno >= 1124) + { + *setname = "vector"; + *bits = regno >= 1124 ? 128 : 32; + } + else + *setname = "privileged"; + + switch (regno) + { + case 0 ... 9: + name[0] = 'r'; + name[1] = regno + '0'; + namelen = 2; + break; + + case 10 ... 31: + name[0] = 'r'; + name[1] = regno / 10 + '0'; + name[2] = regno % 10 + '0'; + namelen = 3; + break; + + case 32 + 0 ... 32 + 9: + name[0] = 'f'; + name[1] = (regno - 32) + '0'; + namelen = 2; + break; + + case 32 + 10 ... 32 + 31: + name[0] = 'f'; + name[1] = (regno - 32) / 10 + '0'; + name[2] = (regno - 32) % 10 + '0'; + namelen = 3; + break; + + case 64: + return stpcpy (name, "cr") + 1 - name; + case 65: + return stpcpy (name, "fpscr") + 1 - name; + case 66: + return stpcpy (name, "msr") + 1 - name; + case 67: /* XXX unofficial assignment */ + return stpcpy (name, "vscr") + 1 - name; + + case 70 + 0 ... 70 + 9: + name[0] = 's'; + name[1] = 'r'; + name[2] = (regno - 70) + '0'; + namelen = 3; + break; + + case 70 + 10 ... 70 + 15: + name[0] = 's'; + name[1] = 'r'; + name[2] = (regno - 70) / 10 + '0'; + name[3] = (regno - 70) % 10 + '0'; + namelen = 4; + break; + + case 101: + return stpcpy (name, "xer") + 1 - name; + case 108: + return stpcpy (name, "lr") + 1 - name; + case 109: + return stpcpy (name, "ctr") + 1 - name; + case 118: + return stpcpy (name, "dsisr") + 1 - name; + case 119: + return stpcpy (name, "dar") + 1 - name; + case 122: + return stpcpy (name, "dec") + 1 - name; + case 356: + return stpcpy (name, "vrsave") + 1 - name; + case 612: + return stpcpy (name, "spefscr") + 1 - name; + case 100: + if (*bits == 32) + return stpcpy (name, "mq") + 1 - name; + + case 102 ... 107: + name[0] = 's'; + name[1] = 'p'; + name[2] = 'r'; + name[3] = (regno - 100) + '0'; + namelen = 4; + break; + + case 110 ... 117: + case 120 ... 121: + case 123 ... 199: + name[0] = 's'; + name[1] = 'p'; + name[2] = 'r'; + name[3] = (regno - 100) / 10 + '0'; + name[4] = (regno - 100) % 10 + '0'; + namelen = 5; + break; + + case 200 ... 355: + case 357 ... 611: + case 613 ... 999: + name[0] = 's'; + name[1] = 'p'; + name[2] = 'r'; + name[3] = (regno - 100) / 100 + '0'; + name[4] = ((regno - 100) % 100 / 10) + '0'; + name[5] = (regno - 100) % 10 + '0'; + namelen = 6; + break; + + case 1124 + 0 ... 1124 + 9: + name[0] = 'v'; + name[1] = 'r'; + name[2] = (regno - 1124) + '0'; + namelen = 3; + break; + + case 1124 + 10 ... 1124 + 31: + name[0] = 'v'; + name[1] = 'r'; + name[2] = (regno - 1124) / 10 + '0'; + name[3] = (regno - 1124) % 10 + '0'; + namelen = 4; + break; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} + +__typeof (ppc_register_info) + ppc64_register_info __attribute__ ((alias ("ppc_register_info"))); diff --git a/backends/ppc_reloc.def b/backends/ppc_reloc.def new file mode 100644 index 00000000..974c24fc --- /dev/null +++ b/backends/ppc_reloc.def @@ -0,0 +1,134 @@ +/* List the relocation types for ppc. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (ADDR32, REL|EXEC|DYN) +RELOC_TYPE (ADDR24, REL) +RELOC_TYPE (ADDR16, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR16_LO, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR16_HI, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR16_HA, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR14, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR14_BRTAKEN, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (ADDR14_BRNTAKEN, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (REL24, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (REL14, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (REL14_BRTAKEN, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (REL14_BRNTAKEN, REL|EXEC|DYN) /* note 1 */ +RELOC_TYPE (GOT16, REL) +RELOC_TYPE (GOT16_LO, REL) +RELOC_TYPE (GOT16_HI, REL) +RELOC_TYPE (GOT16_HA, REL) +RELOC_TYPE (PLTREL24, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (LOCAL24PC, REL) +RELOC_TYPE (UADDR32, REL|EXEC|DYN) +RELOC_TYPE (UADDR16, REL) /* note 2 */ +RELOC_TYPE (REL32, REL|EXEC|DYN) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (PLTREL32, REL) +RELOC_TYPE (PLT16_LO, REL) +RELOC_TYPE (PLT16_HI, REL) +RELOC_TYPE (PLT16_HA, REL) +RELOC_TYPE (SDAREL16, REL) +RELOC_TYPE (SECTOFF, REL) +RELOC_TYPE (SECTOFF_LO, REL) +RELOC_TYPE (SECTOFF_HI, REL) +RELOC_TYPE (SECTOFF_HA, REL) +RELOC_TYPE (TLS, REL) +RELOC_TYPE (DTPMOD32, EXEC|DYN) /* note 2 */ +RELOC_TYPE (TPREL16, REL) /* note 2 */ +RELOC_TYPE (TPREL16_LO, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HI, REL) /* note 2 */ +RELOC_TYPE (TPREL16_HA, REL) /* note 2 */ +RELOC_TYPE (TPREL32, EXEC|DYN) /* note 2 */ +RELOC_TYPE (DTPREL16, REL) +RELOC_TYPE (DTPREL16_LO, REL) +RELOC_TYPE (DTPREL16_HI, REL) +RELOC_TYPE (DTPREL16_HA, REL) +RELOC_TYPE (DTPREL32, EXEC|DYN) /* note 2 */ +RELOC_TYPE (GOT_TLSGD16, REL) +RELOC_TYPE (GOT_TLSGD16_LO, REL) +RELOC_TYPE (GOT_TLSGD16_HI, REL) +RELOC_TYPE (GOT_TLSGD16_HA, REL) +RELOC_TYPE (GOT_TLSLD16, REL) +RELOC_TYPE (GOT_TLSLD16_LO, REL) +RELOC_TYPE (GOT_TLSLD16_HI, REL) +RELOC_TYPE (GOT_TLSLD16_HA, REL) +RELOC_TYPE (GOT_TPREL16, REL) +RELOC_TYPE (GOT_TPREL16_LO, REL) +RELOC_TYPE (GOT_TPREL16_HI, REL) +RELOC_TYPE (GOT_TPREL16_HA, REL) +RELOC_TYPE (GOT_DTPREL16, REL) +RELOC_TYPE (GOT_DTPREL16_LO, REL) +RELOC_TYPE (GOT_DTPREL16_HI, REL) +RELOC_TYPE (GOT_DTPREL16_HA, REL) +RELOC_TYPE (EMB_NADDR32, REL) /* note 3 */ +RELOC_TYPE (EMB_NADDR16, REL) /* note 3 */ +RELOC_TYPE (EMB_NADDR16_LO, REL) /* note 3 */ +RELOC_TYPE (EMB_NADDR16_HI, REL) /* note 3 */ +RELOC_TYPE (EMB_NADDR16_HA, REL) /* note 3 */ +RELOC_TYPE (EMB_SDAI16, REL) /* note 3 */ +RELOC_TYPE (EMB_SDA2I16, REL) /* note 3 */ +RELOC_TYPE (EMB_SDA2REL, REL) /* note 3 */ +RELOC_TYPE (EMB_SDA21, REL) /* note 3 */ +RELOC_TYPE (EMB_MRKREF, REL) /* note 3 */ +RELOC_TYPE (EMB_RELSEC16, REL) /* note 3 */ +RELOC_TYPE (EMB_RELST_LO, REL) /* note 3 */ +RELOC_TYPE (EMB_RELST_HI, REL) /* note 3 */ +RELOC_TYPE (EMB_RELST_HA, REL) /* note 3 */ +RELOC_TYPE (EMB_BIT_FLD, REL) /* note 3 */ +RELOC_TYPE (EMB_RELSDA, REL) /* note 3 */ +RELOC_TYPE (DIAB_SDA21_LO, REL) /* note 3 */ +RELOC_TYPE (DIAB_SDA21_HI, REL) /* note 3 */ +RELOC_TYPE (DIAB_SDA21_HA, REL) /* note 3 */ +RELOC_TYPE (DIAB_RELSDA_LO, REL) /* note 3 */ +RELOC_TYPE (DIAB_RELSDA_HI, REL) /* note 3 */ +RELOC_TYPE (DIAB_RELSDA_HA, REL) /* note 3 */ +RELOC_TYPE (REL16, REL) /* note 2 */ +RELOC_TYPE (REL16_LO, REL) /* note 2 */ +RELOC_TYPE (REL16_HI, REL) /* note 2 */ +RELOC_TYPE (REL16_HA, REL) /* note 2 */ +RELOC_TYPE (TOC16, REL) /* note 2 */ + +/* Notes from Alan Modra: + + 1) These relocs should not really appear in EXEC or DYN, but they do, + primarily due to improper assembly or non-pic shared objects. They + will cause TEXTREL to be set. I marked them in the table, because + numerous people seem to think non-pic shared libs are a good idea. + + 2) As for (1), these relocs can appear anywhere with improper + assembler. I should probably make ld reject anything other than the + cases allowed in this table. Not seen in the wild, so I haven't + added the other cases. + + 3) Not used in SYSV4 +*/ diff --git a/backends/ppc_retval.c b/backends/ppc_retval.c new file mode 100644 index 00000000..fa0e303c --- /dev/null +++ b/backends/ppc_retval.c @@ -0,0 +1,162 @@ +/* Function return value location for Linux/PPC ABI. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + + +/* This is the SVR4 ELF ABI convention, but AIX and Linux do not use it. */ +#define SVR4_STRUCT_RETURN 0 + + +/* r3, or pair r3, r4. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg4 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_intreg 1 +#define nloc_intregpair 4 + +/* f1. */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_regx, .number = 33 } + }; +#define nloc_fpreg 1 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in r3. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg3, .number = 0 } + }; +#define nloc_aggregate 1 + + +int +ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + if (size <= 8) + { + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, + DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + if (encoding == DW_ATE_float) + { + *locp = loc_fpreg; + return nloc_fpreg; + } + } + intreg: + *locp = loc_intreg; + return size <= 4 ? nloc_intreg : nloc_intregpair; + } + + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + if (SVR4_STRUCT_RETURN + && dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) == 0 + && size > 0 && size <= 8) + goto intreg; + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/ppc_symbol.c b/backends/ppc_symbol.c new file mode 100644 index 00000000..9540a3e9 --- /dev/null +++ b/backends/ppc_symbol.c @@ -0,0 +1,158 @@ +/* PPC specific symbolic name handling. + Copyright (C) 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <elf.h> +#include <stddef.h> +#include <string.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + + +/* Check for the simple reloc types. */ +Elf_Type +ppc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_PPC_ADDR32: + case R_PPC_UADDR32: + return ELF_T_WORD; + case R_PPC_UADDR16: + return ELF_T_HALF; + default: + return ELF_T_NUM; + } +} + + +const char * +ppc_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_PPC_GOT: + return "PPC_GOT"; + default: + break; + } + return NULL; +} + + +bool +ppc_dynamic_tag_check (int64_t tag) +{ + return tag == DT_PPC_GOT; +} + + +/* Look for DT_PPC_GOT. */ +static bool +find_dyn_got (Elf *elf, GElf_Ehdr *ehdr, GElf_Addr *addr) +{ + for (int i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); + if (phdr == NULL || phdr->p_type != PT_DYNAMIC) + continue; + + Elf_Scn *scn = gelf_offscn (elf, phdr->p_offset); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + Elf_Data *data = elf_getdata (scn, NULL); + if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL) + for (unsigned int j = 0; j < shdr->sh_size / shdr->sh_entsize; ++j) + { + GElf_Dyn dyn_mem; + GElf_Dyn *dyn = gelf_getdyn (data, j, &dyn_mem); + if (dyn != NULL && dyn->d_tag == DT_PPC_GOT) + { + *addr = dyn->d_un.d_ptr; + return true; + } + } + + /* There is only one PT_DYNAMIC entry. */ + break; + } + + return false; +} + + +/* Check whether given symbol's st_value and st_size are OK despite failing + normal checks. */ +bool +ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, + const char *name, const GElf_Shdr *destshdr) +{ + if (name == NULL) + return false; + + if (strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) + { + /* In -msecure-plt mode, DT_PPC_GOT is present and must match. */ + GElf_Addr gotaddr; + if (find_dyn_got (elf, ehdr, &gotaddr)) + return sym->st_value == gotaddr; + + /* In -mbss-plt mode, any place in the section is valid. */ + return true; + } + + const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); + if (sname == NULL) + return false; + + if (strcmp (name, "_SDA_BASE_") == 0) + return (strcmp (sname, ".sdata") == 0 + && sym->st_value == destshdr->sh_addr + 0x8000 + && sym->st_size == 0); + + if (strcmp (name, "_SDA2_BASE_") == 0) + return (strcmp (sname, ".sdata2") == 0 + && sym->st_value == destshdr->sh_addr + 0x8000 + && sym->st_size == 0); + + return false; +} + + +/* Check if backend uses a bss PLT in this file. */ +bool +ppc_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr) +{ + GElf_Addr addr; + return ! find_dyn_got (elf, ehdr, &addr); +} diff --git a/backends/ppc_syscall.c b/backends/ppc_syscall.c new file mode 100644 index 00000000..23eff812 --- /dev/null +++ b/backends/ppc_syscall.c @@ -0,0 +1,50 @@ +/* Linux/PPC system call ABI in DWARF register numbers. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +int +ppc_syscall_abi (Ebl *ebl __attribute__ ((unused)), + int *sp, int *pc, int *callno, int args[6]) +{ + *sp = 1; + *pc = -1; + *callno = 0; + args[0] = 3; + args[1] = 4; + args[2] = 5; + args[3] = 6; + args[4] = 7; + args[5] = 8; + return 0; +} + +__typeof (ppc_syscall_abi) +ppc64_syscall_abi __attribute__ ((alias ("ppc_syscall_abi"))); diff --git a/backends/s390_init.c b/backends/s390_init.c new file mode 100644 index 00000000..05ffce60 --- /dev/null +++ b/backends/s390_init.c @@ -0,0 +1,61 @@ +/* Initialization of S/390 specific backend library. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND s390_ +#define RELOC_PREFIX R_390_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on arm_reloc.def. */ +#include "common-reloc.c" + + +const char * +s390_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "IBM S/390"; + s390_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, register_info); + HOOK (eh, return_value_location); + + /* Only the 64-bit format uses the incorrect hash table entry size. */ + if (eh->class == ELFCLASS64) + eh->sysvhash_entrysize = sizeof (Elf64_Xword); + + return MODVERSION; +} diff --git a/backends/s390_regs.c b/backends/s390_regs.c new file mode 100644 index 00000000..7e8113a2 --- /dev/null +++ b/backends/s390_regs.c @@ -0,0 +1,143 @@ +/* Register names and numbers for S/390 DWARF. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + + +/* +zseries (64) + +0-15 gpr0-gpr15 x +16-19 fpr[0246] +20-24 fpr[13578] +25-27 fpr1[024] +28 fpr9 +29-31 fpr1[135] +32-47 cr0-cr15 x +48-63 ar0-ar15 x +64 psw_mask +65 psw_address +*/ + + +ssize_t +s390_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 66; + + if (regno < 0 || regno > 65 || namelen < 7) + return -1; + + *prefix = "%"; + + *bits = ebl->class == ELFCLASS64 ? 64 : 32; + *type = DW_ATE_unsigned; + if (regno < 16) + { + *setname = "integer"; + *type = DW_ATE_signed; + } + else if (regno < 32) + { + *setname = "FPU"; + *type = DW_ATE_float; + *bits = 64; + } + else if (regno < 48 || regno > 63) + *setname = "control"; + else + { + *setname = "access"; + *bits = 32; + } + + switch (regno) + { + case 0 ... 9: + name[0] = 'r'; + name[1] = regno + '0'; + namelen = 2; + break; + + case 10 ... 15: + name[0] = 'r'; + name[1] = '1'; + name[2] = regno - 10 + '0'; + namelen = 3; + break; + + case 16 ... 31: + name[0] = 'f'; + regno = (regno & 8) | ((regno & 4) >> 2) | ((regno & 3) << 1); + namelen = 1; + if (regno >= 10) + { + regno -= 10; + name[namelen++] = '1'; + } + name[namelen++] = regno + '0'; + break; + + case 32 + 0 ... 32 + 9: + case 48 + 0 ... 48 + 9: + name[0] = regno < 48 ? 'c' : 'a'; + name[1] = (regno & 15) + '0'; + namelen = 2; + break; + + case 32 + 10 ... 32 + 15: + case 48 + 10 ... 48 + 15: + name[0] = regno < 48 ? 'c' : 'a'; + name[1] = '1'; + name[2] = (regno & 15) - 10 + '0'; + namelen = 3; + break; + + case 64: + return stpcpy (name, "pswm") + 1 - name; + case 65: + *type = DW_ATE_address; + return stpcpy (name, "pswa") + 1 - name; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/s390_reloc.def b/backends/s390_reloc.def new file mode 100644 index 00000000..b2bc9224 --- /dev/null +++ b/backends/s390_reloc.def @@ -0,0 +1,88 @@ +/* List the relocation types for s390. -*- C -*- + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (8, REL|EXEC|DYN) +RELOC_TYPE (12, REL|EXEC|DYN) +RELOC_TYPE (16, REL|EXEC|DYN) +RELOC_TYPE (32, REL|EXEC|DYN) +RELOC_TYPE (PC32, REL|EXEC|DYN) +RELOC_TYPE (GOT12, REL) +RELOC_TYPE (GOT32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (GOTOFF32, REL) +RELOC_TYPE (GOTPC, REL) +RELOC_TYPE (GOT16, REL) +RELOC_TYPE (PC16, REL|EXEC|DYN) +RELOC_TYPE (PC16DBL, REL|EXEC|DYN) +RELOC_TYPE (PLT16DBL, REL) +RELOC_TYPE (PC32DBL, REL|EXEC|DYN) +RELOC_TYPE (PLT32DBL, REL) +RELOC_TYPE (GOTPCDBL, REL) +RELOC_TYPE (64, REL|EXEC|DYN) +RELOC_TYPE (PC64, REL|EXEC|DYN) +RELOC_TYPE (GOT64, REL) +RELOC_TYPE (PLT64, REL) +RELOC_TYPE (GOTENT, REL) +RELOC_TYPE (GOTOFF16, REL) +RELOC_TYPE (GOTOFF64, REL) +RELOC_TYPE (GOTPLT12, REL) +RELOC_TYPE (GOTPLT16, REL) +RELOC_TYPE (GOTPLT32, REL) +RELOC_TYPE (GOTPLT64, REL) +RELOC_TYPE (GOTPLTENT, REL) +RELOC_TYPE (PLTOFF16, REL) +RELOC_TYPE (PLTOFF32, REL) +RELOC_TYPE (PLTOFF64, REL) +RELOC_TYPE (TLS_LOAD, REL) +RELOC_TYPE (TLS_GDCALL, REL) +RELOC_TYPE (TLS_LDCALL, REL) +RELOC_TYPE (TLS_GD32, REL) +RELOC_TYPE (TLS_GD64, REL) +RELOC_TYPE (TLS_GOTIE12, REL) +RELOC_TYPE (TLS_GOTIE32, REL) +RELOC_TYPE (TLS_GOTIE64, REL) +RELOC_TYPE (TLS_LDM32, REL) +RELOC_TYPE (TLS_LDM64, REL) +RELOC_TYPE (TLS_IE32, REL) +RELOC_TYPE (TLS_IE64, REL) +RELOC_TYPE (TLS_IEENT, REL) +RELOC_TYPE (TLS_LE32, REL) +RELOC_TYPE (TLS_LE64, REL) +RELOC_TYPE (TLS_LDO32, REL) +RELOC_TYPE (TLS_LDO64, REL) +RELOC_TYPE (TLS_DTPMOD, DYN) +RELOC_TYPE (TLS_DTPOFF, DYN) +RELOC_TYPE (TLS_TPOFF, DYN) +RELOC_TYPE (20, REL|EXEC|DYN) +RELOC_TYPE (GOT20, REL) +RELOC_TYPE (GOTPLT20, REL) +RELOC_TYPE (TLS_GOTIE20, REL) diff --git a/backends/s390_retval.c b/backends/s390_retval.c new file mode 100644 index 00000000..15bd97bf --- /dev/null +++ b/backends/s390_retval.c @@ -0,0 +1,156 @@ +/* Function return value location for S/390 ABI. + Copyright (C) 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + + +/* %r2, or pair %r2, %r3. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_intreg 1 +#define nloc_intregpair 4 + +/* %f0. */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_reg16 }, + }; +#define nloc_fpreg 1 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in %r2. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg2, .number = 0 } + }; +#define nloc_aggregate 1 + + +int +s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + { + Dwarf_Die cudie; + uint8_t asize; + if (dwarf_diecu (typedie, &cudie, &asize, NULL) == NULL) + return -1; + + if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = asize; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + if (encoding == DW_ATE_float && size <= 8) + { + *locp = loc_fpreg; + return nloc_fpreg; + } + } + if (size <= 8) + { + *locp = loc_intreg; + return size <= asize ? nloc_intreg : nloc_intregpair; + } + } + /* Fall through. */ + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + *locp = loc_aggregate; + return nloc_aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/s390_symbol.c b/backends/s390_symbol.c new file mode 100644 index 00000000..98c76530 --- /dev/null +++ b/backends/s390_symbol.c @@ -0,0 +1,53 @@ +/* S/390-specific symbolic name handling. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +s390_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_390_64: + return ELF_T_SXWORD; + case R_390_32: + return ELF_T_SWORD; + case R_390_16: + return ELF_T_HALF; + case R_390_8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} diff --git a/backends/sh_init.c b/backends/sh_init.c new file mode 100644 index 00000000..02502ab2 --- /dev/null +++ b/backends/sh_init.c @@ -0,0 +1,56 @@ +/* Initialization of SH specific backend library. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND sh_ +#define RELOC_PREFIX R_SH_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on sh_reloc.def. */ +#include "common-reloc.c" + + +const char * +sh_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "Hitachi SH"; + sh_init_reloc (eh); + HOOK (eh, reloc_simple_type); + + return MODVERSION; +} diff --git a/backends/sh_reloc.def b/backends/sh_reloc.def new file mode 100644 index 00000000..e4f24427 --- /dev/null +++ b/backends/sh_reloc.def @@ -0,0 +1,64 @@ +/* List the relocation types for SH. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (DIR32, REL|DYN) +RELOC_TYPE (REL32, REL|DYN) +RELOC_TYPE (DIR8WPN, REL) +RELOC_TYPE (IND12W, REL) +RELOC_TYPE (DIR8WPL, REL) +RELOC_TYPE (DIR8WPZ, REL) +RELOC_TYPE (DIR8BP, REL) +RELOC_TYPE (DIR8W, REL) +RELOC_TYPE (DIR8L, REL) +RELOC_TYPE (SWITCH16, REL) +RELOC_TYPE (SWITCH32, REL) +RELOC_TYPE (USES, REL) +RELOC_TYPE (COUNT, REL) +RELOC_TYPE (ALIGN, REL) +RELOC_TYPE (CODE, REL) +RELOC_TYPE (DATA, REL) +RELOC_TYPE (LABEL, REL) +RELOC_TYPE (SWITCH8, REL) +RELOC_TYPE (GNU_VTINHERIT, REL) +RELOC_TYPE (GNU_VTENTRY, REL) +RELOC_TYPE (TLS_GD_32, REL) +RELOC_TYPE (TLS_LD_32, REL) +RELOC_TYPE (TLS_LDO_32, REL) +RELOC_TYPE (TLS_IE_32, REL) +RELOC_TYPE (TLS_LE_32, REL) +RELOC_TYPE (TLS_DTPMOD32, DYN) +RELOC_TYPE (TLS_DTPOFF32, DYN) +RELOC_TYPE (TLS_TPOFF32, DYN) +RELOC_TYPE (GOT32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (GOTOFF, REL) +RELOC_TYPE (GOTPC, REL) diff --git a/backends/sh_symbol.c b/backends/sh_symbol.c new file mode 100644 index 00000000..26000ccb --- /dev/null +++ b/backends/sh_symbol.c @@ -0,0 +1,56 @@ +/* SH specific relocation handling. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND sh_ +#include "libebl_CPU.h" + + +/* Return true if the symbol type is that referencing the GOT. */ +bool +sh_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type) +{ + return type == R_SH_GOTPC; +} + +/* Check for the simple reloc types. */ +Elf_Type +sh_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_SH_DIR32: + return ELF_T_WORD; + default: + return ELF_T_NUM; + } +} diff --git a/backends/sparc64_corenote.c b/backends/sparc64_corenote.c new file mode 100644 index 00000000..cef6431e --- /dev/null +++ b/backends/sparc64_corenote.c @@ -0,0 +1,2 @@ +#define BITS 64 +#include "sparc_corenote.c" diff --git a/backends/sparc_auxv.c b/backends/sparc_auxv.c new file mode 100644 index 00000000..a22b3cea --- /dev/null +++ b/backends/sparc_auxv.c @@ -0,0 +1,43 @@ +/* SPARC-specific auxv handling. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND sparc_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "flush\0" "stbar\0" "swap\0" "muldiv\0" "v9\0" "ultra3\0" "v9v\0" "\0"; + return 1; +} diff --git a/backends/sparc_corenote.c b/backends/sparc_corenote.c new file mode 100644 index 00000000..55aed8f4 --- /dev/null +++ b/backends/sparc_corenote.c @@ -0,0 +1,109 @@ +/* PowerPC specific core note handling. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#ifndef BITS +# define BITS 32 +# define BACKEND sparc_ +#else +# define BITS 64 +# define BACKEND sparc64_ +#endif +#include "libebl_CPU.h" + +#define GR(at, n, dwreg) \ + { .offset = at * BITS/8, .regno = dwreg, .count = n, .bits = BITS } + +static const Ebl_Register_Location prstatus_regs[] = + { + GR (0, 32, 0), /* %g0-%g7, %o0-%o7, %i0-%i7 */ +#if BITS == 32 + GR (32, 1, 65), /* %psr */ + GR (33, 2, 68), /* %pc, %npc */ + GR (35, 1, 64), /* %y */ + GR (36, 1, 66), /* %wim, %tbr */ +#else + GR (32, 1, 82), /* %state */ + GR (33, 2, 80), /* %pc, %npc */ + GR (35, 1, 85), /* %y */ +#endif + }; +#define PRSTATUS_REGS_SIZE (BITS / 8 * (32 + (BITS == 32 ? 6 : 4))) + +static const Ebl_Register_Location fpregset_regs[] = + { +#if BITS == 32 + GR (0, 32, 32), /* %f0-%f31 */ + /* padding word */ + GR (33, 1, 70), /* %fsr */ + /* qcnt, q_entrysize, en, q, padding */ +# define FPREGSET_SIZE (34 * 4 + 4 + 64 * 4 + 4) +#else + GR (0, 32, 32), /* %f0-%f31 */ + GR (32, 1, 83), /* %fsr */ + /* 33, 1, %gsr */ + GR (34, 1, 84), /* %fprs */ +# define FPREGSET_SIZE (35 * 8) +#endif + }; + +#if BITS == 32 +# define ULONG uint32_t +# define ALIGN_ULONG 4 +# define TYPE_ULONG ELF_T_WORD +# define TYPE_LONG ELF_T_SWORD +# define UID_T uint16_t +# define GID_T uint16_t +# define ALIGN_UID_T 2 +# define ALIGN_GID_T 2 +# define TYPE_UID_T ELF_T_HALF +# define TYPE_GID_T ELF_T_HALF +#else +# define ULONG uint64_t +# define ALIGN_ULONG 8 +# define TYPE_ULONG ELF_T_XWORD +# define TYPE_LONG ELF_T_SXWORD +# define UID_T uint32_t +# define GID_T uint32_t +# define ALIGN_UID_T 4 +# define ALIGN_GID_T 4 +# define TYPE_UID_T ELF_T_WORD +# define TYPE_GID_T ELF_T_WORD +# define SUSECONDS_HALF 1 +#endif +#define PID_T int32_t +#define ALIGN_PID_T 4 +#define TYPE_PID_T ELF_T_SWORD + +#include "linux-core-note.c" diff --git a/backends/sparc_init.c b/backends/sparc_init.c new file mode 100644 index 00000000..856bd48c --- /dev/null +++ b/backends/sparc_init.c @@ -0,0 +1,73 @@ +/* Initialization of SPARC specific backend library. + Copyright (C) 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND sparc_ +#define RELOC_PREFIX R_SPARC_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on sparc_reloc.def. */ +#include "common-reloc.c" + +extern __typeof (EBLHOOK (core_note)) sparc64_core_note attribute_hidden; + +const char * +sparc_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + if (machine == EM_SPARCV9) + eh->name = "SPARC v9"; + else if (machine == EM_SPARC32PLUS) + eh->name = "SPARC v8+"; + else + eh->name = "SPARC"; + sparc_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, machine_flag_check); + HOOK (eh, check_special_section); + HOOK (eh, symbol_type_name); + HOOK (eh, dynamic_tag_name); + HOOK (eh, dynamic_tag_check); + if (eh->class == ELFCLASS64) + eh->core_note = sparc64_core_note; + else + HOOK (eh, core_note); + HOOK (eh, auxv_info); + HOOK (eh, register_info); + HOOK (eh, return_value_location); + + return MODVERSION; +} diff --git a/backends/sparc_regs.c b/backends/sparc_regs.c new file mode 100644 index 00000000..b3e9e201 --- /dev/null +++ b/backends/sparc_regs.c @@ -0,0 +1,108 @@ +/* Register names and numbers for SPARC DWARF. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <dwarf.h> + +#define BACKEND sparc_ +#include "libebl_CPU.h" + +ssize_t +sparc_register_info (Ebl *ebl, + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + const int nfp = 32 + (ebl->machine == EM_SPARC ? 0 : 16); + const int nspec = ebl->machine == EM_SPARC ? 8 : 6; + + if (name == NULL) + return 32 + nfp + nspec; + + if (regno < 0 || regno >= 32 + nfp + nspec || namelen < 6) + return -1; + + *bits = ebl->machine == EM_SPARC ? 32 : 64; + *type = DW_ATE_signed; + + *prefix = "%"; + + if (regno >= 32 + nfp) + { + regno -= 32 + nfp; + static const char names[2][8][6] = + { + { "y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr" }, /* v8 */ + { "pc", "npc", "state", "fsr", "fprs", "y" } /* v9 */ + }; + *setname = "control"; + *type = DW_ATE_unsigned; + if ((ebl->machine != EM_SPARC ? 0 : 4) + 1 - (unsigned int) regno <= 1) + *type = DW_ATE_address; + return stpncpy (name, names[ebl->machine != EM_SPARC][regno], + namelen) + 1 - name; + } + + if (regno < 32) + { + *setname = "integer"; + name[0] = "goli"[regno >> 3]; + name[1] = (regno & 7) + '0'; + namelen = 2; + if ((regno & 8) && (regno & 7) == 6) + *type = DW_ATE_address; + } + else + { + *setname = "FPU"; + *type = DW_ATE_float; + + regno -= 32; + if (regno >= 32) + regno = 32 + 2 * (regno - 32); + else + *bits = 32; + + name[0] = 'f'; + if (regno < 10) + { + name[1] = regno + '0'; + namelen = 2; + } + else + { + name[1] = regno / 10 + '0'; + name[2] = regno % 10 + '0'; + namelen = 3; + } + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/sparc_reloc.def b/backends/sparc_reloc.def new file mode 100644 index 00000000..de650974 --- /dev/null +++ b/backends/sparc_reloc.def @@ -0,0 +1,106 @@ +/* List the relocation types for sparc. -*- C -*- + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (8, 0) +RELOC_TYPE (16, 0) +RELOC_TYPE (32, 0) +RELOC_TYPE (DISP8, 0) +RELOC_TYPE (DISP16, 0) +RELOC_TYPE (DISP32, 0) +RELOC_TYPE (WDISP30, 0) +RELOC_TYPE (WDISP22, 0) +RELOC_TYPE (HI22, 0) +RELOC_TYPE (22, 0) +RELOC_TYPE (13, 0) +RELOC_TYPE (LO10, 0) +RELOC_TYPE (GOT10, 0) +RELOC_TYPE (GOT13, 0) +RELOC_TYPE (GOT22, 0) +RELOC_TYPE (PC10, 0) +RELOC_TYPE (PC22, 0) +RELOC_TYPE (WPLT30, 0) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (UA32, 0) +RELOC_TYPE (PLT32, 0) +RELOC_TYPE (HIPLT22, 0) +RELOC_TYPE (LOPLT10, 0) +RELOC_TYPE (PCPLT32, 0) +RELOC_TYPE (PCPLT22, 0) +RELOC_TYPE (PCPLT10, 0) +RELOC_TYPE (10, 0) +RELOC_TYPE (11, 0) +RELOC_TYPE (64, 0) +RELOC_TYPE (OLO10, 0) +RELOC_TYPE (HH22, 0) +RELOC_TYPE (HM10, 0) +RELOC_TYPE (LM22, 0) +RELOC_TYPE (PC_HH22, 0) +RELOC_TYPE (PC_HM10, 0) +RELOC_TYPE (PC_LM22, 0) +RELOC_TYPE (WDISP16, 0) +RELOC_TYPE (WDISP19, 0) +RELOC_TYPE (7, 0) +RELOC_TYPE (5, 0) +RELOC_TYPE (6, 0) +RELOC_TYPE (DISP64, 0) +RELOC_TYPE (PLT64, 0) +RELOC_TYPE (HIX22, 0) +RELOC_TYPE (LOX10, 0) +RELOC_TYPE (H44, 0) +RELOC_TYPE (M44, 0) +RELOC_TYPE (L44, 0) +RELOC_TYPE (REGISTER, 0) +RELOC_TYPE (UA64, 0) +RELOC_TYPE (UA16, 0) +RELOC_TYPE (TLS_GD_HI22, 0) +RELOC_TYPE (TLS_GD_LO10, 0) +RELOC_TYPE (TLS_GD_ADD, 0) +RELOC_TYPE (TLS_GD_CALL, 0) +RELOC_TYPE (TLS_LDM_HI22, 0) +RELOC_TYPE (TLS_LDM_LO10, 0) +RELOC_TYPE (TLS_LDM_ADD, 0) +RELOC_TYPE (TLS_LDM_CALL, 0) +RELOC_TYPE (TLS_LDO_HIX22, 0) +RELOC_TYPE (TLS_LDO_LOX10, 0) +RELOC_TYPE (TLS_LDO_ADD, 0) +RELOC_TYPE (TLS_IE_HI22, 0) +RELOC_TYPE (TLS_IE_LO10, 0) +RELOC_TYPE (TLS_IE_LD, 0) +RELOC_TYPE (TLS_IE_LDX, 0) +RELOC_TYPE (TLS_IE_ADD, 0) +RELOC_TYPE (TLS_LE_HIX22, 0) +RELOC_TYPE (TLS_LE_LOX10, 0) +RELOC_TYPE (TLS_DTPMOD32, 0) +RELOC_TYPE (TLS_DTPMOD64, 0) +RELOC_TYPE (TLS_DTPOFF32, 0) +RELOC_TYPE (TLS_DTPOFF64, 0) +RELOC_TYPE (TLS_TPOFF32, 0) +RELOC_TYPE (TLS_TPOFF64, 0) diff --git a/backends/sparc_retval.c b/backends/sparc_retval.c new file mode 100644 index 00000000..7cd38273 --- /dev/null +++ b/backends/sparc_retval.c @@ -0,0 +1,156 @@ +/* Function return value location for SPARC. + Copyright (C) 2006, 2007 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND sparc_ +#include "libebl_CPU.h" + + +/* %o0, or pair %o0, %o1. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg8 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg9 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_intreg 1 +#define nloc_intregpair 4 + +/* %f0 or pair %f0, %f1, or quad %f0..%f3. */ +static const Dwarf_Op loc_fpreg[] = + { + { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_fpreg 1 +#define nloc_fpregpair 4 +#define nloc_fpregquad 8 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in %o0. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg8, .number = 0 } + }; +#define nloc_aggregate 1 + +int +sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + uint8_t asize; + Dwarf_Die cudie; + if ((tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + && dwarf_diecu (typedie, &cudie, &asize, NULL) != NULL) + size = asize; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + if (encoding == DW_ATE_float) + { + *locp = loc_fpreg; + if (size <= 4) + return nloc_fpreg; + if (size <= 8) + return nloc_fpregpair; + if (size <= 16) + return nloc_fpregquad; + } + } + if (size <= 8) + { + intreg: + *locp = loc_intreg; + return size <= 4 ? nloc_intreg : nloc_intregpair; + } + + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) == 0 + && size > 0 && size <= 8) + goto intreg; + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/sparc_symbol.c b/backends/sparc_symbol.c new file mode 100644 index 00000000..7896e9f4 --- /dev/null +++ b/backends/sparc_symbol.c @@ -0,0 +1,145 @@ +/* SPARC specific symbolic name handling. + Copyright (C) 2002, 2003, 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Jakub Jelinek <jakub@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND sparc_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +sparc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_SPARC_8: + return ELF_T_BYTE; + case R_SPARC_16: + case R_SPARC_UA16: + return ELF_T_HALF; + case R_SPARC_32: + case R_SPARC_UA32: + return ELF_T_WORD; + case R_SPARC_64: + case R_SPARC_UA64: + return ELF_T_XWORD; + default: + return ELF_T_NUM; + } +} + +/* Check whether machine flags are valid. */ +bool +sparc_machine_flag_check (GElf_Word flags) +{ + return ((flags &~ (EF_SPARCV9_MM + | EF_SPARC_LEDATA + | EF_SPARC_32PLUS + | EF_SPARC_SUN_US1 + | EF_SPARC_SUN_US3)) == 0); +} + +bool +sparc_check_special_section (Ebl *ebl, + int ndx __attribute__ ((unused)), + const GElf_Shdr *shdr, + const char *sname __attribute__ ((unused))) +{ + if ((shdr->sh_flags & (SHF_WRITE | SHF_EXECINSTR)) + == (SHF_WRITE | SHF_EXECINSTR)) + { + /* This is ordinarily flagged, but is valid for a PLT on SPARC. + + Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it. + Its d_ptr should match the .plt section's sh_addr. */ + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr scn_shdr; + if (likely (gelf_getshdr (scn, &scn_shdr) != NULL) + && scn_shdr.sh_type == SHT_DYNAMIC + && scn_shdr.sh_entsize != 0) + { + Elf_Data *data = elf_getdata (scn, NULL); + if (data != NULL) + for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i) + { + GElf_Dyn dyn; + if (unlikely (gelf_getdyn (data, i, &dyn) == NULL)) + break; + if (dyn.d_tag == DT_PLTGOT) + return dyn.d_un.d_ptr == shdr->sh_addr; + } + break; + } + } + } + + return false; +} + +const char * +sparc_symbol_type_name (int type, + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (type) + { + case STT_SPARC_REGISTER: + return "SPARC_REGISTER"; + } + return NULL; +} + +const char * +sparc_dynamic_tag_name (int64_t tag, + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (tag) + { + case DT_SPARC_REGISTER: + return "SPARC_REGISTER"; + } + return NULL; +} + +bool +sparc_dynamic_tag_check (int64_t tag) +{ + switch (tag) + { + case DT_SPARC_REGISTER: + return true; + } + return false; +} diff --git a/backends/x86_64_corenote.c b/backends/x86_64_corenote.c new file mode 100644 index 00000000..552ac88b --- /dev/null +++ b/backends/x86_64_corenote.c @@ -0,0 +1,109 @@ +/* x86-64 specific core note handling. + Copyright (C) 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + + +static const Ebl_Register_Location prstatus_regs[] = + { +#define GR(at, n, dwreg) \ + { .offset = at * 8, .regno = dwreg, .count = n, .bits = 64 } +#define SR(at, n, dwreg) \ + { .offset = at * 8, .regno = dwreg, .count = n, .bits = 16, .pad = 6 } + + GR (0, 1, 15), /* %r15 */ + GR (1, 1, 14), /* %r14 */ + GR (2, 1, 13), /* %r13 */ + GR (3, 1, 12), /* %r12 */ + GR (4, 1, 6), /* %rbp */ + GR (5, 1, 3), /* %rbx */ + GR (6, 1, 11), /* %r11 */ + GR (7, 1, 10), /* %r10 */ + GR (8, 1, 9), /* %r9 */ + GR (9, 1, 8), /* %r8 */ + GR (10,1, 0), /* %rax */ + GR (11,1, 2), /* %rcx */ + GR (12,1, 1), /* %rdx */ + GR (13,2, 4), /* %rsi-%rdi */ + /* 15,1, orig_rax */ + GR (16,1, 16), /* %rip */ + SR (17,1, 51), /* %cs */ + GR (18,1, 49), /* %rFLAGS */ + GR (19,1, 7), /* %rsp */ + SR (20,1, 52), /* %ss */ + GR (21,2, 58), /* %fs.base-%gs.base */ + SR (23,1, 53), /* %ds */ + SR (24,1, 50), /* %es */ + SR (25,2, 54), /* %fs-%gs */ + +#undef GR +#undef SR + }; +#define PRSTATUS_REGS_SIZE (27 * 8) + +#define ULONG uint64_t +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_ULONG 8 +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_ULONG ELF_T_XWORD +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_SWORD +#define TYPE_GID_T ELF_T_SWORD + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "orig_rax", .type = ELF_T_SXWORD, .format = 'd', \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (8 * 15), \ + .group = "register" \ + } + +static const Ebl_Register_Location fpregset_regs[] = + { + { .offset = 0, .regno = 65, .count = 2, .bits = 16 }, /* fcw-fsw */ + { .offset = 24, .regno = 64, .count = 1, .bits = 32 }, /* mxcsr */ + { .offset = 32, .regno = 33, .count = 8, .bits = 80, .pad = 6 }, /* stN */ + { .offset = 32 + 128, .regno = 17, .count = 16, .bits = 128 }, /* xmm */ + }; +#define FPREGSET_SIZE 512 + +#define EXTRA_NOTES EXTRA_NOTES_IOPERM + +#include "x86_corenote.c" +#include "linux-core-note.c" diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c new file mode 100644 index 00000000..a2eaffa5 --- /dev/null +++ b/backends/x86_64_init.c @@ -0,0 +1,61 @@ +/* Initialization of x86-64 specific backend library. + Copyright (C) 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND x86_64_ +#define RELOC_PREFIX R_X86_64_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on x86_64_reloc.def. */ +#include "common-reloc.c" + +const char * +x86_64_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "AMD x86-64"; + x86_64_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, core_note); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, syscall_abi); + HOOK (eh, auxv_info); + HOOK (eh, disasm); + + return MODVERSION; +} diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c new file mode 100644 index 00000000..8eb0d33f --- /dev/null +++ b/backends/x86_64_regs.c @@ -0,0 +1,182 @@ +/* Register names and numbers for x86-64 DWARF. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> +#include <string.h> + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + +ssize_t +x86_64_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 67; + + if (regno < 0 || regno > 66 || namelen < 7) + return -1; + + *prefix = "%"; + *bits = 64; + *type = DW_ATE_unsigned; + if (regno < 17) + { + *setname = "integer"; + *type = DW_ATE_signed; + } + else if (regno < 33) + { + *setname = "SSE"; + *bits = 128; + } + else if (regno < 41) + { + *setname = "x87"; + *type = DW_ATE_float; + *bits = 80; + } + else if (regno < 49) + *setname = "MMX"; + else if (regno > 49 && regno < 60) + { + *setname = "segment"; + *bits = 16; + } + else + *setname = "control"; + + switch (regno) + { + static const char baseregs[][2] = + { + "ax", "dx", "cx", "bx", "si", "di", "bp", "sp" + }; + + case 6 ... 7: + *type = DW_ATE_address; + case 0 ... 5: + name[0] = 'r'; + name[1] = baseregs[regno][0]; + name[2] = baseregs[regno][1]; + namelen = 3; + break; + + case 8 ... 9: + name[0] = 'r'; + name[1] = regno - 8 + '8'; + namelen = 2; + break; + + case 10 ... 15: + name[0] = 'r'; + name[1] = '1'; + name[2] = regno - 10 + '0'; + namelen = 3; + break; + + case 16: + *type = DW_ATE_address; + name[0] = 'r'; + name[1] = 'i'; + name[2] = 'p'; + namelen = 3; + break; + + case 17 ... 26: + name[0] = 'x'; + name[1] = 'm'; + name[2] = 'm'; + name[3] = regno - 17 + '0'; + namelen = 4; + break; + + case 27 ... 32: + name[0] = 'x'; + name[1] = 'm'; + name[2] = 'm'; + name[3] = '1'; + name[4] = regno - 27 + '0'; + namelen = 5; + break; + + case 33 ... 40: + name[0] = 's'; + name[1] = 't'; + name[2] = regno - 33 + '0'; + namelen = 3; + break; + + case 41 ... 48: + name[0] = 'm'; + name[1] = 'm'; + name[2] = regno - 41 + '0'; + namelen = 3; + break; + + case 50 ... 55: + name[0] = "ecsdfg"[regno - 50]; + name[1] = 's'; + namelen = 2; + break; + + case 58 ... 59: + *type = DW_ATE_address; + *bits = 64; + name[0] = regno - 58 + 'f'; + return stpcpy (&name[1], "s.base") + 1 - name; + + case 49: + *setname = "integer"; + return stpcpy (name, "rflags") + 1 - name; + case 62: + return stpcpy (name, "tr") + 1 - name; + case 63: + return stpcpy (name, "ldtr") + 1 - name; + case 64: + return stpcpy (name, "mxcsr") + 1 - name; + + case 65 ... 66: + *bits = 16; + name[0] = 'f'; + name[1] = "cs"[regno - 65]; + name[2] = 'w'; + namelen = 3; + break; + + default: + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/x86_64_reloc.def b/backends/x86_64_reloc.def new file mode 100644 index 00000000..e6c5a84b --- /dev/null +++ b/backends/x86_64_reloc.def @@ -0,0 +1,51 @@ +/* List the relocation types for x86-64. -*- C -*- + Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (64, REL|EXEC|DYN) +RELOC_TYPE (PC32, REL|EXEC|DYN) +RELOC_TYPE (GOT32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JUMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (GOTPCREL, REL) +RELOC_TYPE (32, REL|EXEC|DYN) +RELOC_TYPE (32S, REL) +RELOC_TYPE (16, REL) +RELOC_TYPE (PC16, REL) +RELOC_TYPE (8, REL) +RELOC_TYPE (PC8, REL) +RELOC_TYPE (DTPMOD64, EXEC|DYN) +RELOC_TYPE (DTPOFF64, EXEC|DYN) +RELOC_TYPE (TPOFF64, EXEC|DYN) +RELOC_TYPE (TLSGD, REL) +RELOC_TYPE (TLSLD, REL) +RELOC_TYPE (DTPOFF32, REL) +RELOC_TYPE (GOTTPOFF, REL) +RELOC_TYPE (TPOFF32, REL) diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c new file mode 100644 index 00000000..3109431e --- /dev/null +++ b/backends/x86_64_retval.c @@ -0,0 +1,203 @@ +/* Function return value location for Linux/x86-64 ABI. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + + +/* %rax, or pair %rax, %rdx. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 8 }, + }; +#define nloc_intreg 1 +#define nloc_intregpair 4 + +/* %st(0), or pair %st(0), %st(1). */ +static const Dwarf_Op loc_x87reg[] = + { + { .atom = DW_OP_regx, .number = 33 }, + { .atom = DW_OP_piece, .number = 10 }, + { .atom = DW_OP_regx, .number = 34 }, + { .atom = DW_OP_piece, .number = 10 }, + }; +#define nloc_x87reg 1 +#define nloc_x87regpair 4 + +/* %xmm0, or pair %xmm0, %xmm1. */ +static const Dwarf_Op loc_ssereg[] = + { + { .atom = DW_OP_reg17 }, { .atom = DW_OP_piece, .number = 16 }, + { .atom = DW_OP_reg18 }, { .atom = DW_OP_piece, .number = 16 }, + }; +#define nloc_ssereg 1 +#define nloc_sseregpair 4 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in %rax. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + + +int +x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + + switch (encoding) + { + case DW_ATE_complex_float: + switch (size) + { + case 4 * 2: /* complex float */ + case 8 * 2: /* complex double */ + *locp = loc_ssereg; + return nloc_sseregpair; + case 16 * 2: /* complex long double */ + *locp = loc_x87reg; + return nloc_x87regpair; + } + return -2; + + case DW_ATE_float: + switch (size) + { + case 4: /* float */ + case 8: /* double */ + *locp = loc_ssereg; + return nloc_ssereg; + case 16: /* long double */ + /* XXX distinguish __float128, which is sseregpair?? */ + *locp = loc_x87reg; + return nloc_x87reg; + } + return -2; + } + } + + intreg: + *locp = loc_intreg; + if (size <= 8) + return nloc_intreg; + if (size <= 16) + return nloc_intregpair; + + large: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + return -1; + if (size > 16) + goto large; + + /* XXX + Must examine the fields in picayune ways to determine the + actual answer. This will be right for small C structs + containing integer types and similarly simple cases. + */ + + goto intreg; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/x86_64_symbol.c b/backends/x86_64_symbol.c new file mode 100644 index 00000000..97fd15b3 --- /dev/null +++ b/backends/x86_64_symbol.c @@ -0,0 +1,57 @@ +/* x86_64 specific symbolic name handling. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <elf.h> +#include <stddef.h> + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +x86_64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_X86_64_64: + return ELF_T_XWORD; + case R_X86_64_32: + return ELF_T_WORD; + case R_X86_64_32S: + return ELF_T_SWORD; + case R_X86_64_16: + return ELF_T_HALF; + case R_X86_64_8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} diff --git a/backends/x86_64_syscall.c b/backends/x86_64_syscall.c new file mode 100644 index 00000000..c3db715d --- /dev/null +++ b/backends/x86_64_syscall.c @@ -0,0 +1,47 @@ +/* Linux/x86-64 system call ABI in DWARF register numbers. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + +int +x86_64_syscall_abi (Ebl *ebl __attribute__ ((unused)), + int *sp, int *pc, int *callno, int args[6]) +{ + *sp = 7; /* %rsp */ + *pc = 16; /* %rip */ + *callno = 0; /* %rax */ + args[0] = 5; /* %rdi */ + args[1] = 4; /* %rsi */ + args[2] = 1; /* %rdx */ + args[3] = 10; /* %r10 */ + args[4] = 8; /* %r8 */ + args[5] = 9; /* %r9 */ + return 0; +} diff --git a/backends/x86_corenote.c b/backends/x86_corenote.c new file mode 100644 index 00000000..7d550676 --- /dev/null +++ b/backends/x86_corenote.c @@ -0,0 +1,47 @@ +/* x86-specific core note handling, pieces common to x86-64 and i386. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#define EXTRA_NOTES_IOPERM \ + case NT_386_IOPERM: \ + return ioperm_info (descsz, regs_offset, nregloc, reglocs, nitems, items); + +static int +ioperm_info (GElf_Word descsz, GElf_Word *regs_offset, + size_t *nregloc, const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **items) +{ + static const Ebl_Core_Item ioperm_item = + { .type = ELF_T_WORD, .format = 'b', .name = "ioperm" }; + + if (descsz % 4 != 0) + return 0; + + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + *nitems = 1; + *items = &ioperm_item; + return 1; +} diff --git a/config-compat-cygwin.h b/config-compat-cygwin.h deleted file mode 100644 index c256e795..00000000 --- a/config-compat-cygwin.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CONFIG_COMPAT_CYGWIN_H -#define CONFIG_COMPAT_CYGWIN_H - -#include <byteswap.h> -#include <endian.h> -#include <libintl.h> - -#endif diff --git a/config-compat-darwin.h b/config-compat-darwin.h deleted file mode 100644 index f884b09f..00000000 --- a/config-compat-darwin.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef CONFIG_COMPAT_DARWIN_H -#define CONFIG_COMPAT_DARWIN_H - -#define gettext -#define _gettext -#define _dgettext - -typedef unsigned long long __off64_t; - -#define __LITTLE_ENDIAN (1234) -#define __BIG_ENDIAN (4321) -#define __BYTE_ORDER __LITTLE_ENDIAN - -#include <stddef.h> -#include <locale.h> //LC_MESSAGES -#include <assert.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> - -#define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES) - -static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...) -{ - va_list lst; - va_start(lst, fmt); - vfprintf(stderr, fmt, lst); - fprintf(stderr, "error %d: %s\n", errnum, strerror(errno)); - va_end(lst); - exit(status); -} - -static inline char *dcgettext (char *__domainname, char *__msgid, int __category) -{ - error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__); - return NULL; -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070 -static inline size_t strnlen (const char *__string, size_t __maxlen) -{ - int len = 0; - while (__maxlen-- && *__string++) - len++; - return len; -} -#endif - -static inline void *mempcpy (void * __dest, const void * __src, size_t __n) -{ - memcpy(__dest, __src, __n); - return ((char *)__dest) + __n; -} - -#define __mempcpy mempcpy - -static inline wchar_t *wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n) -{ - error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__); - return NULL; -} - - -static inline unsigned short bswap_16(unsigned short val) -{ - return ((val & 0xff) << 8) | ((val >> 8) & 0xff); -} - -static inline unsigned long bswap_32(unsigned long val) -{ - return bswap_16((unsigned short)val) << 16 | - bswap_16((unsigned short)(val >> 16)); -} - -static inline unsigned long long bswap_64(unsigned long long val) -{ - return ((((unsigned long long)bswap_32(val)) << 32) | - (((unsigned long long)bswap_32(val >> 32)) & 0xffffffffULL)); -} - -extern int ___libelf_fill_byte; - -#endif /*CONFIG_COMPAT_DARWIN_H*/ diff --git a/config-compat-freebsd.h b/config-compat-freebsd.h deleted file mode 100644 index 092f9f0a..00000000 --- a/config-compat-freebsd.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef CONFIG_COMPAT_COMPAT_H -#define CONFIG_COMPAT_COMPAT_H - -#define gettext -#define _gettext -#define _dgettext - -#include <sys/types.h> -#include <sys/endian.h> - -typedef off_t __off64_t; - -#define __LITTLE_ENDIAN (1234) -#define __BIG_ENDIAN (4321) -#define __BYTE_ORDER __LITTLE_ENDIAN - -#include <stddef.h> -#include <locale.h> //LC_MESSAGES -#include <assert.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> - -#define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES) - -static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...) -{ - va_list lst; - va_start(lst, fmt); - vfprintf(stderr, fmt, lst); - fprintf(stderr, "error %d: %s\n", errnum, strerror(errno)); - va_end(lst); - exit(status); -} - -static inline char *dcgettext (char *__domainname, char *__msgid, int __category) -{ - error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__); - return NULL; -} - -static inline size_t strnlen (const char *__string, size_t __maxlen) -{ - int len = 0; - while (__maxlen-- && *__string++) - len++; - return len; -} - -static inline void *mempcpy (void * __dest, const void * __src, size_t __n) -{ - memcpy(__dest, __src, __n); - return ((char *)__dest) + __n; -} - -#define __mempcpy mempcpy - -static inline wchar_t *wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n) -{ - error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__); - return NULL; -} - - -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 - -extern int ___libelf_fill_byte; - -#endif /*CONFIG_COMPAT_DARWIN_H*/ diff --git a/config-compat-linux.h b/config-compat-linux.h deleted file mode 100644 index 2730de1e..00000000 --- a/config-compat-linux.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CONFIG_COMPAT_LINUX_H -#define CONFIG_COMPAT_LINUX_H - -#include <byteswap.h> -#include <endian.h> -#include <libintl.h> - -#endif @@ -1,22 +1,14 @@ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#define ENABLE_NLS 1 - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#define HAVE_DCGETTEXT 1 - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#define HAVE_GETTEXT 1 - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ +/* $libdir subdirectory containing libebl modules. */ +#define LIBEBL_SUBDIR "elfutils" /* Directory to place translation files in. */ -#define LOCALEDIR "${prefix}/share" +#define LOCALEDIR "${datarootdir}" + +/* Identifier for modules in the build. */ +#define MODVERSION "Build on bencheng.mtv.corp.google.com 2012-02-28T15:09:22-0800" /* Define to 32 or 64 if a specific implementation is wanted. */ /* #undef NATIVE_ELF */ @@ -31,116 +23,28 @@ #define PACKAGE_NAME "Red Hat elfutils" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Red Hat elfutils 0.97" +#define PACKAGE_STRING "Red Hat elfutils 0.138" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "elfutils" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.97" +#define PACKAGE_VERSION "0.138" /* Defined if thread local storage should be used. */ /* #undef USE_TLS */ /* Version number of package */ -#define VERSION "0.97" +#define VERSION "0.138" /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #define YYTEXT_POINTER 1 /* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 +/* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ - -/* Eventually we will allow multi-threaded applications to use the - libraries. Therefore we will add the necessary locking although - the macros used expand to nothing for now. */ -#define lock_lock(lock) ((void) (lock)) -#define rwlock_define(class,name) class int name -#define rwlock_init(lock) ((void) (lock)) -#define rwlock_fini(lock) ((void) (lock)) -#define rwlock_rdlock(lock) ((void) (lock)) -#define rwlock_wrlock(lock) ((void) (lock)) -#define rwlock_unlock(lock) ((void) (lock)) -#define tls_key_t void * -#define key_create(keyp, freefct) (1) -#define getspecific(key) key -#define setspecific(key,val) key = val -#define once_define(class,name) class int name -#define once_execute(name,fct) \ - do { \ - if (name == 0) \ - fct (); \ - name = 1; \ - } while (0) - -/* gettext helper macro. */ -#define N_(Str) Str - -/* Compiler-specific definitions. */ -#define strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -#ifdef __i386__ -# define internal_function_def __attribute__ ((regparm (3), stdcall)) -#else -# define internal_function_def /* nothing */ -#endif - -# define internal_function \ - internal_function_def __attribute__ ((visibility ("internal"))) -# define internal_strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def; - -#define attribute_hidden \ - __attribute__ ((visibility ("hidden"))) - -/* Define ALLOW_UNALIGNED if the architecture allows operations on - unaligned memory locations. */ -#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__ -# define ALLOW_UNALIGNED 1 -#else -# define ALLOW_UNALIGNED 0 -#endif - -#define unlikely(expr) __builtin_expect (expr, 0) -#define likely(expr) __builtin_expect (expr, 1) - -#define obstack_calloc(ob, size) \ - ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) -#define obstack_strdup(ob, str) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) -#define obstack_strndup(ob, str, n) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) - -#if __STDC_VERSION__ >= 199901L -# define flexarr_size /* empty */ -#else -# define flexarr_size 0 -#endif - -/* Calling conventions. */ -#ifdef __i386__ -# define CALLING_CONVENTION regparm (3), stdcall -# define AND_CALLING_CONVENTION , regparm (3), stdcall -#else -# define CALLING_CONVENTION -# define AND_CALLING_CONVENTION -#endif - -/* Avoid PLT entries. */ -#ifdef PIC -# define INTUSE(name) _INTUSE(name) -# define _INTUSE(name) __##name##_internal -# define INTDEF(name) _INTDEF(name) -# define _INTDEF(name) \ - extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); -#else -# define INTUSE(name) name -# define INTDEF(name) /* empty */ -#endif - +#include <eu-config.h> diff --git a/config.h.in b/config.h.in index ce973f3c..d6645d59 100644 --- a/config.h.in +++ b/config.h.in @@ -1,22 +1,14 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#undef ENABLE_NLS - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#undef HAVE_DCGETTEXT - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT - -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV +/* $libdir subdirectory containing libebl modules. */ +#undef LIBEBL_SUBDIR /* Directory to place translation files in. */ #undef LOCALEDIR +/* Identifier for modules in the build. */ +#undef MODVERSION + /* Define to 32 or 64 if a specific implementation is wanted. */ #undef NATIVE_ELF @@ -54,92 +46,4 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES - -/* Eventually we will allow multi-threaded applications to use the - libraries. Therefore we will add the necessary locking although - the macros used expand to nothing for now. */ -#define lock_lock(lock) ((void) (lock)) -#define rwlock_define(class,name) class int name -#define rwlock_init(lock) ((void) (lock)) -#define rwlock_fini(lock) ((void) (lock)) -#define rwlock_rdlock(lock) ((void) (lock)) -#define rwlock_wrlock(lock) ((void) (lock)) -#define rwlock_unlock(lock) ((void) (lock)) -#define tls_key_t void * -#define key_create(keyp, freefct) (1) -#define getspecific(key) key -#define setspecific(key,val) key = val -#define once_define(class,name) class int name -#define once_execute(name,fct) \ - do { \ - if (name == 0) \ - fct (); \ - name = 1; \ - } while (0) - -/* gettext helper macro. */ -#define N_(Str) Str - -/* Compiler-specific definitions. */ -#define strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -#ifdef __i386__ -# define internal_function_def __attribute__ ((regparm (3), stdcall)) -#else -# define internal_function_def /* nothing */ -#endif - -# define internal_function \ - internal_function_def __attribute__ ((visibility ("internal"))) -# define internal_strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def; - -#define attribute_hidden \ - __attribute__ ((visibility ("hidden"))) - -/* Define ALLOW_UNALIGNED if the architecture allows operations on - unaligned memory locations. */ -#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__ -# define ALLOW_UNALIGNED 1 -#else -# define ALLOW_UNALIGNED 0 -#endif - -#define unlikely(expr) __builtin_expect (expr, 0) -#define likely(expr) __builtin_expect (expr, 1) - -#define obstack_calloc(ob, size) \ - ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) -#define obstack_strdup(ob, str) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) -#define obstack_strndup(ob, str, n) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) - -#if __STDC_VERSION__ >= 199901L -# define flexarr_size /* empty */ -#else -# define flexarr_size 0 -#endif - -/* Calling conventions. */ -#ifdef __i386__ -# define CALLING_CONVENTION regparm (3), stdcall -# define AND_CALLING_CONVENTION , regparm (3), stdcall -#else -# define CALLING_CONVENTION -# define AND_CALLING_CONVENTION -#endif - -/* Avoid PLT entries. */ -#ifdef PIC -# define INTUSE(name) _INTUSE(name) -# define _INTUSE(name) __##name##_internal -# define INTDEF(name) _INTDEF(name) -# define _INTDEF(name) \ - extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); -#else -# define INTUSE(name) name -# define INTDEF(name) /* empty */ -#endif - +#include <eu-config.h> diff --git a/config.log b/config.log deleted file mode 100644 index aa5d5d5f..00000000 --- a/config.log +++ /dev/null @@ -1,556 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Red Hat elfutils configure 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ ./configure --prefix /work/elfutils/google/linux-install-elfutils-0.97/ --no-create --no-recursion - -## --------- ## -## Platform. ## -## --------- ## - -hostname = in2it.corp.google.com -uname -m = i686 -uname -r = 2.6.16.11-gg1 -uname -s = Linux -uname -v = #1 SMP Wed Apr 26 14:42:26 PDT 2006 - -/usr/bin/uname -p = unknown -/bin/uname -X = unknown - -/bin/arch = i686 -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/local/scripts -PATH: /usr/local/symlinks -PATH: /usr/local/sbin -PATH: /usr/local/bin -PATH: /usr/sbin -PATH: /usr/bin -PATH: /sbin -PATH: /bin -PATH: /usr/bin/X11 -PATH: /usr/games -PATH: /work/android/device/prebuilt/Linux/toolchain/bin/ -PATH: /home/build/public/google/tools/ -PATH: /work/elfcopy -PATH: /work/aldd -PATH: /work/symchange -PATH: /work/lsd -PATH: /work/elfutils-0.97-install/bin/ -PATH: . -PATH: /home/malchev/bin -PATH: /work/android/device/out/linux-arm-release/host/bin -PATH: /work/android/device/prebuilt/Linux/toolchain/arm-elf -PATH: /work/android/device/prebuilt/Linux/toolchain/bin/ -PATH: /home/build/public/google/tools/ -PATH: /work/elfcopy -PATH: /work/aldd -PATH: /work/soslim -PATH: /work/lsd -PATH: /work/elfutils-0.97-install/bin/ -PATH: . - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:1345: checking for a BSD-compatible install -configure:1400: result: /usr/bin/install -c -configure:1411: checking whether build environment is sane -configure:1454: result: yes -configure:1519: checking for gawk -configure:1535: found /usr/bin/gawk -configure:1545: result: gawk -configure:1555: checking whether make sets $(MAKE) -configure:1575: result: yes -configure:1774: checking build system type -configure:1792: result: i686-pc-linux-gnu -configure:1800: checking host system type -configure:1814: result: i686-pc-linux-gnu -configure:1882: checking for gcc -configure:1898: found /usr/bin/gcc -configure:1908: result: gcc -configure:2152: checking for C compiler version -configure:2155: gcc --version </dev/null >&5 -gcc (GCC) 3.3.5 (Debian 1:3.3.5-8ubuntu2.1) -Copyright (C) 2003 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. - -configure:2158: $? = 0 -configure:2160: gcc -v </dev/null >&5 -Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs -Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux -Thread model: posix -gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2.1) -configure:2163: $? = 0 -configure:2165: gcc -V </dev/null >&5 -gcc: `-V' option must have argument -configure:2168: $? = 1 -configure:2191: checking for C compiler default output file name -configure:2194: gcc conftest.c >&5 -configure:2197: $? = 0 -configure:2243: result: a.out -configure:2248: checking whether the C compiler works -configure:2254: ./a.out -configure:2257: $? = 0 -configure:2274: result: yes -configure:2281: checking whether we are cross compiling -configure:2283: result: no -configure:2286: checking for suffix of executables -configure:2288: gcc -o conftest conftest.c >&5 -configure:2291: $? = 0 -configure:2316: result: -configure:2322: checking for suffix of object files -configure:2343: gcc -c conftest.c >&5 -configure:2346: $? = 0 -configure:2368: result: o -configure:2372: checking whether we are using the GNU C compiler -configure:2396: gcc -c conftest.c >&5 -configure:2402: $? = 0 -configure:2405: test -z || test ! -s conftest.err -configure:2408: $? = 0 -configure:2411: test -s conftest.o -configure:2414: $? = 0 -configure:2427: result: yes -configure:2433: checking whether gcc accepts -g -configure:2454: gcc -c -g conftest.c >&5 -configure:2460: $? = 0 -configure:2463: test -z || test ! -s conftest.err -configure:2466: $? = 0 -configure:2469: test -s conftest.o -configure:2472: $? = 0 -configure:2483: result: yes -configure:2500: checking for gcc option to accept ANSI C -configure:2570: gcc -c -g -O2 conftest.c >&5 -configure:2576: $? = 0 -configure:2579: test -z || test ! -s conftest.err -configure:2582: $? = 0 -configure:2585: test -s conftest.o -configure:2588: $? = 0 -configure:2606: result: none needed -configure:2624: gcc -c -g -O2 conftest.c >&5 -conftest.c:2: error: syntax error before "me" -configure:2630: $? = 1 -configure: failed program was: -| #ifndef __cplusplus -| choke me -| #endif -configure:2771: checking for style of include used by make -configure:2799: result: GNU -configure:2827: checking dependency style of gcc -configure:2917: result: gcc3 -configure:2939: checking how to run the C preprocessor -configure:2974: gcc -E conftest.c -configure:2980: $? = 0 -configure:3012: gcc -E conftest.c -conftest.c:11:28: ac_nonexistent.h: No such file or directory -configure:3018: $? = 1 -configure: failed program was: -| /* confdefs.h. */ -| -| #define PACKAGE_NAME "Red Hat elfutils" -| #define PACKAGE_TARNAME "elfutils" -| #define PACKAGE_VERSION "0.97" -| #define PACKAGE_STRING "Red Hat elfutils 0.97" -| #define PACKAGE_BUGREPORT "http://bugzilla.redhat.com/bugzilla/" -| #define PACKAGE "elfutils" -| #define VERSION "0.97" -| /* end confdefs.h. */ -| #include <ac_nonexistent.h> -configure:3057: result: gcc -E -configure:3081: gcc -E conftest.c -configure:3087: $? = 0 -configure:3119: gcc -E conftest.c -conftest.c:11:28: ac_nonexistent.h: No such file or directory -configure:3125: $? = 1 -configure: failed program was: -| /* confdefs.h. */ -| -| #define PACKAGE_NAME "Red Hat elfutils" -| #define PACKAGE_TARNAME "elfutils" -| #define PACKAGE_VERSION "0.97" -| #define PACKAGE_STRING "Red Hat elfutils 0.97" -| #define PACKAGE_BUGREPORT "http://bugzilla.redhat.com/bugzilla/" -| #define PACKAGE "elfutils" -| #define VERSION "0.97" -| /* end confdefs.h. */ -| #include <ac_nonexistent.h> -configure:3170: checking for egrep -configure:3180: result: grep -E -configure:3186: checking whether gcc needs -traditional -configure:3228: result: no -configure:3250: checking for msgfmt -configure:3278: result: /usr/bin/msgfmt -configure:3287: checking for gmsgfmt -configure:3318: result: /usr/bin/msgfmt -configure:3328: checking for xgettext -configure:3356: result: /usr/bin/xgettext -configure:3367: checking for msgmerge -configure:3394: result: /usr/bin/msgmerge -configure:3456: checking for ld used by GCC -configure:3519: result: /usr/bin/ld -configure:3528: checking if the linker (/usr/bin/ld) is GNU ld -GNU ld version 2.15 -configure:3540: result: yes -configure:3546: checking for shared library run path origin -configure:3559: result: done -configure:3944: checking whether NLS is requested -configure:3953: result: yes -configure:3970: checking for GNU gettext in libc -configure:3994: gcc -o conftest -g -O2 conftest.c >&5 -configure:4000: $? = 0 -configure:4003: test -z || test ! -s conftest.err -configure:4006: $? = 0 -configure:4009: test -s conftest -configure:4012: $? = 0 -configure:4024: result: yes -configure:4791: checking for ranlib -configure:4807: found /usr/bin/ranlib -configure:4818: result: ranlib -configure:4834: checking for bison -configure:4850: found /usr/bin/bison -configure:4860: result: bison -y -configure:4875: checking for flex -configure:4891: found /usr/bin/flex -configure:4901: result: flex -configure:4914: checking for yywrap in -lfl -configure:4944: gcc -o conftest -g -O2 conftest.c -lfl >&5 -configure:4950: $? = 0 -configure:4953: test -z || test ! -s conftest.err -configure:4956: $? = 0 -configure:4959: test -s conftest -configure:4962: $? = 0 -configure:4975: result: yes -configure:5052: checking lex output file root -configure:5063: flex conftest.l -configure:5066: $? = 0 -configure:5078: result: lex.yy -configure:5083: checking whether yytext is a pointer -configure:5099: gcc -o conftest -g -O2 conftest.c -lfl >&5 -configure:5105: $? = 0 -configure:5108: test -z || test ! -s conftest.err -configure:5111: $? = 0 -configure:5114: test -s conftest -configure:5117: $? = 0 -configure:5131: result: yes -configure:5146: checking for gcc with C99 support -configure:5157: gcc -c -g -O2 -std=gnu99 conftest.c >&5 -configure:5163: $? = 0 -configure:5166: test -z || test ! -s conftest.err -configure:5169: $? = 0 -configure:5172: test -s conftest.o -configure:5175: $? = 0 -configure:5187: result: yes -configure:5215: checking for special C compiler options needed for large files -configure:5312: result: no -configure:5318: checking for _FILE_OFFSET_BITS value needed for large files -configure:5349: gcc -c -g -O2 conftest.c >&5 -conftest.c:22: warning: left shift count >= width of type -conftest.c:22: warning: left shift count >= width of type -conftest.c:24: error: size of array `off_t_is_large' is negative -configure:5355: $? = 1 -configure: failed program was: -| /* confdefs.h. */ -| -| #define PACKAGE_NAME "Red Hat elfutils" -| #define PACKAGE_TARNAME "elfutils" -| #define PACKAGE_VERSION "0.97" -| #define PACKAGE_STRING "Red Hat elfutils 0.97" -| #define PACKAGE_BUGREPORT "http://bugzilla.redhat.com/bugzilla/" -| #define PACKAGE "elfutils" -| #define VERSION "0.97" -| #define ENABLE_NLS 1 -| #define HAVE_GETTEXT 1 -| #define HAVE_DCGETTEXT 1 -| #define YYTEXT_POINTER 1 -| #define LOCALEDIR "${prefix}/share" -| /* end confdefs.h. */ -| #include <sys/types.h> -| /* 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 << 62) - 1 + ((off_t) 1 << 62)) -| int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -| && LARGE_OFF_T % 2147483647 == 1) -| ? 1 : -1]; -| int -| main () -| { -| -| ; -| return 0; -| } -configure:5401: gcc -c -g -O2 conftest.c >&5 -configure:5407: $? = 0 -configure:5410: test -z || test ! -s conftest.err -configure:5413: $? = 0 -configure:5416: test -s conftest.o -configure:5419: $? = 0 -configure:5431: result: 64 -configure:5441: checking for _LARGE_FILES value needed for large files -configure:5472: gcc -c -g -O2 conftest.c >&5 -configure:5478: $? = 0 -configure:5481: test -z || test ! -s conftest.err -configure:5484: $? = 0 -configure:5487: test -s conftest.o -configure:5490: $? = 0 -configure:5554: result: no -configure:5836: creating ./config.status - -## ---------------- ## -## Cache variables. ## -## ---------------- ## - -ac_cv_build=i686-pc-linux-gnu -ac_cv_build_alias=i686-pc-linux-gnu -ac_cv_c99=yes -ac_cv_c_compiler_gnu=yes -ac_cv_env_CC_set= -ac_cv_env_CC_value= -ac_cv_env_CFLAGS_set= -ac_cv_env_CFLAGS_value= -ac_cv_env_CPPFLAGS_set= -ac_cv_env_CPPFLAGS_value= -ac_cv_env_CPP_set= -ac_cv_env_CPP_value= -ac_cv_env_LDFLAGS_set= -ac_cv_env_LDFLAGS_value= -ac_cv_env_build_alias_set= -ac_cv_env_build_alias_value= -ac_cv_env_host_alias_set= -ac_cv_env_host_alias_value= -ac_cv_env_target_alias_set= -ac_cv_env_target_alias_value= -ac_cv_exeext= -ac_cv_host=i686-pc-linux-gnu -ac_cv_host_alias=i686-pc-linux-gnu -ac_cv_lib_fl_yywrap=yes -ac_cv_objext=o -ac_cv_path_GMSGFMT=/usr/bin/msgfmt -ac_cv_path_MSGFMT=/usr/bin/msgfmt -ac_cv_path_MSGMERGE=/usr/bin/msgmerge -ac_cv_path_XGETTEXT=/usr/bin/xgettext -ac_cv_path_install='/usr/bin/install -c' -ac_cv_prog_AWK=gawk -ac_cv_prog_CPP='gcc -E' -ac_cv_prog_LEX=flex -ac_cv_prog_YACC='bison -y' -ac_cv_prog_ac_ct_CC=gcc -ac_cv_prog_ac_ct_RANLIB=ranlib -ac_cv_prog_cc_g=yes -ac_cv_prog_cc_stdc= -ac_cv_prog_egrep='grep -E' -ac_cv_prog_gcc_traditional=no -ac_cv_prog_lex_root=lex.yy -ac_cv_prog_lex_yytext_pointer=yes -ac_cv_prog_make_make_set=yes -ac_cv_sys_file_offset_bits=64 -ac_cv_sys_large_files=no -ac_cv_sys_largefile_CC=no -acl_cv_hardcode_direct=no -acl_cv_hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -acl_cv_hardcode_libdir_separator= -acl_cv_hardcode_minus_L=no -acl_cv_libext=a -acl_cv_path_LD=/usr/bin/ld -acl_cv_prog_gnu_ld=yes -acl_cv_rpath=done -acl_cv_shlibext=so -acl_cv_sys_lib_dlsearch_path_spec='/lib /usr/lib' -acl_cv_sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -acl_cv_wl=-Wl, -am_cv_CC_dependencies_compiler_type=gcc3 -gt_cv_func_gnugettext1_libc=yes - -## ----------------- ## -## Output variables. ## -## ----------------- ## - -ACLOCAL='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9' -AMDEPBACKSLASH='\' -AMDEP_FALSE='#' -AMDEP_TRUE='' -AMTAR='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar' -AUTOCONF='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf' -AUTOHEADER='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader' -AUTOMAKE='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9' -AWK='gawk' -CC='gcc' -CCDEPMODE='depmode=gcc3' -CFLAGS='-g -O2' -CPP='gcc -E' -CPPFLAGS='' -CYGPATH_W='echo' -DATADIRNAME='${prefix}/share' -DEFS='-DHAVE_CONFIG_H' -DEPDIR='.deps' -ECHO_C='' -ECHO_N='-n' -ECHO_T='' -EGREP='grep -E' -EXEEXT='' -GMSGFMT='/usr/bin/msgfmt' -INSTALL_DATA='${INSTALL} -m 644' -INSTALL_PROGRAM='${INSTALL}' -INSTALL_SCRIPT='${INSTALL}' -INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' -INTLLIBS='' -LDFLAGS='' -LEX='flex' -LEXLIB='-lfl' -LEX_OUTPUT_ROOT='lex.yy' -LIBICONV='-liconv' -LIBINTL='' -LIBOBJS='' -LIBS='' -LOCALEDIR='${prefix}/share' -LTLIBICONV='-liconv' -LTLIBINTL='' -LTLIBOBJS='' -MAKEINFO='${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo' -MKINSTALLDIRS='config/mkinstalldirs' -MSGFMT='/usr/bin/msgfmt' -MSGMERGE='/usr/bin/msgmerge' -MUDFLAP_FALSE='' -MUDFLAP_TRUE='#' -NATIVE_LD_FALSE='' -NATIVE_LD_TRUE='#' -OBJEXT='o' -PACKAGE='elfutils' -PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/' -PACKAGE_NAME='Red Hat elfutils' -PACKAGE_STRING='Red Hat elfutils 0.97' -PACKAGE_TARNAME='elfutils' -PACKAGE_VERSION='0.97' -PATH_SEPARATOR=':' -POSUB='po' -RANLIB='ranlib' -SET_MAKE='' -SHELL='/bin/sh' -STRIP='' -USE_NLS='yes' -VERSION='0.97' -XGETTEXT='/usr/bin/xgettext' -YACC='bison -y' -ac_ct_CC='gcc' -ac_ct_RANLIB='ranlib' -ac_ct_STRIP='' -am__fastdepCC_FALSE='#' -am__fastdepCC_TRUE='' -am__include='include' -am__leading_dot='.' -am__quote='' -am__tar='${AMTAR} chof - "$$tardir"' -am__untar='${AMTAR} xf -' -base_cpu='none' -bindir='${exec_prefix}/bin' -build='i686-pc-linux-gnu' -build_alias='' -build_cpu='i686' -build_os='linux-gnu' -build_vendor='pc' -datadir='${prefix}/share' -exec_prefix='${prefix}' -host='i686-pc-linux-gnu' -host_alias='' -host_cpu='i686' -host_os='linux-gnu' -host_vendor='pc' -includedir='${prefix}/include' -infodir='${prefix}/info' -install_sh='/work/elfutils/stock/elfutils-0.97/config/install-sh' -libdir='${exec_prefix}/lib' -libexecdir='${exec_prefix}/libexec' -localstatedir='${prefix}/var' -mandir='${prefix}/man' -mkdir_p='mkdir -p --' -oldincludedir='/usr/include' -prefix='/work/elfutils/google/linux-install-elfutils-0.97/' -program_transform_name='s,x,x,' -sbindir='${exec_prefix}/sbin' -sharedstatedir='${prefix}/com' -sysconfdir='${prefix}/etc' -target_alias='' - -## ----------- ## -## confdefs.h. ## -## ----------- ## - -#define ENABLE_NLS 1 -#define HAVE_DCGETTEXT 1 -#define HAVE_GETTEXT 1 -#define LOCALEDIR "${prefix}/share" -#define PACKAGE "elfutils" -#define PACKAGE_BUGREPORT "http://bugzilla.redhat.com/bugzilla/" -#define PACKAGE_NAME "Red Hat elfutils" -#define PACKAGE_STRING "Red Hat elfutils 0.97" -#define PACKAGE_TARNAME "elfutils" -#define PACKAGE_VERSION "0.97" -#define VERSION "0.97" -#define YYTEXT_POINTER 1 -#define _FILE_OFFSET_BITS 64 - -configure: exit 0 - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by Red Hat elfutils config.status 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on in2it.corp.google.com - -config.status:783: creating config/Makefile -config.status:783: creating Makefile -config.status:783: creating m4/Makefile -config.status:783: creating elfutils.spec -config.status:783: creating doc/Makefile -config.status:783: creating lib/Makefile -config.status:783: creating libelf/Makefile -config.status:783: creating libelf-po/Makefile.in -config.status:783: creating libebl/Makefile -config.status:783: creating libdw/Makefile -config.status:783: creating libcpu/Makefile -config.status:783: creating libasm/Makefile -config.status:783: creating src/Makefile -config.status:783: creating po/Makefile.in -config.status:783: creating tests/Makefile -config.status:849: creating config.h -config.status:947: config.h is unchanged -config.status:1127: executing depfiles commands -config.status:1127: executing default-1 commands - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by Red Hat elfutils config.status 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status config.h - -on in2it.corp.google.com - -config.status:849: creating config.h -config.status:947: config.h is unchanged diff --git a/config.status b/config.status deleted file mode 100755 index b03a4b73..00000000 --- a/config.status +++ /dev/null @@ -1,1314 +0,0 @@ -#! /bin/sh -# Generated by configure. -# 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-/bin/sh} -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by Red Hat elfutils $as_me 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -config_files=" config/Makefile Makefile m4/Makefile elfutils.spec:config/elfutils.spec.in doc/Makefile lib/Makefile libelf/Makefile libelf-po/Makefile.in libebl/Makefile libdw/Makefile libcpu/Makefile libasm/Makefile src/Makefile po/Makefile.in tests/Makefile" -config_headers=" config.h" -config_commands=" depfiles default-1" - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -ac_cs_version="\ -Red Hat elfutils config.status 0.97 -configured by ./configure, generated by GNU Autoconf 2.59, - with options \"'--prefix' '/work/elfutils/google/linux-install-elfutils-0.97/'\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=. -INSTALL="/usr/bin/install -c" -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - echo "running /bin/sh ./configure " '--prefix' '/work/elfutils/google/linux-install-elfutils-0.97/' $ac_configure_extra_args " --no-create --no-recursion" >&6 - exec /bin/sh ./configure '--prefix' '/work/elfutils/google/linux-install-elfutils-0.97/' $ac_configure_extra_args --no-create --no-recursion -fi - -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="" ac_aux_dir="config" -# Capture the value of obsolete because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'ALL_LINGUAS''=""' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="%UNSET%" - - -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; - "elfutils.spec" ) CONFIG_FILES="$CONFIG_FILES elfutils.spec:config/elfutils.spec.in" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "libelf/Makefile" ) CONFIG_FILES="$CONFIG_FILES libelf/Makefile" ;; - "libelf-po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES libelf-po/Makefile.in" ;; - "libebl/Makefile" ) CONFIG_FILES="$CONFIG_FILES libebl/Makefile" ;; - "libdw/Makefile" ) CONFIG_FILES="$CONFIG_FILES libdw/Makefile" ;; - "libcpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES libcpu/Makefile" ;; - "libasm/Makefile" ) CONFIG_FILES="$CONFIG_FILES libasm/Makefile" ;; - "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF -s,@SHELL@,/bin/sh,;t t -s,@PATH_SEPARATOR@,:,;t t -s,@PACKAGE_NAME@,Red Hat elfutils,;t t -s,@PACKAGE_TARNAME@,elfutils,;t t -s,@PACKAGE_VERSION@,0.97,;t t -s,@PACKAGE_STRING@,Red Hat elfutils 0.97,;t t -s,@PACKAGE_BUGREPORT@,http://bugzilla.redhat.com/bugzilla/,;t t -s,@exec_prefix@,${prefix},;t t -s,@prefix@,/work/elfutils/google/linux-install-elfutils-0.97/,;t t -s,@program_transform_name@,s,x,x,,;t t -s,@bindir@,${exec_prefix}/bin,;t t -s,@sbindir@,${exec_prefix}/sbin,;t t -s,@libexecdir@,${exec_prefix}/libexec,;t t -s,@datadir@,${prefix}/share,;t t -s,@sysconfdir@,${prefix}/etc,;t t -s,@sharedstatedir@,${prefix}/com,;t t -s,@localstatedir@,${prefix}/var,;t t -s,@libdir@,${exec_prefix}/lib,;t t -s,@includedir@,${prefix}/include,;t t -s,@oldincludedir@,/usr/include,;t t -s,@infodir@,${prefix}/info,;t t -s,@mandir@,${prefix}/man,;t t -s,@build_alias@,,;t t -s,@host_alias@,,;t t -s,@target_alias@,,;t t -s,@DEFS@,-DHAVE_CONFIG_H,;t t -s,@ECHO_C@,,;t t -s,@ECHO_N@,-n,;t t -s,@ECHO_T@,,;t t -s,@LIBS@,,;t t -s,@INSTALL_PROGRAM@,${INSTALL},;t t -s,@INSTALL_SCRIPT@,${INSTALL},;t t -s,@INSTALL_DATA@,${INSTALL} -m 644,;t t -s,@CYGPATH_W@,echo,;t t -s,@PACKAGE@,elfutils,;t t -s,@VERSION@,0.97,;t t -s,@ACLOCAL@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9,;t t -s,@AUTOCONF@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf,;t t -s,@AUTOMAKE@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9,;t t -s,@AUTOHEADER@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader,;t t -s,@MAKEINFO@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo,;t t -s,@install_sh@,/work/elfutils/stock/elfutils-0.97/config/install-sh,;t t -s,@STRIP@,,;t t -s,@ac_ct_STRIP@,,;t t -s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t -s,@mkdir_p@,mkdir -p --,;t t -s,@AWK@,gawk,;t t -s,@SET_MAKE@,,;t t -s,@am__leading_dot@,.,;t t -s,@AMTAR@,${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar,;t t -s,@am__tar@,${AMTAR} chof - "$$tardir",;t t -s,@am__untar@,${AMTAR} xf -,;t t -s,@build@,i686-pc-linux-gnu,;t t -s,@build_cpu@,i686,;t t -s,@build_vendor@,pc,;t t -s,@build_os@,linux-gnu,;t t -s,@host@,i686-pc-linux-gnu,;t t -s,@host_cpu@,i686,;t t -s,@host_vendor@,pc,;t t -s,@host_os@,linux-gnu,;t t -s,@CC@,gcc,;t t -s,@CFLAGS@,-g -O2,;t t -s,@LDFLAGS@,,;t t -s,@CPPFLAGS@,,;t t -s,@ac_ct_CC@,gcc,;t t -s,@EXEEXT@,,;t t -s,@OBJEXT@,o,;t t -s,@DEPDIR@,.deps,;t t -s,@am__include@,include,;t t -s,@am__quote@,,;t t -s,@AMDEP_TRUE@,,;t t -s,@AMDEP_FALSE@,#,;t t -s,@AMDEPBACKSLASH@,\,;t t -s,@CCDEPMODE@,depmode=gcc3,;t t -s,@am__fastdepCC_TRUE@,,;t t -s,@am__fastdepCC_FALSE@,#,;t t -s,@CPP@,gcc -E,;t t -s,@EGREP@,grep -E,;t t -s,@MKINSTALLDIRS@,config/mkinstalldirs,;t t -s,@MSGFMT@,/usr/bin/msgfmt,;t t -s,@GMSGFMT@,/usr/bin/msgfmt,;t t -s,@XGETTEXT@,/usr/bin/xgettext,;t t -s,@MSGMERGE@,/usr/bin/msgmerge,;t t -s,@USE_NLS@,yes,;t t -s,@LIBICONV@,-liconv,;t t -s,@LTLIBICONV@,-liconv,;t t -s,@INTLLIBS@,,;t t -s,@LIBINTL@,,;t t -s,@LTLIBINTL@,,;t t -s,@POSUB@,po,;t t -s,@RANLIB@,ranlib,;t t -s,@ac_ct_RANLIB@,ranlib,;t t -s,@YACC@,bison -y,;t t -s,@LEX@,flex,;t t -s,@LEXLIB@,-lfl,;t t -s,@LEX_OUTPUT_ROOT@,lex.yy,;t t -s,@LOCALEDIR@,${prefix}/share,;t t -s,@DATADIRNAME@,${prefix}/share,;t t -s,@NATIVE_LD_TRUE@,#,;t t -s,@NATIVE_LD_FALSE@,,;t t -s,@base_cpu@,none,;t t -s,@MUDFLAP_TRUE@,#,;t t -s,@MUDFLAP_FALSE@,,;t t -s,@LIBOBJS@,,;t t -s,@LTLIBOBJS@,,;t t -CEOF - - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - sed "/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - - # Handle all the #define templates only if necessary. - if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then - # If there are no defines, we may have an empty if/fi - : - cat >$tmp/defines.sed <<CEOF -/^[ ]*#[ ]*define/!b -t clr -: clr -${ac_dA}PACKAGE_NAME${ac_dB}PACKAGE_NAME${ac_dC}"Red Hat elfutils"${ac_dD} -${ac_dA}PACKAGE_TARNAME${ac_dB}PACKAGE_TARNAME${ac_dC}"elfutils"${ac_dD} -${ac_dA}PACKAGE_VERSION${ac_dB}PACKAGE_VERSION${ac_dC}"0.97"${ac_dD} -${ac_dA}PACKAGE_STRING${ac_dB}PACKAGE_STRING${ac_dC}"Red Hat elfutils 0.97"${ac_dD} -${ac_dA}PACKAGE_BUGREPORT${ac_dB}PACKAGE_BUGREPORT${ac_dC}"http://bugzilla.redhat.com/bugzilla/"${ac_dD} -${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"elfutils"${ac_dD} -${ac_dA}VERSION${ac_dB}VERSION${ac_dC}"0.97"${ac_dD} -${ac_dA}ENABLE_NLS${ac_dB}ENABLE_NLS${ac_dC}1${ac_dD} -${ac_dA}HAVE_GETTEXT${ac_dB}HAVE_GETTEXT${ac_dC}1${ac_dD} -${ac_dA}HAVE_DCGETTEXT${ac_dB}HAVE_DCGETTEXT${ac_dC}1${ac_dD} -${ac_dA}YYTEXT_POINTER${ac_dB}YYTEXT_POINTER${ac_dC}1${ac_dD} -${ac_dA}LOCALEDIR${ac_dB}LOCALEDIR${ac_dC}"\${prefix}/share"${ac_dD} -${ac_dA}_FILE_OFFSET_BITS${ac_dB}_FILE_OFFSET_BITS${ac_dC}64${ac_dD} -CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in - - fi # grep - - # Handle all the #undef templates - cat >$tmp/undefs.sed <<CEOF -/^[ ]*#[ ]*undef/!b -t clr -: clr -${ac_uA}PACKAGE_NAME${ac_uB}PACKAGE_NAME${ac_uC}"Red Hat elfutils"${ac_uD} -${ac_uA}PACKAGE_TARNAME${ac_uB}PACKAGE_TARNAME${ac_uC}"elfutils"${ac_uD} -${ac_uA}PACKAGE_VERSION${ac_uB}PACKAGE_VERSION${ac_uC}"0.97"${ac_uD} -${ac_uA}PACKAGE_STRING${ac_uB}PACKAGE_STRING${ac_uC}"Red Hat elfutils 0.97"${ac_uD} -${ac_uA}PACKAGE_BUGREPORT${ac_uB}PACKAGE_BUGREPORT${ac_uC}"http://bugzilla.redhat.com/bugzilla/"${ac_uD} -${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"elfutils"${ac_uD} -${ac_uA}VERSION${ac_uB}VERSION${ac_uC}"0.97"${ac_uD} -${ac_uA}ENABLE_NLS${ac_uB}ENABLE_NLS${ac_uC}1${ac_uD} -${ac_uA}HAVE_GETTEXT${ac_uB}HAVE_GETTEXT${ac_uC}1${ac_uD} -${ac_uA}HAVE_DCGETTEXT${ac_uB}HAVE_DCGETTEXT${ac_uC}1${ac_uD} -${ac_uA}YYTEXT_POINTER${ac_uB}YYTEXT_POINTER${ac_uC}1${ac_uD} -${ac_uA}LOCALEDIR${ac_uB}LOCALEDIR${ac_uC}"\${prefix}/share"${ac_uD} -${ac_uA}_FILE_OFFSET_BITS${ac_uB}_FILE_OFFSET_BITS${ac_uC}64${ac_uD} -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - default-1 ) - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done ;; - esac -done - -{ (exit 0); exit 0; } diff --git a/config/ChangeLog b/config/ChangeLog index 783365d4..0c503736 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,74 @@ +2008-12-24 Roland McGrath <roland@redhat.com> + + * Makefile.am ($(srcdir)/elfutils.spec.in): Rewrite awk magic. + Put the target inside [if MAINTAINER_MODE]. + +2008-12-16 Roland McGrath <roland@redhat.com> + + * version.h.in: New file. + +2008-01-12 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Add m4 to build requirements. + +2008-01-02 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Changes for disasm branch merge. + +2007-08-08 Roland McGrath <roland@redhat.com> + + * elfutils.spec.in (License): Canonicalize. + +2007-04-23 Roland McGrath <roland@redhat.com> + + * elfutils.spec.in: Distribute eu-unstrip. + +2005-08-13 Roland McGrath <roland@redhat.com> + + * Makefile.am ($(srcdir)/elfutils.spec.in): Add missing $. + +2005-07-28 Roland McGrath <roland@redhat.com> + + * elfutils.spec.in: Remove libdwfl.so from package. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Distribute eu-elfcmp. + +2005-04-01 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Distribute eu-addr2line. + +2005-03-17 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Distribute libdw.{a,so,h}. + +2005-02-22 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Ignore result of cvs run. + + * elfutils.spec.in: Simplify build process by not using a subdir. + This means we can use %configure. + +2005-02-18 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Automatically added changelog from NEWS file on dist. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Make sure RPM_OPT_FLAGS is used. During + %build, really do build the binaries. + Remove --enable-shared configure parameters. + +2005-02-07 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in (BuildRequires): Up gcc requirement to 3.4. + +2004-11-23 Ulrich Drepper <drepper@redhat.com> + + * elfutils.spec.in: Some more changes for the RPM with the fake + binaries. + 2004-01-29 Ulrich Drepper <drepper@redhat.com> * elfutils.spec.in: Update BuildRequires. diff --git a/config/Makefile b/config/Makefile deleted file mode 100644 index 9dbd8a8e..00000000 --- a/config/Makefile +++ /dev/null @@ -1,312 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# config/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = config -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog \ - config.guess config.rpath config.sub depcomp install-sh \ - missing mkinstalldirs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -EXTRA_DIST = elfutils.spec.in -all: all-am - -.SUFFIXES: -$(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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits config/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits config/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# 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/config/Makefile.am b/config/Makefile.am index 4f327520..f2db4efb 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -1,19 +1,48 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- ## Configure input file for elfutils. ## -## Copyright (C) 2004 Red Hat, Inc. +## Copyright (C) 2004, 2005, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## 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, version 2. +## Red Hat elfutils 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; version 2 of the License. ## -## 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. +## Red Hat elfutils is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software Foundation, -## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## EXTRA_DIST = elfutils.spec.in + +if MAINTAINER_MODE +$(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS + @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \ + date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ + getent passwd "$$(whoami)" | \ + awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ + echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \ + awk '\ + $$1 == "Version" && started { exit } \ + $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \ + print $$2 "-1"; next } \ + NF > 0 { line = (line != "") ? (line " " $$0) : ("- " $$0) } \ + NF == 0 && line != "" { print line; line="" } \ + END { if (line != "") print line; print "" }' $< \ + | fold -s -w 70 | sed '1!s/^[^-]/ &/' >> $$tmpname; \ + sed "/^%changelog/r $$tmpname" $@ > $@.new; \ + rm -f $$tmpname; \ + mv -f $@.new $@ +endif diff --git a/config/Makefile.in b/config/Makefile.in index 7b069373..8be96459 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,24 +33,19 @@ build_triplet = @build@ host_triplet = @host@ subdir = config DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog \ - config.guess config.rpath config.sub depcomp install-sh \ - missing mkinstalldirs + config.guess config.sub depcomp install-sh missing ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -63,43 +54,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -108,7 +95,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -116,12 +102,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -134,33 +122,46 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ 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@ EXTRA_DIST = elfutils.spec.in all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -185,11 +186,10 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: tags: TAGS TAGS: @@ -198,22 +198,21 @@ CTAGS: distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -272,12 +271,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + 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 + installcheck-am: maintainer-clean: maintainer-clean-am @@ -296,17 +303,38 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + 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 \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + + +@MAINTAINER_MODE_TRUE@$(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS +@MAINTAINER_MODE_TRUE@ @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \ +@MAINTAINER_MODE_TRUE@ date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ +@MAINTAINER_MODE_TRUE@ getent passwd "$$(whoami)" | \ +@MAINTAINER_MODE_TRUE@ awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ awk '\ +@MAINTAINER_MODE_TRUE@ $$1 == "Version" && started { exit } \ +@MAINTAINER_MODE_TRUE@ $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \ +@MAINTAINER_MODE_TRUE@ print $$2 "-1"; next } \ +@MAINTAINER_MODE_TRUE@ NF > 0 { line = (line != "") ? (line " " $$0) : ("- " $$0) } \ +@MAINTAINER_MODE_TRUE@ NF == 0 && line != "" { print line; line="" } \ +@MAINTAINER_MODE_TRUE@ END { if (line != "") print line; print "" }' $< \ +@MAINTAINER_MODE_TRUE@ | fold -s -w 70 | sed '1!s/^[^-]/ &/' >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ sed "/^%changelog/r $$tmpname" $@ > $@.new; \ +@MAINTAINER_MODE_TRUE@ rm -f $$tmpname; \ +@MAINTAINER_MODE_TRUE@ mv -f $@.new $@ # 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/config/config.guess b/config/config.guess index f1657bbc..ca2a03ca 100644 --- a/config/config.guess +++ b/config/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2002-09-03' +timestamp='2008-01-08' # 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 @@ -17,13 +18,15 @@ timestamp='2002-09-03' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner <per@bothner.com>. # Please send patches to <config-patches@gnu.org>. Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,8 +56,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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." @@ -66,11 +69,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -98,30 +101,32 @@ trap 'exit 1' 1 2 15 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -# This shell variable is my proudest work .. or something. --bje +# Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; -(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) - || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; -dummy=$tmpdir/dummy ; -files="$dummy.c $dummy.o $dummy.rel $dummy" ; -trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $files ; 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 ; -unset files' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -156,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -178,144 +184,128 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *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. - eval $set_cc_for_build - cat <<EOF >$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - 3-1307) - UNAME_MACHINE="alphaev7" - ;; - esac - fi - rm -f $dummy.s $dummy && rmdir $tmpdir - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + 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 0;; + 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 0;; + 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 @@ -323,29 +313,32 @@ EOF else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + 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 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + 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 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -354,10 +347,10 @@ EOF esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + 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 @@ -369,10 +362,10 @@ EOF echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + 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 @@ -383,37 +376,40 @@ EOF # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -437,33 +433,33 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir + $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 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS) + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -479,29 +475,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + 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 0 ;; # Note that: echo "'`uname -s`'" gives '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 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -509,7 +505,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -524,16 +520,19 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir - echo rs6000-ibm-aix3.2.5 + 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 0 ;; - *:AIX:*:[45]) + exit ;; + *:AIX:*:[456]) 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 @@ -546,28 +545,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -623,17 +622,37 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy && rmdir $tmpdir + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $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 __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -661,146 +680,192 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + 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 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + 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 0 ;; + 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 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; + echo i586-pc-interix + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) + eval $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-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -817,16 +882,45 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c && rmdir $tmpdir - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -840,7 +934,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -848,22 +942,31 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -881,15 +984,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -906,24 +1009,33 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; 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 0 ;; + 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... @@ -931,7 +1043,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + 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.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -939,15 +1071,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + 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 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` @@ -965,76 +1098,73 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv32 fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + 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 i386. echo i386-pc-msdosdjgpp - exit 0 ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 - exit 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + 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 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*: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) + 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 0 + && { 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 0 ;; + && { 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 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1042,64 +1172,81 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + 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 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + 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 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1107,22 +1254,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1133,36 +1283,47 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + 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 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1194,7 +1355,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1283,12 +1444,12 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 -rm -f $dummy.c $dummy && rmdir $tmpdir +$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 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1297,22 +1458,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1323,7 +1484,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/config/config.rpath b/config/config.rpath deleted file mode 100644 index 5ead7586..00000000 --- a/config/config.rpath +++ /dev/null @@ -1,513 +0,0 @@ -#! /bin/sh -# Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. -# -# Copyright 1996-2002 Free Software Foundation, Inc. -# Taken from GNU libtool, 2001 -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -shlibext= - -host="$1" -host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -wl= -if test "$GCC" = yes; then - wl='-Wl,' -else - case "$host_os" in - aix3* | aix4* | aix5*) - wl='-Wl,' - ;; - hpux9* | hpux10* | hpux11*) - wl='-Wl,' - ;; - irix5* | irix6*) - wl='-Wl,' - ;; - linux*) - echo '__INTEL_COMPILER' > conftest.$ac_ext - if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null - then - : - else - # Intel icc - wl='-Qoption,ld,' - fi - ;; - osf3* | osf4* | osf5*) - wl='-Wl,' - ;; - solaris*) - wl='-Wl,' - ;; - sunos4*) - wl='-Qoption ld ' - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - if test "x$host_vendor" = xsni; then - wl='-LD' - else - wl='-Wl,' - fi - ;; - esac -fi - -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no - -case "$host_os" in - cygwin* | mingw* | pw32*) - # 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 "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - case "$host_os" in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - ld_shlibs=no - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - ;; - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - sunos4*) - hardcode_direct=yes - ;; - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - esac - if test "$ld_shlibs" = yes; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - fi -else - case "$host_os" in - aix3*) - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - 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 - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - fi - hardcode_direct=yes - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - fi - if test "$aix_use_runtimelinking" = yes; then - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - fi - fi - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - cygwin* | mingw* | pw32*) - # 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. - hardcode_libdir_flag_spec=' ' - libext=lib - ;; - darwin* | rhapsody*) - hardcode_direct=yes - ;; - freebsd1*) - ld_shlibs=no - ;; - freebsd2.2*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - freebsd2*) - hardcode_direct=yes - hardcode_minus_L=yes - ;; - freebsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - hpux9* | hpux10* | hpux11*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - ;; - irix5* | irix6*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - netbsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - newsos6) - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - openbsd*) - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - osf3*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - osf4* | osf5*) - if test "$GCC" = yes; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - # Both cc and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - sco3.2v5*) - ;; - solaris*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - sunos4*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - ;; - sysv4) - if test "x$host_vendor" = xsno; then - hardcode_direct=yes # is this really true??? - else - hardcode_direct=no # Motorola manual says yes, but my tests say they lie - fi - ;; - sysv4.3*) - ;; - sysv5*) - hardcode_libdir_flag_spec= - ;; - uts4*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - dgux*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - sysv4*MP*) - if test -d /usr/nec; then - ld_shlibs=yes - fi - ;; - sysv4.2uw2*) - hardcode_direct=yes - hardcode_minus_L=no - ;; - sysv5uw7* | unixware7*) - ;; - *) - ld_shlibs=no - ;; - esac -fi - -# Check dynamic linker characteristics -libname_spec='lib$name' -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -case "$host_os" in - aix3*) - shlibext=so - ;; - aix4* | aix5*) - shlibext=so - ;; - amigaos*) - shlibext=ixlibrary - ;; - beos*) - shlibext=so - ;; - bsdi4*) - shlibext=so - 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" - ;; - cygwin* | mingw* | pw32*) - case $GCC,$host_os in - yes,cygwin*) - shlibext=dll.a - ;; - yes,mingw*) - shlibext=dll - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` - ;; - yes,pw32*) - shlibext=dll - ;; - *) - shlibext=dll - ;; - esac - ;; - darwin* | rhapsody*) - shlibext=dylib - ;; - freebsd1*) - ;; - freebsd*) - shlibext=so - ;; - gnu*) - shlibext=so - ;; - hpux9* | hpux10* | hpux11*) - shlibext=sl - ;; - irix5* | irix6*) - shlibext=so - case "$host_os" in - irix5*) - libsuff= shlibsuff= - ;; - *) - case $LD in - *-32|*"-32 ") libsuff= shlibsuff= ;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 ;; - *) libsuff= shlibsuff= ;; - esac - ;; - esac - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - ;; - linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - ;; - linux-gnu*) - shlibext=so - ;; - netbsd*) - shlibext=so - ;; - newsos6) - shlibext=so - ;; - openbsd*) - shlibext=so - ;; - os2*) - libname_spec='$name' - shlibext=dll - ;; - osf3* | osf4* | osf5*) - shlibext=so - 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" - ;; - sco3.2v5*) - shlibext=so - ;; - solaris*) - shlibext=so - ;; - sunos4*) - shlibext=so - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - shlibext=so - case "$host_vendor" in - motorola) - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - uts4*) - shlibext=so - ;; - dgux*) - shlibext=so - ;; - sysv4*MP*) - if test -d /usr/nec; then - shlibext=so - fi - ;; -esac - -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' -escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` - -sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF - -# How to pass a linker flag through the compiler. -wl="$escaped_wl" - -# Static library suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally "so"). -shlibext="$shlibext" - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator="$hardcode_libdir_separator" - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct="$hardcode_direct" - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L="$hardcode_minus_L" - -# Compile-time system search path for libraries -sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec" - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec" - -EOF diff --git a/config/config.sub b/config/config.sub index 1dea9b79..6759825a 100644 --- a/config/config.sub +++ b/config/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2002-09-05' +timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +22,15 @@ timestamp='2002-09-05' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to <config-patches@gnu.org>. Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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." @@ -83,11 +85,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +101,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +120,9 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +148,7 @@ case $os in -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) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +173,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +193,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -228,14 +240,17 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -244,25 +259,33 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -273,6 +296,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -292,20 +318,20 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ - | clipper-* | cydra-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -314,29 +340,43 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39 | mipstx39el \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -353,6 +393,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -367,6 +410,12 @@ case $basic_machine in basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -398,6 +447,14 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; c90) basic_machine=c90-cray os=-unicos @@ -426,12 +483,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -454,6 +526,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -604,6 +680,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -619,6 +703,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -632,10 +720,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -648,6 +732,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -723,9 +810,12 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -743,6 +833,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -752,24 +850,36 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; @@ -802,6 +912,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -828,6 +942,14 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -835,6 +957,12 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -901,10 +1029,6 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; t3e) basic_machine=alphaev5-cray os=-unicos @@ -913,14 +1037,22 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -934,6 +1066,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -977,9 +1113,9 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt + xbox) + basic_machine=i686-pc + os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell @@ -1011,6 +1147,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1027,13 +1166,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1106,18 +1242,23 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1129,16 +1270,21 @@ case $os in ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1151,6 +1297,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1172,6 +1321,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1194,6 +1346,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1224,6 +1379,15 @@ case $os in -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1246,6 +1410,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1255,6 +1425,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1280,6 +1453,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1298,9 +1474,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1433,9 +1615,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1460,7 +1648,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/config/depcomp b/config/depcomp index 368e3be9..e5f9736c 100644 --- a/config/depcomp +++ b/config/depcomp @@ -1,7 +1,10 @@ #! /bin/sh - # depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2007-03-29.01 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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 @@ -15,8 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -25,22 +28,45 @@ # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. +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 outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + 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 -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -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" @@ -66,7 +92,20 @@ 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. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" +## 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 -eq 0; then : else @@ -172,31 +211,43 @@ sgi) aix) # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. 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. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" + # 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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 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 -eq 0; then : else - rm -f "$tmpdepfile" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -206,38 +257,136 @@ aix) rm -f "$tmpdepfile" ;; +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + 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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + 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 -eq 0; then : + else + 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + tru64) - # The Tru64 AIX compiler uses -MD to generate dependencies as a side + # 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 + # 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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - base=`echo "$object" | sed -e 's/\.o$/.d/' -e 's/\.lo$/.d/'` - tmpdepfile1="$base.o.d" - tmpdepfile2="$base.d" if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # 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.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -250,34 +399,42 @@ tru64) dashmstdout) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--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 - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + 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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' @@ -295,33 +452,37 @@ dashXmstdout) ;; makedepend) - # X makedepend - ( - shift - cleared=no - for arg in "$@"; do - case $cleared in no) - set ""; shift - cleared=yes - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + 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. + -*|$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" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' @@ -334,35 +495,40 @@ makedepend) cpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--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 - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" @@ -372,49 +538,27 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, + # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; - *) + *) set fnord "$@" "$arg" shift shift ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" @@ -434,3 +578,12 @@ none) esac exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in index f5377b0e..55be54c3 100644 --- a/config/elfutils.spec.in +++ b/config/elfutils.spec.in @@ -1,24 +1,24 @@ -%define gpl 0 -Summary: A collection of utilities and DSOs to handle compiled objects. +# -*- rpm-spec-*- +Summary: A collection of utilities and DSOs to handle compiled objects Name: elfutils Version: @PACKAGE_VERSION@ Release: 1 -Copyright: OSL +License: GPLv2 with exceptions Group: Development/Tools -#URL: file://home/devel/drepper/ -Source: elfutils-%{version}.tar.gz +Source: elfutils-%{version}.tar.bz2 Obsoletes: libelf libelf-devel Requires: elfutils-libelf = %{version}-%{release} -%if %{gpl} -Requires: binutils >= 2.14.90.0.4-26.2 -%endif +Requires: glibc >= 2.7 # ExcludeArch: xxx BuildRoot: %{_tmppath}/%{name}-root -BuildRequires: gcc >= 3.2 +BuildRequires: gcc >= 4.1.2-33 +BuildRequires: glibc >= 2.7 BuildRequires: bison >= 1.875 BuildRequires: flex >= 2.5.4a +BuildRequires: bzip2 +BuildRequires: m4 %define _gnu %{nil} %define _programprefix eu- @@ -35,7 +35,6 @@ handling. %package devel Summary: Development libraries to handle compiled objects. Group: Development/Tools -Copyright: OSL Requires: elfutils = %{version}-%{release} Requires: elfutils-libelf-devel = %{version}-%{release} @@ -46,12 +45,18 @@ higher-level ELF access functionality. libdw provides access to the DWARF debugging information. libasm provides a programmable assembler interface. +%package devel-static +Summary: Static archives to handle compiled objects. +Group: Development/Tools +Requires: elfutils-devel = %{version}-%{release} + +%description devel-static +The elfutils-devel-static archive contains the static archives +with the code the handle compiled objects. + %package libelf Summary: Library to read and write ELF files. Group: Development/Tools -%if %{gpl} -Copyright: GPL -%endif %description libelf The elfutils-libelf package provides a DSO which allows reading and @@ -64,9 +69,6 @@ Summary: Development support for libelf Group: Development/Tools Requires: elfutils-libelf = %{version}-%{release} Conflicts: libelf-devel -%if %{gpl} -Copyright: GPL -%endif %description libelf-devel The elfutils-libelf-devel package contains the libraries to create @@ -74,51 +76,41 @@ applications for handling compiled objects. libelf allows you to access the internals of the ELF object file format, so you can see the different sections of an ELF file. +%package libelf-devel-static +Summary: Static archive of libelf +Group: Development/Tools +Requires: elfutils-libelf-devel = %{version}-%{release} +Conflicts: libelf-devel + +%description libelf-devel-static +The elfutils-libelf-static package contains the static archive +for libelf. + %prep %setup -q %build -mkdir build-%{_target_platform} -cd build-%{_target_platform} -../configure \ - --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ - --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ - --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} \ - --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ - --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ - --infodir=%{_infodir} --program-prefix=%{_programprefix} --enable-shared -cd .. +%configure --program-prefix=%{_programprefix} +make %install rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_prefix} -cd build-%{_target_platform} -#make check %makeinstall chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* -%if !%{gpl} chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.so* -%endif -cd .. - -%if !%{gpl} # XXX Nuke unpackaged files { cd ${RPM_BUILD_ROOT} rm -f .%{_bindir}/eu-ld rm -f .%{_includedir}/elfutils/libasm.h - rm -f .%{_includedir}/elfutils/libdw.h - rm -f .%{_libdir}/libasm-%{version}.so + rm -f .%{_libdir}/libasm.so rm -f .%{_libdir}/libasm.a - rm -f .%{_libdir}/libdw.so - rm -f .%{_libdir}/libdw.a } -%endif %check -cd build-%{_target_platform} make check %clean @@ -135,52 +127,296 @@ rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root) %doc README TODO -%if %{gpl} -%doc fake-src/FULL -%endif %{_bindir}/eu-elflint %{_bindir}/eu-nm %{_bindir}/eu-readelf %{_bindir}/eu-size %{_bindir}/eu-strip -%if !%{gpl} +%{_bindir}/eu-findtextrel +%{_bindir}/eu-addr2line +%{_bindir}/eu-elfcmp +%{_bindir}/eu-ranlib +%{_bindir}/eu-strings +%{_bindir}/eu-objdump +%{_bindir}/eu-ar +%{_bindir}/eu-unstrip +%{_bindir}/eu-make-debug-archive #%{_bindir}/eu-ld -#%{_libdir}/libasm-%{version}.so +%{_libdir}/libasm-%{version}.so %{_libdir}/libdw-%{version}.so -#%{_libdir}/libasm*.so.* -%{_libdir}/libdw*.so.* +%{_libdir}/libasm.so.* +%{_libdir}/libdw.so.* %dir %{_libdir}/elfutils %{_libdir}/elfutils/lib*.so -%endif %files devel %defattr(-,root,root) %{_includedir}/dwarf.h %dir %{_includedir}/elfutils %{_includedir}/elfutils/elf-knowledge.h -%if !%{gpl} +#%{_includedir}/elfutils/libasm.h %{_includedir}/elfutils/libebl.h -#%{_libdir}/libasm.a +%{_includedir}/elfutils/libdw.h +%{_includedir}/elfutils/libdwfl.h %{_libdir}/libebl.a -#%{_libdir}/libdw.a #%{_libdir}/libasm.so -#%{_libdir}/libdw.so -%endif +%{_libdir}/libdw.so + +%files devel-static +%{_libdir}/libdw.a +#%{_libdir}/libasm.a %files libelf %defattr(-,root,root) %{_libdir}/libelf-%{version}.so -%{_libdir}/libelf*.so.* +%{_libdir}/libelf.so.* %files libelf-devel %defattr(-,root,root) %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h -%{_libdir}/libelf.a %{_libdir}/libelf.so +%files libelf-devel-static +%{_libdir}/libelf.a + %changelog +* Wed Dec 31 2008 Roland McGrath <roland@redhat.com> 0.138-1 +- Install <elfutils/version.h> header file for applications to use in + source version compatibility checks. +- libebl: backend fixes for i386 TLS relocs; backend support for + NT_386_IOPERM +- libcpu: disassembler fixes +- libdwfl: bug fixes +- libelf: bug fixes +- nm: bug fixes for handling corrupt input files + +* Tue Aug 26 2008 Ulrich Drepper <drepper@redhat.com> 0.137-1 +- Minor fixes for unreleased 0.136 release. + +* Mon Aug 25 2008 Ulrich Drepper <drepper@redhat.com> 0.136-1 +- libdwfl: bug fixes; new segment interfaces; all the libdwfl-based + tools now support --core=COREFILE option + +* Mon May 12 2008 Ulrich Drepper <drepper@redhat.com> 0.135-1 +- libdwfl: bug fixes +- strip: changed handling of ET_REL files wrt symbol tables and relocs + +* Tue Apr 8 2008 Ulrich Drepper <drepper@redhat.com> 0.134-1 +- elflint: backend improvements for sparc, alpha +- libdwfl, libelf: bug fixes + +* Sat Mar 1 2008 Ulrich Drepper <drepper@redhat.com> 0.133-1 +- readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling (readelf -A) +- readelf: core note handling for NT_386_TLS, NT_PPC_SPE, Alpha NT_AUXV +- libdwfl: bug fixes and optimization in relocation handling +- elfcmp: bug fix for non-allocated section handling +- ld: implement newer features of binutils linker. + +* Mon Jan 21 2008 Ulrich Drepper <drepper@redhat.com> 0.132-1 +- libcpu: Implement x86 and x86-64 disassembler. +- libasm: Add interface for disassembler. +- all programs: add debugging of branch prediction. +- libelf: new function elf_scnshndx. + +* Sun Nov 11 2007 Ulrich Drepper <drepper@redhat.com> 0.131-1 +- libdw: DW_FORM_ref_addr support; dwarf_formref entry point now depreca +ted; bug fixes for oddly-formatted DWARF +- libdwfl: bug fixes in offline archive support, symbol table handling; + apply partial relocations for dwfl_module_address_section on +ET_REL +- libebl: powerpc backend support for Altivec registers + +* Mon Oct 15 2007 Ulrich Drepper <drepper@redhat.com> 0.130-1 +- readelf: -p option can take an argument like -x for one section, + or no argument (as before) for all SHF_STRINGS sections; + new option --archive-index (or -c); improved -n output fo +r core files, on many machines +- libelf: new function elf_getdata_rawchunk, replaces gelf_rawchunk; + new functions gelf_getnote, gelf_getauxv, gelf_update_auxv +- readelf, elflint: handle SHT_NOTE sections without requiring phdrs +- elflint: stricter checks on debug sections +- libdwfl: new functions dwfl_build_id_find_elf, dwfl_build_id_find_debu +ginfo, dwfl_module_build_id, dwfl_module_report_build_id; suppo +rt dynamic symbol tables found via phdrs; dwfl_standard_find_de +buginfo now uses build IDs when available +- unstrip: new option --list (or -n) +- libebl: backend improvements for sparc, alpha, powerpc + +* Tue Aug 14 2007 Ulrich Drepper <drepper@redhat.com> 0.129-1 +- readelf: new options --hex-dump (or -x), --strings (or -p) +- addr2line: new option --symbols (or -S) + +* Wed Apr 18 2007 Ulrich Drepper <drepper@redhat.com> 0.127-1 +- libdw: new function dwarf_getsrcdirs +- libdwfl: new functions dwfl_module_addrsym, dwfl_report_begin_add, + dwfl_module_address_section + +* Mon Feb 5 2007 Ulrich Drepper <drepper@redhat.com> 0.126-1 +- new program: ar + +* Mon Dec 18 2006 Ulrich Drepper <drepper@redhat.com> 0.125-1 +- elflint: Compare DT_GNU_HASH tests. +- move archives into -static RPMs +- libelf, elflint: better support for core file handling + +* Tue Oct 10 2006 Ulrich Drepper <drepper@redhat.com> 0.124-1 +- libebl: sparc backend support for return value location +- libebl, libdwfl: backend register name support extended with more info +- libelf, libdw: bug fixes for unaligned accesses on machines that care +- readelf, elflint: trivial bugs fixed + +* Mon Aug 14 2006 Roland McGrath <roland@redhat.com> 0.123-1 +- libebl: Backend build fixes, thanks to Stepan Kasal. +- libebl: ia64 backend support for register names, return value location +- libdwfl: Handle truncated linux kernel module section names. +- libdwfl: Look for linux kernel vmlinux files with .debug suffix. +- elflint: Fix checks to permit --hash-style=gnu format. + +* Wed Jul 12 2006 Ulrich Drepper <drepper@redhat.com> 0.122-1 +- libebl: add function to test for relative relocation +- elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks +- elflint, readelf: add support for DT_GNU_HASHlibelf: add elf_gnu_hash +- elflint, readelf: add support for 64-bit SysV-style hash tables +- libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym. + +* Wed Jun 14 2006 <drepper@redhat.com> 0.121-1 +- libelf: bug fixes for rewriting existing files when using mmap. +- make all installed headers usable in C++ code. +- readelf: better output format. +- elflint: fix tests of dynamic section content. +- ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patc +hes. +- libdw, libdwfl: handle files without aranges info. + +* Tue Apr 4 2006 Ulrich Drepper <drepper@redhat.com> 0.120-1 +- Bug fixes. +- dwarf.h updated for DWARF 3.0 final specification. +- libdwfl: New function dwfl_version. +- The license is now GPL for most files. The libelf, libebl, libdw,and +libdwfl libraries have additional exceptions. Add reference toOIN. + +* Thu Jan 12 2006 Roland McGrath <roland@redhat.com> 0.119-1 +- elflint: more tests. +- libdwfl: New function dwfl_module_register_names. +- libebl: New backend hook for register names. + +* Tue Dec 6 2005 Ulrich Drepper <drepper@redhat.com> 0.118-1 +- elflint: more tests. +- libdwfl: New function dwfl_module_register_names. +- libebl: New backend hook for register names. + +* Thu Nov 17 2005 Ulrich Drepper <drepper@redhat.com> 0.117-1 +- libdwfl: New function dwfl_module_return_value_location. +- libebl: Backend improvements for several CPUs. + +* Mon Oct 31 2005 Ulrich Drepper <drepper@redhat.com> 0.116-1 +- libdw: New functions dwarf_ranges, dwarf_entrypc, dwarf_diecu, d +warf_entry_breakpoints. Removed Dwarf_Func type and functions d +warf_func_name, dwarf_func_lowpc, dwarf_func_highpc, dwarf_func_ +entrypc, dwarf_func_die; dwarf_getfuncs callback now uses Dwarf_ +Die, and dwarf_func_file, dwarf_func_line, dwarf_func_col replac +ed by dwarf_decl_file, dwarf_decl_line, dwarf_decl_column; dwarf +_func_inline, dwarf_func_inline_instances now take Dwarf_Die. Ty +pe Dwarf_Loc renamed to Dwarf_Op; dwarf_getloclist, dwarf_addrlo +clists renamed dwarf_getlocation, dwarf_getlocation_addr. + +* Fri Sep 2 2005 Ulrich Drepper <drepper@redhat.com> 0.115-1 +- libelf: speed-ups of non-mmap reading. +- strings: New program. +- Implement --enable-gcov option for configure. +- libdw: New function dwarf_getscopes_die. + +* Wed Aug 24 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1 +- libelf: new function elf_getaroff +- libdw: Added dwarf_func_die, dwarf_func_inline, dwarf_func_inline_inst +ances. +- libdwfl: New functions dwfl_report_offline, dwfl_offline_section_addre +ss, dwfl_linux_kernel_report_offline. +- ranlib: new program + +* Mon Aug 15 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1 +- libelf: new function elf_getaroff +- ranlib: new program + +* Wed Aug 10 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. Allow .rodata +sectionto have STRINGS and MERGE flag set. +- strip: add some more compatibility with binutils. + +* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. Allow .rodata +sectionto have STRINGS and MERGE flag set. + +* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. + +* Fri Aug 5 2005 Ulrich Drepper <@redhat.com> 0.112-1 +- elfcmp: some more relaxation. +- elflint: many more tests, especially regarding to symbol versioning. +- libelf: Add elfXX_offscn and gelf_offscn. +- libasm: asm_begin interface changes. +- libebl: Add three new interfaces to directly access machine, class, an +ddata encoding information. +- objdump: New program. Just the beginning. + +* Thu Jul 28 2005 Ulrich Drepper <@redhat.com> 0.111-1 +- libdw: now contains all of libdwfl. The latter is not installed anymore. +- elfcmp: little usability tweak, name and index of differing section is + printed. + +* Sun Jul 24 2005 Ulrich Drepper <@redhat.com> 0.110-1 +- libelf: fix a numbe rof problems with elf_update +- elfcmp: fix a few bugs. Compare gaps. +- Fix a few PLT problems and mudflap build issues. +- libebl: Don't expose Ebl structure definition in libebl.h. It's now p +rivate. + +* Thu Jul 21 2005 Ulrich Drepper <@redhat.com> 0.109-1 +- libebl: Check for matching modules. +- elflint: Check that copy relocations only happen for OBJECT or NOTYPE +symbols. +- elfcmp: New program. +- libdwfl: New library. + +* Mon May 9 2005 Ulrich Drepper <@redhat.com> 0.108-1 +- strip: fix bug introduced in last change +- libdw: records returned by dwarf_getsrclines are now sorted by address + +* Sun May 8 2005 Ulrich Drepper <@redhat.com> 0.108-1 +- strip: fix bug introduced in last change + +* Sun May 8 2005 Ulrich Drepper <@redhat.com> 0.107-1 +- readelf: improve DWARF output format +- strip: support Linux kernel modules + +* Fri Apr 29 2005 Ulrich Drepper <drepper@redhat.com> 0.107-1 +- readelf: improve DWARF output format + +* Mon Apr 4 2005 Ulrich Drepper <drepper@redhat.com> 0.106-1 +- libdw: Updated dwarf.h from DWARF3 speclibdw: add new funtions dwarf_f +unc_entrypc, dwarf_func_file, dwarf_func_line,dwarf_func_col, dwarf_ge +tsrc_file + +* Fri Apr 1 2005 Ulrich Drepper <drepper@redhat.com> 0.105-1 +- addr2line: New program +- libdw: add new functions: dwarf_addrdie, dwarf_macro_*, dwarf_getfuncs +,dwarf_func_*. +- findtextrel: use dwarf_addrdie + +* Mon Mar 28 2005 Ulrich Drepper <drepper@redhat.com> 0.104-1 +- findtextrel: New program. + +* Mon Mar 21 2005 Ulrich Drepper <drepper@redhat.com> 0.103-1 +- libdw: Fix using libdw.h with gcc < 4 and C++ code. Compiler bug. + +* Tue Feb 22 2005 Ulrich Drepper <drepper@redhat.com> 0.102-1 +- More Makefile and spec file cleanups. + * Fri Jan 16 2004 Jakub Jelinek <jakub@redhat.com> 0.94-1 - upgrade to 0.94 diff --git a/config/install-sh b/config/install-sh index 398a88e1..a5897de6 100644 --- a/config/install-sh +++ b/config/install-sh @@ -1,251 +1,519 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2006-12-25.00 + +# 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. # -# Copyright 1991 by the Massachusetts Institute of Technology +# 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. # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# +# 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. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. +nl=' +' +IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec else - : + doit_exec=$doit fi -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else +# 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_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. +src= +dst= +dir_arg= +dst_arg= - if [ -f $src -o -d $src ] - then - : - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - : - fi +copy_on_change=false +no_target_directory= -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - : - fi -fi +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` +Options: + --help display this help and exit. + --version display version info and exit. -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script + -c (ignored) + -C install only if different (preserve the last 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. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-${defaultIFS}}" +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" +while test $# -ne 0; do + case $1 in + -c) ;; -pathcomp='' + -C) copy_on_change=true;; -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift + -d) dir_arg=true;; - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - : - fi + -g) chgrpcmd="$chgrpprog $2" + shift;; - pathcomp="${pathcomp}/" -done -fi + --help) echo "$usage"; exit $?;; -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi -else + -o) chowncmd="$chownprog $2" + shift;; -# If we're going to rename the final executable, determine the name now. + -s) stripcmd=$stripprog;; - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi + -t) dst_arg=$2 + shift;; -# don't allow the sed command to completely eliminate the filename + -T) no_target_directory=true;; - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - : - fi - -# Make a temp file name in the proper directory. + --version) echo "$0 $scriptversion"; exit $?;; - dsttmp=$dstdir/#inst.$$# + --) shift + break;; -# Move or copy the file name to the temp name + -*) echo "$0: invalid option: $1" >&2 + exit 1;; - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && + *) break;; + esac + shift +done -# and set any options; do chmod last to preserve setuid bits +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 + done +fi -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. +if 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 [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 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 -# Now rename the file to the real destination. +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + 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 + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # 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 -fi && + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or 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 + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && 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=$dstdir/_inst.$$_ + rmtmp=$dstdir/_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 && $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` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # 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 -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$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 -exit 0 +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/missing b/config/missing index dd583709..1c8ff704 100644 --- a/config/missing +++ b/config/missing @@ -1,6 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -15,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -29,6 +33,8 @@ if test $# -eq 0; then fi run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -38,18 +44,24 @@ else configure_ac=configure.in fi -case "$1" in +msg="missing on your system" + +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -67,6 +79,7 @@ Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -74,11 +87,15 @@ Supported PROGRAM values: lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" + echo "missing $scriptversion (GNU Automake)" + exit $? ;; -*) @@ -87,14 +104,44 @@ Supported PROGRAM values: exit 1 ;; - aclocal*) +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 fi + ;; +esac +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -102,13 +149,8 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -116,13 +158,8 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -130,7 +167,7 @@ WARNING: \`$1' is missing on your system. You should only need it if test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -140,13 +177,8 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -156,20 +188,15 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU + You can get \`$1' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else @@ -185,74 +212,67 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your bison|yacc) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then touch $file else test -z "$file" || exec >$file @@ -262,54 +282,58 @@ WARNING: \`$1' is missing on your system. You should only need it if ;; makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 touch $file ;; tar) shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 + gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 + gtar "$@" && exit 0 fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac fi @@ -323,10 +347,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments. *) echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing + it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 @@ -334,3 +358,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your esac exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/mkinstalldirs b/config/mkinstalldirs deleted file mode 100644 index e1666cfb..00000000 --- a/config/mkinstalldirs +++ /dev/null @@ -1,101 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 2004/01/18 07:34:34 drepper Exp $ - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here diff --git a/config/version.h.in b/config/version.h.in new file mode 100644 index 00000000..82c846e9 --- /dev/null +++ b/config/version.h.in @@ -0,0 +1,58 @@ +/* Version information about elfutils development libraries. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _ELFUTILS_VERSION_H +#define _ELFUTILS_VERSION_H 1 + +#define _ELFUTILS_VERSION @eu_version@ + +#define _ELFUTILS_PREREQ(major, minor) \ + (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) + +#endif /* elfutils/version.h */ diff --git a/config/ylwrap b/config/ylwrap new file mode 100755 index 00000000..7278b6a3 --- /dev/null +++ b/config/ylwrap @@ -0,0 +1,223 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2007-11-22.22 + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, +# 2007 Free Software Foundation, Inc. +# +# Written by Tom Tromey <tromey@cygnus.com>. +# +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input="$1" +shift +case "$input" in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input="`pwd`/$input" + ;; +esac + +pairlist= +while test "$#" -ne 0; do + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift +done + +# The program to run. +prog="$1" +shift +# Make any relative path in $prog absolute. +case "$prog" in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; +esac + +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) "$prog" "$input" ;; + *) "$prog" "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # We do not want to overwrite a header file if it hasn't + # changed. This avoid useless recompilations. However the + # parser itself (the first file) should always be updated, + # because it is the destination of the .y.c rule in the + # Makefile. Divert the output of all other files to a temporary + # file so we can compare them to existing versions. + if test $first = no; then + realtarget="$target" + target="tmp-`echo $target | sed s/.*[\\/]//g`" + fi + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + + sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ + -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? + + # Check whether header files must be updated. + if test $first = no; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$2" is unchanged + rm -f "$target" + else + echo updating "$2" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + ret=1 + fi + fi + shift + shift + first=no + done +else + ret=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: @@ -1,30 +1,86 @@ #! /bin/sh -# From configure.ac Revision: 1.30 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Red Hat elfutils 0.97. +# Generated by GNU Autoconf 2.63 for Red Hat elfutils 0.138. # # Report bugs to <http://bugzilla.redhat.com/bugzilla/>. # -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright (C) 1996-2003, 2004 Red Hat, Inc. +# Copyright (C) 1996-2007, 2008 Red Hat, Inc. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +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 -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -34,33 +90,60 @@ else fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +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 +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -68,157 +151,391 @@ fi # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# CDPATH. +$as_unset CDPATH -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. fi +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in + case $as_dir in /*) - if ("$as_dir/$as_base" -c ' + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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 + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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 + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( as_lineno_1=$LINENO as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -if expr a : '\(a\)' >/dev/null 2>&1; then +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +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=: @@ -227,7 +544,28 @@ else as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -236,53 +574,198 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH +exec 7<&0 </dev/null 6>&1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - # Identity of this package. PACKAGE_NAME='Red Hat elfutils' PACKAGE_TARNAME='elfutils' -PACKAGE_VERSION='0.97' -PACKAGE_STRING='Red Hat elfutils 0.97' +PACKAGE_VERSION='0.138' +PACKAGE_STRING='Red Hat elfutils 0.138' PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/' ac_unique_file="libelf/libelf.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE USE_NLS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu MUDFLAP_TRUE MUDFLAP_FALSE LIBOBJS LTLIBOBJS' +ac_subst_vars='LTLIBOBJS +LIBOBJS +eu_version +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +USE_NLS +STANDALONE_FALSE +STANDALONE_TRUE +HAVE_LIBASM_FALSE +HAVE_LIBASM_TRUE +LIBEBL_SUBDIR +TESTS_RPATH_FALSE +TESTS_RPATH_TRUE +BUILD_STATIC_FALSE +BUILD_STATIC_TRUE +GCOV_FALSE +GCOV_TRUE +GPROF_FALSE +GPROF_TRUE +DEBUGPRED +MUDFLAP_FALSE +MUDFLAP_TRUE +NEVER_FALSE +NEVER_TRUE +base_cpu +NATIVE_LD_FALSE +NATIVE_LD_TRUE +DATADIRNAME +LOCALEDIR +LEXLIB +LEX_OUTPUT_ROOT +LEX +YFLAGS +YACC +RANLIB +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +USE_TLS_FALSE +USE_TLS_TRUE +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +MODVERSION +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +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 +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_tls +enable_dependency_tracking +enable_largefile +enable_generic +enable_mudflap +enable_debugpred +enable_gprof +enable_gcov +enable_tests_rpath +enable_libebl_subdir +enable_nls +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +YACC +YFLAGS' + # 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 @@ -305,34 +788,48 @@ x_libraries=NONE # 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' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +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" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -354,33 +851,61 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$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_feature='$ac_optarg'" ;; + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -407,6 +932,12 @@ do -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 ;; @@ -431,13 +962,16 @@ do | --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 | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -502,6 +1036,16 @@ do | --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 ;; @@ -552,26 +1096,38 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$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_package='$ac_optarg'" ;; + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$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. @@ -591,7 +1147,7 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -600,17 +1156,16 @@ Try \`$0 --help' for more information." >&2 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; @@ -619,31 +1174,39 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac -done +fi -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# 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 do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var + # Remove trailing slashes. case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + */ ) + 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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -657,7 +1220,7 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes @@ -670,74 +1233,76 @@ 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_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + # 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 || +$as_echo 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 + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } - fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP + 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. @@ -746,7 +1311,7 @@ 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 Red Hat elfutils 0.97 to adapt to many kinds of systems. +\`configure' configures Red Hat elfutils 0.138 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -766,14 +1331,11 @@ Configuration: -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -_ACEOF - - cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -783,18 +1345,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --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] + --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/elfutils] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -812,160 +1381,134 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Red Hat elfutils 0.97:";; + short | recursive ) echo "Configuration of Red Hat elfutils 0.138:";; 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-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer --enable-tls enable use of thread local storage --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --disable-nls do not use Native Language Support --disable-largefile omit support for large files --disable-generic do not build generic linker --enable-mudflap build binaries with mudflap instrumentation - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld default=no - --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib - --without-libiconv-prefix don't search for libiconv in includedir and libdir - --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib - --without-libintl-prefix don't search for libintl in includedir and libdir + --enable-debugpred build binaries with support to debug branch + prediction + --enable-gprof build binaries with gprof support + --enable-gcov build binaries with gcov support + --enable-tests-rpath build $ORIGIN-using rpath into tests + --enable-libebl-subdir=DIR + install libebl_CPU modules in $(libdir)/DIR + --disable-nls do not use Native Language Support Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> - CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have - headers in a nonstandard directory <include dir> - CPP C preprocessor + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. 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 <http://bugzilla.redhat.com/bugzilla/>. _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$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 - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + 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 - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" + $as_echo "$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 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Red Hat elfutils configure 0.97 -generated by GNU Autoconf 2.59 +Red Hat elfutils configure 0.138 +generated by GNU Autoconf 2.63 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (C) 1996-2003, 2004 Red Hat, Inc. +Copyright (C) 1996-2007, 2008 Red Hat, Inc. _ACEOF - exit 0 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF +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 Red Hat elfutils $as_me 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was +It was created by Red Hat elfutils $as_me 0.138, which was +generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF +exec 5>>config.log { cat <<_ASUNAME ## --------- ## @@ -984,7 +1527,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/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` @@ -996,8 +1539,9 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" + $as_echo "PATH: $as_dir" done +IFS=$as_save_IFS } >&5 @@ -1019,7 +1563,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1030,8 +1573,8 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; @@ -1052,9 +1595,7 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done @@ -1065,8 +1606,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_ # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# 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=$? # Save into config.log some information that might help in debugging. { @@ -1079,20 +1620,35 @@ trap 'exit_status=$? _ASBOX 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_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$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= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + 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" - ;; + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo cat <<\_ASBOX @@ -1103,22 +1659,28 @@ _ASBOX echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## +## ------------------- ## +## File substitutions. ## +## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1130,26 +1692,24 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h # Predefined preprocessor variables. @@ -1179,18 +1739,24 @@ _ACEOF # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi @@ -1200,54 +1766,61 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do +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" + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # 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 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$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=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1257,19 +1830,15 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - @@ -1294,41 +1863,52 @@ 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 ac_aux_dir= -for ac_dir in config $srcdir/config; do - if test -f $ac_dir/install-sh; then +for ac_dir in config "$srcdir"/config; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} { (exit 1); exit 1; }; } fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - ac_config_files="$ac_config_files config/Makefile" +# 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. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +ac_config_files="$ac_config_files config/Makefile" -am__api_version="1.9" + +am__api_version='1.10' + # 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: @@ -1342,11 +1922,12 @@ am__api_version="1.9" # 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. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -1365,7 +1946,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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. @@ -1375,30 +1956,43 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + 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+set}" = set; then INSTALL=$ac_cv_path_install else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will + # 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 path is relative. + # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -1408,8 +2002,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file @@ -1432,9 +2026,9 @@ if ( # 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". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi @@ -1445,26 +2039,23 @@ then # Ok. : else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! +$as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" + 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 $. echo might interpret backslashes. + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. # By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` @@ -1475,51 +2066,66 @@ if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + '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 + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" else - mkdir_p='$(install_sh) -d' + # 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. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi fi +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. @@ -1530,54 +2136,58 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$AWK" && break done -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF +SHELL = /bin/sh all: - @echo 'ac_maketemp="$(MAKE)"' + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi +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 \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -1590,12 +2200,16 @@ else fi rmdir .tst 2>/dev/null -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} +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_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } + fi fi # test whether we have cygpath @@ -1610,7 +2224,7 @@ fi # Define the identity of the package. PACKAGE='elfutils' - VERSION='0.97' + VERSION='0.138' cat >>confdefs.h <<_ACEOF @@ -1638,7 +2252,7 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right @@ -1648,10 +2262,10 @@ 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. @@ -1662,34 +2276,36 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. @@ -1700,33 +2316,43 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi - STRIP=$ac_ct_STRIP + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$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="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. @@ -1740,94 +2366,159 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi - ac_config_files="$ac_config_files Makefile" + MAINT=$MAINTAINER_MODE_TRUE - ac_config_headers="$ac_config_headers config.h" -case m4 in - [\\/]* | ?:[\\/]* ) ac_macro_dir=m4 ;; - *) ac_macro_dir=$srcdir/m4 ;; -esac -if test -d "$ac_macro_dir"; then : -else - { { echo "$as_me:$LINENO: error: cannot find macro directory \`m4'" >&5 -echo "$as_me: error: cannot find macro directory \`m4'" >&2;} - { (exit 1); exit 1; }; } -fi +MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)" + +cat >>confdefs.h <<_ACEOF +#define MODVERSION "$MODVERSION" +_ACEOF + + - ac_config_files="$ac_config_files m4/Makefile" - ac_config_files="$ac_config_files elfutils.spec:config/elfutils.spec.in" +ac_config_files="$ac_config_files Makefile" + +ac_config_headers="$ac_config_headers config.h" + + + +ac_config_files="$ac_config_files m4/Makefile" + + +ac_config_files="$ac_config_files elfutils.spec:config/elfutils.spec.in" # Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + $as_echo_n "(cached) " >&6 +else + 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 +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 + + +{ $as_echo "$as_me:$LINENO: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + $as_echo_n "(cached) " >&6 +else + 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } +fi fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +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 -# Check whether --enable-tls or --disable-tls was given. +# Check whether --enable-tls was given. if test "${enable_tls+set}" = set; then - enableval="$enable_tls" + enableval=$enable_tls; use_tls=yes +else + use_tls=no +fi + + if test "$use_tls" = yes; then + USE_TLS_TRUE= + USE_TLS_FALSE='#' +else + USE_TLS_TRUE='#' + USE_TLS_FALSE= +fi + +if test "$use_tls" = yes; then cat >>confdefs.h <<\_ACEOF #define USE_TLS 1 _ACEOF -fi; +fi + + @@ -1841,10 +2532,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1855,34 +2546,36 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1893,38 +2586,49 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$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. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1935,76 +2639,36 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2016,17 +2680,18 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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. @@ -2044,24 +2709,25 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2072,38 +2738,40 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2114,58 +2782,90 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF @@ -2184,111 +2884,150 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +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. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out + # 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 | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. + *.$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;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext + if test "${ac_cv_exeext+set}" = set && 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 - echo "$as_me: failed program was:" >&5 + ac_file='' +fi + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables +$as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } + { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 -# Check the compiler produces executables we can run. If not, either +# Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. +$as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi fi fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either +# Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +$as_echo_n "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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -2297,32 +3036,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2340,39 +3080,48 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + 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 ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2393,49 +3142,54 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2451,37 +3205,121 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_prog_cc_g=no + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2497,12 +3335,12 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2536,12 +3374,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* 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 don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as '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's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's 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);}; @@ -2556,201 +3399,58 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include <stdlib.h> -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2758,7 +3458,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" - ac_config_commands="$ac_config_commands depfiles" +ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} @@ -2768,8 +3468,8 @@ am__doit: .PHONY: am__doit END # If we don't find an include directive, just comment out the code. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none @@ -2796,22 +3496,20 @@ if test "$am__include" = "#"; then fi -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } rm -f confinc confmf -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +# Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" + enableval=$enable_dependency_tracking; +fi -fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi - - -if test "x$enable_dependency_tracking" != xno; then + if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else @@ -2821,13 +3519,12 @@ fi - depcc="$CC" am_compiler_list= -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up @@ -2889,6 +3586,7 @@ else depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -2914,13 +3612,11 @@ else fi fi -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - -if + if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= @@ -2931,1829 +3627,13 @@ else fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sgtty.h> -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 - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <termio.h> -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 -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - - - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - rm -f messages.po - - # Extract the first word of "msgmerge", so it can be a program name with args. -set dummy msgmerge; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGMERGE" in - /*) - ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGMERGE="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" - ;; -esac -fi -MSGMERGE="$ac_cv_path_MSGMERGE" -if test "$MSGMERGE" != ":"; then - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - rm -f messages.po - fi - - ac_config_commands="$ac_config_commands default-1" - - - - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&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. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path 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 "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$acl_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - -fi -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" - sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" - - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='iconv ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "X$found_dir" = "X/usr/lib"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" - ;; - esac - done - fi - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" - done - fi - - - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - LIBINTL= - LTLIBINTL= - POSUB= - - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - - - - - - - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 - - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - - - - - - am_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCICONV; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <iconv.h> -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <iconv.h> -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ICONV 1 -_ACEOF - - fi - if test "$am_cv_lib_iconv" = yes; then - echo "$as_me:$LINENO: checking how to link with libiconv" >&5 -echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBICONV" >&5 -echo "${ECHO_T}$LIBICONV" >&6 - else - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libintl-prefix or --without-libintl-prefix was given. -if test "${with_libintl_prefix+set}" = set; then - withval="$with_libintl_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBINTL= - LTLIBINTL= - INCINTL= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='intl ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "X$found_dir" = "X/usr/lib"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" - ;; - esac - done - fi - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" - done - fi - - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <libintl.h> -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - gt_use_preinstalled_gnugettext=yes - else - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define ENABLE_NLS 1 -_ACEOF - - else - USE_NLS=no - fi - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - echo "$as_me:$LINENO: checking how to link with libintl" >&5 -echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBINTL" >&5 -echo "${ECHO_T}$LIBINTL" >&6 - - for element in $INCINTL; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - fi - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETTEXT 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DCGETTEXT 1 -_ACEOF - - fi - - POSUB=po - fi - - - - INTLLIBS="$LIBINTL" - - - - - - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -4764,34 +3644,36 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$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 - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -4802,27 +3684,37 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi - RANLIB=$ac_ct_RANLIB + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$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 @@ -4831,10 +3723,10 @@ for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -4845,37 +3737,40 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 + { $as_echo "$as_me:$LINENO: result: $YACC" >&5 +$as_echo "$YACC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" + for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. @@ -4886,250 +3781,191 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 + { $as_echo "$as_me:$LINENO: result: $LEX" >&5 +$as_echo "$LEX" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$LEX" && break done test -n "$LEX" || LEX=":" -if test -z "$LEXLIB" -then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +if test "x$LEX" != "x:"; then + cat >conftest.l <<_ACEOF +%% +a { ECHO; } +b { REJECT; } +c { yymore (); } +d { yyless (1); } +e { yyless (input () != 0); } +f { unput (yytext[0]); } +. { BEGIN INITIAL; } +%% +#ifdef YYTEXT_POINTER +extern char *yytext; #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); int -main () +main (void) { -yywrap (); - ; - return 0; + return ! yylex () + ! yywrap (); } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +{ (ac_try="$LEX conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$LEX conftest.l") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5 +$as_echo_n "checking lex output file root... " >&6; } +if test "${ac_cv_prog_lex_root+set}" = set; then + $as_echo_n "(cached) " >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_fl_yywrap=no +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +$as_echo "$ac_cv_prog_lex_root" >&6; } +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +if test -z "${LEXLIB+set}"; then + { $as_echo "$as_me:$LINENO: checking lex library" >&5 +$as_echo_n "checking lex library... " >&6; } +if test "${ac_cv_lib_lex+set}" = set; then + $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} + ac_save_LIBS=$LIBS + ac_cv_lib_lex='none needed' + for ac_lib in '' -lfl -ll; do + LIBS="$ac_lib $ac_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +`cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_lex=$ac_lib +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi fi -fi +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + test "$ac_cv_lib_lex" != 'none needed' && break + done + LIBS=$ac_save_LIBS -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5 +$as_echo "$ac_cv_lib_lex" >&6; } + test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 + +{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +$as_echo_n "checking whether yytext is a pointer... " >&6; } if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since +# default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" +LIBS="$LEXLIB $ac_save_LIBS" cat >conftest.$ac_ext <<_ACEOF +#define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_prog_lex_yytext_pointer=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext \ + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF @@ -5137,16 +3973,17 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi +rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi -echo "$as_me:$LINENO: checking for gcc with C99 support" >&5 -echo $ECHO_N "checking for gcc with C99 support... $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for gcc with C99 support" >&5 +$as_echo_n "checking for gcc with C99 support... " >&6; } if test "${ac_cv_c99+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -std=gnu99" @@ -5154,41 +3991,39 @@ cat >conftest.$ac_ext <<_ACEOF int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c99=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c99=no + ac_cv_c99=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$old_CFLAGS" fi -echo "$as_me:$LINENO: result: $ac_cv_c99" >&5 -echo "${ECHO_T}$ac_cv_c99" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c99" >&5 +$as_echo "$ac_cv_c99" >&6; } if test "x$ac_cv_c99" != xyes; then - { { echo "$as_me:$LINENO: error: gcc with C99 support required" >&5 -echo "$as_me: error: gcc with C99 support required" >&2;} + { { $as_echo "$as_me:$LINENO: error: gcc with C99 support required" >&5 +$as_echo "$as_me: error: gcc with C99 support required" >&2;} { (exit 1); exit 1; }; } fi @@ -5205,24 +4040,24 @@ _ACEOF DATADIRNAME=$datadir -# Check whether --enable-largefile or --disable-largefile was given. +# Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" + enableval=$enable_largefile; +fi -fi; if test "$enable_largefile" != no; then - echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 -echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 + { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else 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. + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5246,82 +4081,79 @@ main () return 0; } _ACEOF - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 + rm -f conftest.$ac_objext +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then break else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 + +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi -echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 -echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi - echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 + { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else while :; do - ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5346,33 +4178,32 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_file_offset_bits=no; break +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5398,53 +4229,54 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; break else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown break done fi -echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 -echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 -if test "$ac_cv_sys_file_offset_bits" != no; then - +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF - -fi -rm -f conftest* - echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 -echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if test "${ac_cv_sys_large_files+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else while :; do - ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5469,33 +4301,32 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_large_files=no; break +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5521,54 +4352,55 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; break else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown break done fi -echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 -echo "${ECHO_T}$ac_cv_sys_large_files" >&6 -if test "$ac_cv_sys_large_files" != no; then - +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF - -fi -rm -f conftest* +;; +esac +rm -rf conftest* + fi fi native_ld=no -# Check whether --enable-generic or --disable-generic was given. +# Check whether --enable-generic was given. if test "${enable_generic+set}" = set; then - enableval="$enable_generic" - if test "$enable_generic" = no; then + enableval=$enable_generic; if test "$enable_generic" = no; then case "$host_cpu" in i?86) cat >>confdefs.h <<\_ACEOF @@ -5579,18 +4411,17 @@ _ACEOF base_cpu=i386 ;; *) - { { echo "$as_me:$LINENO: error: no machine-specific linker for this configuration available" >&5 -echo "$as_me: error: no machine-specific linker for this configuration available" >&2;} + { { $as_echo "$as_me:$LINENO: error: no machine-specific linker for this configuration available" >&5 +$as_echo "$as_me: error: no machine-specific linker for this configuration available" >&2;} { (exit 1); exit 1; }; } ;; esac fi -fi; - +fi -if test "$native_ld" = yes; then + if test "$native_ld" = yes; then NATIVE_LD_TRUE= NATIVE_LD_FALSE='#' else @@ -5603,12 +4434,19 @@ if test -z "$base_cpu"; then fi + if false; then + NEVER_TRUE= + NEVER_FALSE='#' +else + NEVER_TRUE='#' + NEVER_FALSE= +fi + use_mudflap=no -# Check whether --enable-mudflap or --disable-mudflap was given. +# Check whether --enable-mudflap was given. if test "${enable_mudflap+set}" = set; then - enableval="$enable_mudflap" - if test "x$enable_mudflap" = xyes; then + enableval=$enable_mudflap; if test "x$enable_mudflap" = xyes; then # Check whether the compiler support -fmudflap. old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fmudflap" @@ -5628,47 +4466,46 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then use_mudflap=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -use_mudflap=fail + use_mudflap=fail fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$old_CFLAGS" fi -fi; +fi + if test "$use_mudflap" = fail; then - { { echo "$as_me:$LINENO: error: --enable-mudflap requires a compiler which understands this option + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: --enable-mudflap requires a compiler which understands this option See \`config.log' for more details." >&5 -echo "$as_me: error: --enable-mudflap requires a compiler which understands this option +$as_echo "$as_me: error: --enable-mudflap requires a compiler which understands this option See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { (exit 1); exit 1; }; }; } fi - - -if test "$use_mudflap" = yes; then + if test "$use_mudflap" = yes; then MUDFLAP_TRUE= MUDFLAP_FALSE='#' else @@ -5677,38 +4514,457 @@ else fi +use_debugpred=0 +# Check whether --enable-debugpred was given. +if test "${enable_debugpred+set}" = set; then + enableval=$enable_debugpred; use_debugpred=1 +else + use_debugpred=0 +fi + +DEBUGPRED=$use_debugpred + + +# Check whether --enable-gprof was given. +if test "${enable_gprof+set}" = set; then + enableval=$enable_gprof; use_gprof=yes +else + use_gprof=no +fi + +if test "$use_gprof" = yes; then + CFLAGS="$CFLAGS -pg" + LDFLAGS="$LDFLAGS -pg" +fi + if test "$use_gprof" = yes; then + GPROF_TRUE= + GPROF_FALSE='#' +else + GPROF_TRUE='#' + GPROF_FALSE= +fi + + +# Enable gcov suport. +# Check whether --enable-gcov was given. +if test "${enable_gcov+set}" = set; then + enableval=$enable_gcov; use_gcov=yes +else + use_gcov=no +fi + +if test "$use_gcov" = yes; then + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + LDFLAGS="$LDFLAGS -fprofile-arcs" +fi + if test "$use_gcov" = yes; then + GCOV_TRUE= + GCOV_FALSE='#' +else + GCOV_TRUE='#' + GCOV_FALSE= +fi + + + if test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes; then + BUILD_STATIC_TRUE= + BUILD_STATIC_FALSE='#' +else + BUILD_STATIC_TRUE='#' + BUILD_STATIC_FALSE= +fi + + +# Check whether --enable-tests-rpath was given. +if test "${enable_tests_rpath+set}" = set; then + enableval=$enable_tests_rpath; tests_use_rpath=yes +else + tests_use_rpath=no +fi + + if test "$tests_use_rpath" = yes; then + TESTS_RPATH_TRUE= + TESTS_RPATH_FALSE='#' +else + TESTS_RPATH_TRUE='#' + TESTS_RPATH_FALSE= +fi + + +LIBEBL_SUBDIR="$PACKAGE" +# Check whether --enable-libebl-subdir was given. +if test "${enable_libebl_subdir+set}" = set; then + enableval=$enable_libebl_subdir; LIBEBL_SUBDIR="$enable_libebl_subdir" +fi + + +cat >>confdefs.h <<_ACEOF +#define LIBEBL_SUBDIR "$LIBEBL_SUBDIR" +_ACEOF + + + + + + +ac_config_files="$ac_config_files lib/Makefile" + + +ac_config_files="$ac_config_files libelf/Makefile" + + +ac_config_files="$ac_config_files libebl/Makefile" + + +ac_config_files="$ac_config_files libdw/Makefile" + + +ac_config_files="$ac_config_files libdwfl/Makefile" + + +ac_config_files="$ac_config_files libcpu/Makefile" + + + if true; then + HAVE_LIBASM_TRUE= + HAVE_LIBASM_FALSE='#' +else + HAVE_LIBASM_TRUE='#' + HAVE_LIBASM_FALSE= +fi +ac_config_files="$ac_config_files libasm/Makefile" + + +ac_config_files="$ac_config_files backends/Makefile" + + +ac_config_files="$ac_config_files src/Makefile po/Makefile.in" + + + if false; then + STANDALONE_TRUE= + STANDALONE_FALSE='#' +else + STANDALONE_TRUE='#' + STANDALONE_FALSE= +fi +ac_config_files="$ac_config_files tests/Makefile" + + +# Get the definitions necessary to create the Makefiles in the po +# subdirectories. This is a small subset of the gettext rules. +USE_NLS=yes + + + { $as_echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MSGFMT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:$LINENO: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_GMSGFMT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac - ac_config_files="$ac_config_files doc/Makefile" + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac - ac_config_files="$ac_config_files lib/Makefile" +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_XGETTEXT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po - ac_config_files="$ac_config_files libelf/Makefile libelf-po/Makefile.in" + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac - ac_config_files="$ac_config_files libebl/Makefile" +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi - ac_config_files="$ac_config_files libdw/Makefile" +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MSGMERGE+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi - ac_config_files="$ac_config_files libcpu/Makefile" + test -n "$localedir" || localedir='${datadir}/locale' - ac_config_files="$ac_config_files libasm/Makefile" + ac_config_commands="$ac_config_commands po-directories" - ac_config_files="$ac_config_files src/Makefile po/Makefile.in" - ac_config_files="$ac_config_files tests/Makefile" +ac_config_files="$ac_config_files version.h:config/version.h.in" +case $PACKAGE_VERSION in +0.???) eu_version=${PACKAGE_VERSION#0.} ;; +?.???) eu_version=${PACKAGE_VERSION/./} ;; +?.??) eu_version=${PACKAGE_VERSION/./}0 ;; +?.?) eu_version=${PACKAGE_VERSION/./}00 ;; +*) { { $as_echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 +$as_echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} + { (exit 1); exit 1; }; } ;; +esac cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5728,39 +4984,59 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# 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_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$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= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) + 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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -5769,73 +5045,123 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$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. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${USE_TLS_TRUE}" && test -z "${USE_TLS_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"USE_TLS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"USE_TLS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NATIVE_LD_TRUE}" && test -z "${NATIVE_LD_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"NATIVE_LD\" was never defined. + { { $as_echo "$as_me:$LINENO: error: conditional \"NATIVE_LD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"NATIVE_LD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${NEVER_TRUE}" && test -z "${NEVER_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"NEVER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"NATIVE_LD\" was never defined. +$as_echo "$as_me: error: conditional \"NEVER\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MUDFLAP_TRUE}" && test -z "${MUDFLAP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MUDFLAP\" was never defined. + { { $as_echo "$as_me:$LINENO: error: conditional \"MUDFLAP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MUDFLAP\" was never defined. +$as_echo "$as_me: error: conditional \"MUDFLAP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GPROF_TRUE}" && test -z "${GPROF_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"GPROF\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"GPROF\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GCOV_TRUE}" && test -z "${GCOV_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"GCOV\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"GCOV\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BUILD_STATIC_TRUE}" && test -z "${BUILD_STATIC_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_STATIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"BUILD_STATIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${TESTS_RPATH_TRUE}" && test -z "${TESTS_RPATH_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"TESTS_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"TESTS_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_LIBASM_TRUE}" && test -z "${HAVE_LIBASM_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LIBASM\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"HAVE_LIBASM\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${STANDALONE_TRUE}" && test -z "${STANDALONE_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"STANDALONE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"STANDALONE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -5848,22 +5174,78 @@ ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +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 -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -5873,33 +5255,60 @@ else fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +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 +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -5907,159 +5316,122 @@ fi # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi +# CDPATH. +$as_unset CDPATH - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -if expr a : '\(a\)' >/dev/null 2>&1; then +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +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=: @@ -6068,7 +5440,28 @@ else as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -6077,31 +5470,14 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 -# Open the log real soon, to keep \$[0] and so on meaningful, and to +# 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. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by Red Hat elfutils $as_me 0.97, which was -generated by GNU Autoconf 2.59. Invocation command line was +# values after options handling. +ac_log=" +This file was extended by Red Hat elfutils $as_me 0.138, which was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6109,45 +5485,45 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_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" -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, 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 + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -6159,83 +5535,84 @@ Configuration commands: $config_commands Report bugs to <bug-autoconf@gnu.org>." -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Red Hat elfutils config.status 0.97 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +Red Hat elfutils config.status 0.138 +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +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_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + $as_echo "$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. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; esac shift @@ -6249,61 +5626,76 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "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 + $as_echo "$ac_log" +} >&5 -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # -# INIT-COMMANDS section. +# INIT-COMMANDS # - AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" -# Capture the value of obsolete $ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'ALL_LINGUAS''="$ALL_LINGUAS"' +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; - "elfutils.spec" ) CONFIG_FILES="$CONFIG_FILES elfutils.spec:config/elfutils.spec.in" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "libelf/Makefile" ) CONFIG_FILES="$CONFIG_FILES libelf/Makefile" ;; - "libelf-po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES libelf-po/Makefile.in" ;; - "libebl/Makefile" ) CONFIG_FILES="$CONFIG_FILES libebl/Makefile" ;; - "libdw/Makefile" ) CONFIG_FILES="$CONFIG_FILES libdw/Makefile" ;; - "libcpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES libcpu/Makefile" ;; - "libasm/Makefile" ) CONFIG_FILES="$CONFIG_FILES libasm/Makefile" ;; - "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + case $ac_config_target in + "config/Makefile") CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "elfutils.spec") CONFIG_FILES="$CONFIG_FILES elfutils.spec:config/elfutils.spec.in" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "libelf/Makefile") CONFIG_FILES="$CONFIG_FILES libelf/Makefile" ;; + "libebl/Makefile") CONFIG_FILES="$CONFIG_FILES libebl/Makefile" ;; + "libdw/Makefile") CONFIG_FILES="$CONFIG_FILES libdw/Makefile" ;; + "libdwfl/Makefile") CONFIG_FILES="$CONFIG_FILES libdwfl/Makefile" ;; + "libcpu/Makefile") CONFIG_FILES="$CONFIG_FILES libcpu/Makefile" ;; + "libasm/Makefile") CONFIG_FILES="$CONFIG_FILES libasm/Makefile" ;; + "backends/Makefile") CONFIG_FILES="$CONFIG_FILES backends/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "version.h") CONFIG_FILES="$CONFIG_FILES version.h:config/version.h.in" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -6315,748 +5707,642 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. +# 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 || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") } || { - echo "$me: cannot create a temporary directory in ." >&2 + $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } +# 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='
' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/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 {' >"$tmp/subs1.awk" && _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -# -# CONFIG_FILES section. -# +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t -s,@XGETTEXT@,$XGETTEXT,;t t -s,@MSGMERGE@,$MSGMERGE,;t t -s,@USE_NLS@,$USE_NLS,;t t -s,@LIBICONV@,$LIBICONV,;t t -s,@LTLIBICONV@,$LTLIBICONV,;t t -s,@INTLLIBS@,$INTLLIBS,;t t -s,@LIBINTL@,$LIBINTL,;t t -s,@LTLIBINTL@,$LTLIBINTL,;t t -s,@POSUB@,$POSUB,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@YACC@,$YACC,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@LOCALEDIR@,$LOCALEDIR,;t t -s,@DATADIRNAME@,$DATADIRNAME,;t t -s,@NATIVE_LD_TRUE@,$NATIVE_LD_TRUE,;t t -s,@NATIVE_LD_FALSE@,$NATIVE_LD_FALSE,;t t -s,@base_cpu@,$base_cpu,;t t -s,@MUDFLAP_TRUE@,$MUDFLAP_TRUE,;t t -s,@MUDFLAP_FALSE@,$MUDFLAP_FALSE,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + 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 >>"\$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 +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi +} +{ + 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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +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 >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; + +# 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_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + 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 +' <confdefs.h | sed ' +s/'"$ac_delim"'/"\\\ +"/g' >>$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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; + :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$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 '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + 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 || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo 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" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$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 || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo 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 ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } - ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$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 - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + 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 -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + case $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$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 - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } +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= - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi +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@*) + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$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 -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub + +# 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 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +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 "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } -# -# CONFIG_HEADER section. -# +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + rm -f "$tmp/stdin" case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #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. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in + ;; + :H) + # + # CONFIG_HEADER + # if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } fi else - cat $tmp/config.h - rm -f $tmp/config.h + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } fi -# Compute $ac_file's index in $config_headers. +# 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 - $ac_file | $ac_file:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac +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 || +$as_echo 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 + ;; -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. @@ -7064,20 +6350,32 @@ echo "$as_me: executing $ac_dest commands" >&6;} # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` else continue fi @@ -7099,49 +6397,76 @@ echo X"$mf" | sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || + fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$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 || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo 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 ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } - # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; - default-1 ) + "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in @@ -7161,35 +6486,52 @@ done /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then + if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= - GMOFILES= UPDATEPOFILES= DUMMYPOFILES= + GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. @@ -7224,7 +6566,7 @@ done done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in @@ -7237,17 +6579,21 @@ done ;; esac done ;; + esac -done -_ACEOF +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -7269,4 +6615,8 @@ if test "$no_create" != yes; then # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi diff --git a/configure.ac b/configure.ac index e153737f..25804a8b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ -dnl Process this file with autoconf to produce a configure script. -*-m4-*- -dnl Configure input file for elfutils. +dnl Process this file with autoconf to produce a configure script. +dnl Configure input file for elfutils. -*-autoconf-*- dnl -dnl Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc. +dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. 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 @@ -14,19 +14,26 @@ 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, write to the Free Software Foundation, -dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. dnl -AC_INIT([Red Hat elfutils],[0.97],[http://bugzilla.redhat.com/bugzilla/], +AC_INIT([Red Hat elfutils],[0.138],[http://bugzilla.redhat.com/bugzilla/], [elfutils]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_FILES([config/Makefile]) -AC_COPYRIGHT([Copyright (C) 1996-2003, 2004 Red Hat, Inc.]) -AC_REVISION($Revision: 1.30 $) +AC_COPYRIGHT([Copyright (C) 1996-2007, 2008 Red Hat, Inc.]) AC_PREREQ(2.59) dnl Minimum Autoconf version required. -AM_INIT_AUTOMAKE([gnits 1.7 dist-bzip2]) +dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. +AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip]) +AM_MAINTAINER_MODE + +dnl Unique ID for this build. +MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)" +AC_SUBST([MODVERSION]) +AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION") +AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.]) AC_CONFIG_SRCDIR([libelf/libelf.h]) AC_CONFIG_FILES([Makefile]) @@ -43,16 +50,16 @@ AC_CANONICAL_HOST AC_ARG_ENABLE([tls], AS_HELP_STRING([--enable-tls], [enable use of thread local storage]), -AC_DEFINE(USE_TLS)) +use_tls=yes, use_tls=no) +AM_CONDITIONAL(USE_TLS, test "$use_tls" = yes) +AS_IF([test "$use_tls" = yes], [AC_DEFINE(USE_TLS)]) + AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.]) dnl Add all the languages for which translations are available. ALL_LINGUAS= AC_PROG_CC -AC_PROG_CPP -AC_PROG_GCC_TRADITIONAL -AM_GNU_GETTEXT([external]) AC_PROG_RANLIB AC_PROG_YACC AM_PROG_LEX @@ -106,6 +113,9 @@ dnl of files if at any time there is no such file, even if the filename dnl would not be used. AS_IF([test -z "$base_cpu"], [base_cpu=none]) AC_SUBST(base_cpu) +dnl Support to work around automake's inflexible dependency generation. +dnl See src/Makefile.am for more information. +AM_CONDITIONAL(NEVER, false) dnl Enable debugging via mudflap. This option will cause most libraries dnl to be built as archives which are statically linked into the applications. @@ -127,17 +137,62 @@ if test "$use_mudflap" = fail; then fi AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes) +dnl enable debugging of branch prediction. +use_debugpred=0 +AC_ARG_ENABLE([debugpred], +AC_HELP_STRING([--enable-debugpred], +[build binaries with support to debug branch prediction]), +[use_debugpred=1], [use_debugpred=0]) +AC_SUBST([DEBUGPRED], $use_debugpred) + +dnl Enable gprof suport. +AC_ARG_ENABLE([gprof], +AC_HELP_STRING([--enable-gprof], +[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no]) +if test "$use_gprof" = yes; then + CFLAGS="$CFLAGS -pg" + LDFLAGS="$LDFLAGS -pg" +fi +AM_CONDITIONAL(GPROF, test "$use_gprof" = yes) + +# Enable gcov suport. +AC_ARG_ENABLE([gcov], +AC_HELP_STRING([--enable-gcov], +[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no]) +if test "$use_gcov" = yes; then + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + LDFLAGS="$LDFLAGS -fprofile-arcs" +fi +AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) + +AM_CONDITIONAL(BUILD_STATIC, [dnl +test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes]) + +AC_ARG_ENABLE([tests-rpath], +AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]), + [tests_use_rpath=yes], [tests_use_rpath=no]) +AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes) + +LIBEBL_SUBDIR="$PACKAGE" +AC_ARG_ENABLE([libebl-subdir], +AS_HELP_STRING([--enable-libebl-subdir=DIR], +[install libebl_CPU modules in $(libdir)/DIR]), [dnl +LIBEBL_SUBDIR="$enable_libebl_subdir"]) +AC_SUBST([LIBEBL_SUBDIR]) +AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") +AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) dnl The directories with content. dnl Documentation. -AC_CONFIG_FILES([doc/Makefile]) +dnl Commented out for now. +dnl AC_CONFIG_FILES([doc/Makefile]) dnl Support library. AC_CONFIG_FILES([lib/Makefile]) dnl ELF library. -AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in]) +AC_CONFIG_FILES([libelf/Makefile]) dnl Higher-level ELF support library. AC_CONFIG_FILES([libebl/Makefile]) @@ -145,109 +200,44 @@ AC_CONFIG_FILES([libebl/Makefile]) dnl DWARF library. AC_CONFIG_FILES([libdw/Makefile]) +dnl Higher-level DWARF support library. +AC_CONFIG_FILES([libdwfl/Makefile]) + dnl CPU handling library. AC_CONFIG_FILES([libcpu/Makefile]) dnl Assembler library. +AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see. AC_CONFIG_FILES([libasm/Makefile]) +dnl CPU-specific backend libraries. +AC_CONFIG_FILES([backends/Makefile]) + dnl Tools. AC_CONFIG_FILES([src/Makefile po/Makefile.in]) dnl Test suite. +AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. AC_CONFIG_FILES([tests/Makefile]) - -dnl Test of the config.h file. We hide all kinds of configuration magic -dnl in there. -AH_BOTTOM([ -/* Eventually we will allow multi-threaded applications to use the - libraries. Therefore we will add the necessary locking although - the macros used expand to nothing for now. */ -#define lock_lock(lock) ((void) (lock)) -#define rwlock_define(class,name) class int name -#define rwlock_init(lock) ((void) (lock)) -#define rwlock_fini(lock) ((void) (lock)) -#define rwlock_rdlock(lock) ((void) (lock)) -#define rwlock_wrlock(lock) ((void) (lock)) -#define rwlock_unlock(lock) ((void) (lock)) -#define tls_key_t void * -#define key_create(keyp, freefct) (1) -#define getspecific(key) key -#define setspecific(key,val) key = val -#define once_define(class,name) class int name -#define once_execute(name,fct) \ - do { \ - if (name == 0) \ - fct (); \ - name = 1; \ - } while (0) - -/* gettext helper macro. */ -#define N_(Str) Str - -/* Compiler-specific definitions. */ -#define strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -#ifdef __i386__ -# define internal_function_def __attribute__ ((regparm (3), stdcall)) -#else -# define internal_function_def /* nothing */ -#endif - -# define internal_function \ - internal_function_def __attribute__ ((visibility ("internal"))) -# define internal_strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def; - -#define attribute_hidden \ - __attribute__ ((visibility ("hidden"))) - -/* Define ALLOW_UNALIGNED if the architecture allows operations on - unaligned memory locations. */ -#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__ -# define ALLOW_UNALIGNED 1 -#else -# define ALLOW_UNALIGNED 0 -#endif - -#define unlikely(expr) __builtin_expect (expr, 0) -#define likely(expr) __builtin_expect (expr, 1) - -#define obstack_calloc(ob, size) \ - ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) -#define obstack_strdup(ob, str) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) -#define obstack_strndup(ob, str, n) \ - ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) - -#if __STDC_VERSION__ >= 199901L -# define flexarr_size /* empty */ -#else -# define flexarr_size 0 -#endif - -/* Calling conventions. */ -#ifdef __i386__ -# define CALLING_CONVENTION regparm (3), stdcall -# define AND_CALLING_CONVENTION , regparm (3), stdcall -#else -# define CALLING_CONVENTION -# define AND_CALLING_CONVENTION -#endif - -/* Avoid PLT entries. */ -#ifdef PIC -# define INTUSE(name) _INTUSE(name) -# define _INTUSE(name) __##name##_internal -# define INTDEF(name) _INTDEF(name) -# define _INTDEF(name) \ - extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); -#else -# define INTUSE(name) name -# define INTDEF(name) /* empty */ -#endif -]) +# Get the definitions necessary to create the Makefiles in the po +# subdirectories. This is a small subset of the gettext rules. +AC_SUBST(USE_NLS, yes) +AM_PO_SUBDIRS + +dnl Appended to the config.h file. +dnl We hide all kinds of configuration magic in lib/eu-config.h. +AH_BOTTOM([#include <eu-config.h>]) + +dnl Version compatibility header. +AC_CONFIG_FILES([version.h:config/version.h.in]) +AC_SUBST([eu_version]) +case $PACKAGE_VERSION in +0.???) eu_version=${PACKAGE_VERSION#0.} ;; +?.???) eu_version=${PACKAGE_VERSION/./} ;; +?.??) eu_version=${PACKAGE_VERSION/./}0 ;; +?.?) eu_version=${PACKAGE_VERSION/./}00 ;; +*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; +esac AC_OUTPUT diff --git a/doc/ChangeLog b/doc/ChangeLog deleted file mode 100644 index c46ffcb6..00000000 --- a/doc/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2003-08-11 Ulrich Drepper <drepper@redhat.com> - - * Moved to CVS archive. diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index acdf1111..00000000 --- a/doc/Makefile +++ /dev/null @@ -1,319 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# doc/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -EXTRA_DIST = elfutils.sgml -CLEANFILES = elfutils.dvi -all: all-am - -.SUFFIXES: -$(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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits doc/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - - -# We need only a few special rules to generate the various output formats -# from the SGML sources. -.PHONY: dvi pdf html -dvi: $(srcdir)elfutils.dvi -pdf: $(srcdir)elfutils.pdf - -$(srcdir)%.dvi: %.sgml - db2dvi $^ -$(srcdir)%.pdf: %.sgml - db2pdf $^ -# 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/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index b9f0e15f..00000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -## Process this file with automake to create Makefile.in -## Configure input file for elfutils. -## -## Copyright (C) 1996-2001, 2002 Red Hat, Inc. -## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. -## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. */ -## -EXTRA_DIST = elfutils.sgml - -CLEANFILES = elfutils.dvi - -# We need only a few special rules to generate the various output formats -# from the SGML sources. -.PHONY: dvi pdf html -dvi: $(srcdir)elfutils.dvi -pdf: $(srcdir)elfutils.pdf - -$(srcdir)%.dvi: %.sgml - db2dvi $^ -$(srcdir)%.pdf: %.sgml - db2pdf $^ diff --git a/doc/Makefile.in b/doc/Makefile.in deleted file mode 100644 index cefcf9fd..00000000 --- a/doc/Makefile.in +++ /dev/null @@ -1,319 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GMSGFMT = @GMSGFMT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -base_cpu = @base_cpu@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -EXTRA_DIST = elfutils.sgml -CLEANFILES = elfutils.dvi -all: all-am - -.SUFFIXES: -$(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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits doc/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - - -# We need only a few special rules to generate the various output formats -# from the SGML sources. -.PHONY: dvi pdf html -dvi: $(srcdir)elfutils.dvi -pdf: $(srcdir)elfutils.pdf - -$(srcdir)%.dvi: %.sgml - db2dvi $^ -$(srcdir)%.pdf: %.sgml - db2pdf $^ -# 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/doc/elfutils.sgml b/doc/elfutils.sgml deleted file mode 100644 index 7ef84a8d..00000000 --- a/doc/elfutils.sgml +++ /dev/null @@ -1,412 +0,0 @@ -<!doctype book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[ -<!ENTITY package "<filename>new-bu</filename>"> -]> - -<book> - <title>New Binutils User's and Reference Manual</title> - - <chapter> - <title><filename>libelf</filename> <acronym>ABI</acronym></title> - - <simpara>The <acronym>ABI</acronym> of the - <filename>libelf</filename> implemented in the &package; package - is following that of Sun's implementation which in turn in derived - from the original SysVr4 implementation. There are some - extensions over Sun's versions, though, which makes it impossible - to replace this implementation with Sun's.</simpara> - - <beginpage> - - <refentry xreflabel="Elf_Data" id="ElfUData"> - <refnamediv> - <refname>Elf_Data</refname> - <refpurpose>Descriptor for Data Buffer</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <synopsis> -#include <libelf.h> -</synopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <simpara>The <structname>Elf_Data</structname> structure is as - a descriptor for a data buffer associated with a section. - Every data buffer is associated with a specific section (see - <!-- xref --><structname>Elf_Scn</structname>).</simpara> - - <simpara>A data buffer is created when reading a file. In - this case only a single buffer is present in the section. The - user can add as many sections as wanted to a section and they - can be retrieved using the <function>elf_getdata</function> - and <function>elf_rawdata</function> functions.<!-- xref - --></simpara> - - <simpara>The <structname>Elf_Data</structname> structure - contains the following members:</simpara> - - <programlisting> - void *d_buf - Elf_Type d_type - size_t d_size - off_t d_off - size_t d_align - unsigned int d_version -</programlisting> - - <simpara>All these members can be modified directly by the - user. They can be used to resize a section, to change its - content or type, and many things more. This is also true for - the data read from a file. The meaning of the members is as - follows:</simpara> - - <variablelist> - <varlistentry> - <term><structfield>d_buf</structfield></term> - <listitem> - <simpara>The <structfield>d_buf</structfield> member is - the pointer to the buffer with the actual data. When - the ELF file was read from a file the first and only - data buffer of a section is allocated by the - <filename>libelf</filename> library. The user should - not try to resize or free this buffer. When the user - adds a new data buffer to a section the associated - memory block is normally allocated by the user. It is - important that the buffer must have a lifetime at least - until the ELF file is closed entirely (important when - the buffer is allocated on the stack). If the buffer is - not allocated on the stack it is the user's - responsibility to free the buffer after it is not used - anymore. The <structfield>d_buf</structfield> member - can contain a null pointer if the data buffer is - empty.</simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>d_type</structfield></term> - <listitem> - <simpara>The <structfield>d_type</structfield> - determines how the data of the buffer is interpreted. - This type is determined from the section type and must - be the same for all data buffers for a section. See - <!-- xref --><type>Elf_Type</type> for more information. - The <function><link linkend="elfUgetdata" - endterm="elfUgetdata.refname"></link></function> - function uses this information to convert the data of - the buffer between the external form and the form - represented to the user and back if necessary.</simpara> - </listitem> - </varlistentry> - </variablelist> - </refsect1> - </refentry> - - <beginpage> - - <refentry id="elfUgetdata"> - <refnamediv> - <refname id="elfUgetdata.refname">elf_getdata</refname> - <refpurpose>Get washed data of section</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <funcsynopsis> - <funcsynopsisinfo> -#include <libelf.h> -</funcsynopsisinfo> - <funcprototype> - <funcdef>Elf_Data *<function>elf_getdata</function></funcdef> - <paramdef>Elf_Scn *<parameter>scn</parameter></paramdef> - <paramdef>Elf_Data *<parameter>data</parameter></paramdef> - </funcprototype> - </funcsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <simpara>The <function>elf_getdata</function> function allows - to retriece the data buffers of the section - <parameter>scn</parameter>. There can be more than one buffer - if the user explicitly added them. When a file is read the - <filename>libelf</filename> library creates exactly one data - buffer.</simpara> - - <simpara>The first buffer in the list can be obtained by - passing a null pointer in the parameter - <parameter>data</parameter>. To get the next data buffer the - previously returned value must be passed in the - <parameter>data</parameter> parameter. If there is no more - buffer left in the list a null pointer is returned.</simpara> - - <simpara>If the <parameter>data</parameter> parameter is not a - null pointer it must be a descriptor with for a buffer - associated with the section <parameter>scn</parameter>. If - this is not the case a null pointer is returned. To - facilitate error handling <function>elf_getdata</function> - also returns a null pointer if the <parameter>scn</parameter> - parameter is a null pointer.</simpara> - </refsect1> - </refentry> - - <refentry> - <refnamediv> - <refname id="elfUupdate.refname">elf_update</refname> - <refpurpose>update an ELF descriptor</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <funcsynopsis> - <funcsynopsisinfo> -#include <libelf.h> -</funcsynopsisinfo> - <funcprototype> - <funcdef>off_t <function>elf_update</function></funcdef> - <paramdef>Elf *<parameter>elf</parameter></paramdef> - <paramdef>Elf_Cmd <parameter>cmd</parameter></paramdef> - </funcprototype> - </funcsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <simpara>The user is responsible for filling in the following - fields in the named data structures:</simpara> - - <table> - <title>Fields not set by <function>elf_update</function></title> - <tgroup cols="3"> - <colspec colwidth="90pt"> - <colspec colwidth="110pt"> - <thead> - <row> - <entry>Data Structure</entry> - <entry>Member</entry> - <entry>Exception</entry> - </row> - </thead> - <tbody> - <row> - <entry morerows="8"><type>Elfxx_Ehdr</type></entry> - <entry>e_ident[EI_DATA]</entry> - <entry>see below</entry> - </row> - <row> - <entry></entry> - <entry>e_type</entry> - <!-- <entry morerows="1"></entry> --> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>e_machine</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>e_version</entry> - <entry>see below</entry> - </row> - <row> - <entry></entry> - <entry>e_entry</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>e_phoff</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>e_shoff</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>e_flags</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>e_shstrndx</entry> - <entry></entry> - </row> - <row> - <entry morerows="7">Elfxx_Phdr</entry> - <entry>p_type</entry> - <entry morerows="7"></entry> - </row> - <row> - <entry></entry> - <entry>p_offset</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_vaddr</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_paddr</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_filesz</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_memsz</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_flags</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>p_align</entry> - <entry></entry> - </row> - - <row> - <entry morerows="9">Elfxx_Shdr</entry> - <entry>sh_name</entry> - <entry morerows="3"></entry> - </row> - <row> - <entry></entry> - <entry>sh_type</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>sh_flags</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>sh_addr</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>sh_offset</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>sh_size</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>sh_link</entry> - <!-- <entry morerows="1"></entry> --> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>sh_info</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>sh_addralign</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>sh_entsize</entry> - <entry></entry> - </row> - - <row> - <entry morerows="5">Elf_Data</entry> - <entry>d_buf</entry> - <entry morerows="2"></entry> - </row> - <row> - <entry></entry> - <entry>d_type</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>d_size</entry> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>d_off</entry> - <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> - </row> - <row> - <entry></entry> - <entry>d_align</entry> - <!-- <entry morerows="1"></entry> --> - <entry></entry> - </row> - <row> - <entry></entry> - <entry>d_version</entry> - <entry></entry> - </row> - </tbody> - </tgroup> - </table> - - <simpara>Two fields of the ELF header are handled in a special - way:</simpara> - - <variablelist> - <varlistentry> - <term>e_version</term> - <listitem> - <simpara>The user can set this field to the vvalue for - the version to be used. It is an error if the library - cannot handle this version. If the field contains the - value <symbol>EV_NONE</symbol> the library will fill in - its own internal version.</simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>e_ident[EI_DATA]</term> - <listitem> - <simpara>The user should fill in the byte ordering for - the file. If the value of the field is - <symbol>ELFDATANONE</symbol> the library replaces it - with the native byte ordering for the machine.</simpara> - </listitem> - </varlistentry> - </variablelist> - </refsect1> - </refentry> - </chapter> - - <chapter> - <title><filename>libelf</filename> Internals</title> - - <simpara>Since the binary format handling tools need constant - attention since there are always new machines and varients - therefore coming out it is important to have the implementation - weel documented. Only this way extensions can be made in the - right places and the mistakes of the past avoided.</simpara> - </chapter> -</book> -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omitag:nil -sgml-shorttag:t -End: ---> diff --git a/elfutils.spec b/elfutils.spec index 5db4242e..4aea24e5 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,24 +1,24 @@ -%define gpl 0 -Summary: A collection of utilities and DSOs to handle compiled objects. +# -*- rpm-spec-*- +Summary: A collection of utilities and DSOs to handle compiled objects Name: elfutils -Version: 0.97 +Version: 0.138 Release: 1 -Copyright: OSL +License: GPLv2 with exceptions Group: Development/Tools -#URL: file://home/devel/drepper/ -Source: elfutils-%{version}.tar.gz +Source: elfutils-%{version}.tar.bz2 Obsoletes: libelf libelf-devel Requires: elfutils-libelf = %{version}-%{release} -%if %{gpl} -Requires: binutils >= 2.14.90.0.4-26.2 -%endif +Requires: glibc >= 2.7 # ExcludeArch: xxx BuildRoot: %{_tmppath}/%{name}-root -BuildRequires: gcc >= 3.2 +BuildRequires: gcc >= 4.1.2-33 +BuildRequires: glibc >= 2.7 BuildRequires: bison >= 1.875 BuildRequires: flex >= 2.5.4a +BuildRequires: bzip2 +BuildRequires: m4 %define _gnu %{nil} %define _programprefix eu- @@ -35,7 +35,6 @@ handling. %package devel Summary: Development libraries to handle compiled objects. Group: Development/Tools -Copyright: OSL Requires: elfutils = %{version}-%{release} Requires: elfutils-libelf-devel = %{version}-%{release} @@ -46,12 +45,18 @@ higher-level ELF access functionality. libdw provides access to the DWARF debugging information. libasm provides a programmable assembler interface. +%package devel-static +Summary: Static archives to handle compiled objects. +Group: Development/Tools +Requires: elfutils-devel = %{version}-%{release} + +%description devel-static +The elfutils-devel-static archive contains the static archives +with the code the handle compiled objects. + %package libelf Summary: Library to read and write ELF files. Group: Development/Tools -%if %{gpl} -Copyright: GPL -%endif %description libelf The elfutils-libelf package provides a DSO which allows reading and @@ -64,9 +69,6 @@ Summary: Development support for libelf Group: Development/Tools Requires: elfutils-libelf = %{version}-%{release} Conflicts: libelf-devel -%if %{gpl} -Copyright: GPL -%endif %description libelf-devel The elfutils-libelf-devel package contains the libraries to create @@ -74,51 +76,41 @@ applications for handling compiled objects. libelf allows you to access the internals of the ELF object file format, so you can see the different sections of an ELF file. +%package libelf-devel-static +Summary: Static archive of libelf +Group: Development/Tools +Requires: elfutils-libelf-devel = %{version}-%{release} +Conflicts: libelf-devel + +%description libelf-devel-static +The elfutils-libelf-static package contains the static archive +for libelf. + %prep %setup -q %build -mkdir build-%{_target_platform} -cd build-%{_target_platform} -../configure \ - --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ - --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ - --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} \ - --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ - --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ - --infodir=%{_infodir} --program-prefix=%{_programprefix} --enable-shared -cd .. +%configure --program-prefix=%{_programprefix} +make %install rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_prefix} -cd build-%{_target_platform} -#make check %makeinstall chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* -%if !%{gpl} chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.so* -%endif -cd .. - -%if !%{gpl} # XXX Nuke unpackaged files { cd ${RPM_BUILD_ROOT} rm -f .%{_bindir}/eu-ld rm -f .%{_includedir}/elfutils/libasm.h - rm -f .%{_includedir}/elfutils/libdw.h - rm -f .%{_libdir}/libasm-%{version}.so + rm -f .%{_libdir}/libasm.so rm -f .%{_libdir}/libasm.a - rm -f .%{_libdir}/libdw.so - rm -f .%{_libdir}/libdw.a } -%endif %check -cd build-%{_target_platform} make check %clean @@ -135,52 +127,296 @@ rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root) %doc README TODO -%if %{gpl} -%doc fake-src/FULL -%endif %{_bindir}/eu-elflint %{_bindir}/eu-nm %{_bindir}/eu-readelf %{_bindir}/eu-size %{_bindir}/eu-strip -%if !%{gpl} +%{_bindir}/eu-findtextrel +%{_bindir}/eu-addr2line +%{_bindir}/eu-elfcmp +%{_bindir}/eu-ranlib +%{_bindir}/eu-strings +%{_bindir}/eu-objdump +%{_bindir}/eu-ar +%{_bindir}/eu-unstrip +%{_bindir}/eu-make-debug-archive #%{_bindir}/eu-ld -#%{_libdir}/libasm-%{version}.so +%{_libdir}/libasm-%{version}.so %{_libdir}/libdw-%{version}.so -#%{_libdir}/libasm*.so.* -%{_libdir}/libdw*.so.* +%{_libdir}/libasm.so.* +%{_libdir}/libdw.so.* %dir %{_libdir}/elfutils %{_libdir}/elfutils/lib*.so -%endif %files devel %defattr(-,root,root) %{_includedir}/dwarf.h %dir %{_includedir}/elfutils %{_includedir}/elfutils/elf-knowledge.h -%if !%{gpl} +#%{_includedir}/elfutils/libasm.h %{_includedir}/elfutils/libebl.h -#%{_libdir}/libasm.a +%{_includedir}/elfutils/libdw.h +%{_includedir}/elfutils/libdwfl.h %{_libdir}/libebl.a -#%{_libdir}/libdw.a #%{_libdir}/libasm.so -#%{_libdir}/libdw.so -%endif +%{_libdir}/libdw.so + +%files devel-static +%{_libdir}/libdw.a +#%{_libdir}/libasm.a %files libelf %defattr(-,root,root) %{_libdir}/libelf-%{version}.so -%{_libdir}/libelf*.so.* +%{_libdir}/libelf.so.* %files libelf-devel %defattr(-,root,root) %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h -%{_libdir}/libelf.a %{_libdir}/libelf.so +%files libelf-devel-static +%{_libdir}/libelf.a + %changelog +* Wed Dec 31 2008 Roland McGrath <roland@redhat.com> 0.138-1 +- Install <elfutils/version.h> header file for applications to use in + source version compatibility checks. +- libebl: backend fixes for i386 TLS relocs; backend support for + NT_386_IOPERM +- libcpu: disassembler fixes +- libdwfl: bug fixes +- libelf: bug fixes +- nm: bug fixes for handling corrupt input files + +* Tue Aug 26 2008 Ulrich Drepper <drepper@redhat.com> 0.137-1 +- Minor fixes for unreleased 0.136 release. + +* Mon Aug 25 2008 Ulrich Drepper <drepper@redhat.com> 0.136-1 +- libdwfl: bug fixes; new segment interfaces; all the libdwfl-based + tools now support --core=COREFILE option + +* Mon May 12 2008 Ulrich Drepper <drepper@redhat.com> 0.135-1 +- libdwfl: bug fixes +- strip: changed handling of ET_REL files wrt symbol tables and relocs + +* Tue Apr 8 2008 Ulrich Drepper <drepper@redhat.com> 0.134-1 +- elflint: backend improvements for sparc, alpha +- libdwfl, libelf: bug fixes + +* Sat Mar 1 2008 Ulrich Drepper <drepper@redhat.com> 0.133-1 +- readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling (readelf -A) +- readelf: core note handling for NT_386_TLS, NT_PPC_SPE, Alpha NT_AUXV +- libdwfl: bug fixes and optimization in relocation handling +- elfcmp: bug fix for non-allocated section handling +- ld: implement newer features of binutils linker. + +* Mon Jan 21 2008 Ulrich Drepper <drepper@redhat.com> 0.132-1 +- libcpu: Implement x86 and x86-64 disassembler. +- libasm: Add interface for disassembler. +- all programs: add debugging of branch prediction. +- libelf: new function elf_scnshndx. + +* Sun Nov 11 2007 Ulrich Drepper <drepper@redhat.com> 0.131-1 +- libdw: DW_FORM_ref_addr support; dwarf_formref entry point now depreca +ted; bug fixes for oddly-formatted DWARF +- libdwfl: bug fixes in offline archive support, symbol table handling; + apply partial relocations for dwfl_module_address_section on +ET_REL +- libebl: powerpc backend support for Altivec registers + +* Mon Oct 15 2007 Ulrich Drepper <drepper@redhat.com> 0.130-1 +- readelf: -p option can take an argument like -x for one section, + or no argument (as before) for all SHF_STRINGS sections; + new option --archive-index (or -c); improved -n output fo +r core files, on many machines +- libelf: new function elf_getdata_rawchunk, replaces gelf_rawchunk; + new functions gelf_getnote, gelf_getauxv, gelf_update_auxv +- readelf, elflint: handle SHT_NOTE sections without requiring phdrs +- elflint: stricter checks on debug sections +- libdwfl: new functions dwfl_build_id_find_elf, dwfl_build_id_find_debu +ginfo, dwfl_module_build_id, dwfl_module_report_build_id; suppo +rt dynamic symbol tables found via phdrs; dwfl_standard_find_de +buginfo now uses build IDs when available +- unstrip: new option --list (or -n) +- libebl: backend improvements for sparc, alpha, powerpc + +* Tue Aug 14 2007 Ulrich Drepper <drepper@redhat.com> 0.129-1 +- readelf: new options --hex-dump (or -x), --strings (or -p) +- addr2line: new option --symbols (or -S) + +* Wed Apr 18 2007 Ulrich Drepper <drepper@redhat.com> 0.127-1 +- libdw: new function dwarf_getsrcdirs +- libdwfl: new functions dwfl_module_addrsym, dwfl_report_begin_add, + dwfl_module_address_section + +* Mon Feb 5 2007 Ulrich Drepper <drepper@redhat.com> 0.126-1 +- new program: ar + +* Mon Dec 18 2006 Ulrich Drepper <drepper@redhat.com> 0.125-1 +- elflint: Compare DT_GNU_HASH tests. +- move archives into -static RPMs +- libelf, elflint: better support for core file handling + +* Tue Oct 10 2006 Ulrich Drepper <drepper@redhat.com> 0.124-1 +- libebl: sparc backend support for return value location +- libebl, libdwfl: backend register name support extended with more info +- libelf, libdw: bug fixes for unaligned accesses on machines that care +- readelf, elflint: trivial bugs fixed + +* Mon Aug 14 2006 Roland McGrath <roland@redhat.com> 0.123-1 +- libebl: Backend build fixes, thanks to Stepan Kasal. +- libebl: ia64 backend support for register names, return value location +- libdwfl: Handle truncated linux kernel module section names. +- libdwfl: Look for linux kernel vmlinux files with .debug suffix. +- elflint: Fix checks to permit --hash-style=gnu format. + +* Wed Jul 12 2006 Ulrich Drepper <drepper@redhat.com> 0.122-1 +- libebl: add function to test for relative relocation +- elflint: fix and extend DT_RELCOUNT/DT_RELACOUNT checks +- elflint, readelf: add support for DT_GNU_HASHlibelf: add elf_gnu_hash +- elflint, readelf: add support for 64-bit SysV-style hash tables +- libdwfl: new functions dwfl_module_getsymtab, dwfl_module_getsym. + +* Wed Jun 14 2006 <drepper@redhat.com> 0.121-1 +- libelf: bug fixes for rewriting existing files when using mmap. +- make all installed headers usable in C++ code. +- readelf: better output format. +- elflint: fix tests of dynamic section content. +- ld: Implement --as-needed, --execstack, PT_GNU_STACK. Many small patc +hes. +- libdw, libdwfl: handle files without aranges info. + +* Tue Apr 4 2006 Ulrich Drepper <drepper@redhat.com> 0.120-1 +- Bug fixes. +- dwarf.h updated for DWARF 3.0 final specification. +- libdwfl: New function dwfl_version. +- The license is now GPL for most files. The libelf, libebl, libdw,and +libdwfl libraries have additional exceptions. Add reference toOIN. + +* Thu Jan 12 2006 Roland McGrath <roland@redhat.com> 0.119-1 +- elflint: more tests. +- libdwfl: New function dwfl_module_register_names. +- libebl: New backend hook for register names. + +* Tue Dec 6 2005 Ulrich Drepper <drepper@redhat.com> 0.118-1 +- elflint: more tests. +- libdwfl: New function dwfl_module_register_names. +- libebl: New backend hook for register names. + +* Thu Nov 17 2005 Ulrich Drepper <drepper@redhat.com> 0.117-1 +- libdwfl: New function dwfl_module_return_value_location. +- libebl: Backend improvements for several CPUs. + +* Mon Oct 31 2005 Ulrich Drepper <drepper@redhat.com> 0.116-1 +- libdw: New functions dwarf_ranges, dwarf_entrypc, dwarf_diecu, d +warf_entry_breakpoints. Removed Dwarf_Func type and functions d +warf_func_name, dwarf_func_lowpc, dwarf_func_highpc, dwarf_func_ +entrypc, dwarf_func_die; dwarf_getfuncs callback now uses Dwarf_ +Die, and dwarf_func_file, dwarf_func_line, dwarf_func_col replac +ed by dwarf_decl_file, dwarf_decl_line, dwarf_decl_column; dwarf +_func_inline, dwarf_func_inline_instances now take Dwarf_Die. Ty +pe Dwarf_Loc renamed to Dwarf_Op; dwarf_getloclist, dwarf_addrlo +clists renamed dwarf_getlocation, dwarf_getlocation_addr. + +* Fri Sep 2 2005 Ulrich Drepper <drepper@redhat.com> 0.115-1 +- libelf: speed-ups of non-mmap reading. +- strings: New program. +- Implement --enable-gcov option for configure. +- libdw: New function dwarf_getscopes_die. + +* Wed Aug 24 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1 +- libelf: new function elf_getaroff +- libdw: Added dwarf_func_die, dwarf_func_inline, dwarf_func_inline_inst +ances. +- libdwfl: New functions dwfl_report_offline, dwfl_offline_section_addre +ss, dwfl_linux_kernel_report_offline. +- ranlib: new program + +* Mon Aug 15 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1 +- libelf: new function elf_getaroff +- ranlib: new program + +* Wed Aug 10 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. Allow .rodata +sectionto have STRINGS and MERGE flag set. +- strip: add some more compatibility with binutils. + +* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. Allow .rodata +sectionto have STRINGS and MERGE flag set. + +* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1 +- elflint: relax a bit. Allow version definitions for defined symbols ag +ainstDSO versions also for symbols in nobits sections. + +* Fri Aug 5 2005 Ulrich Drepper <@redhat.com> 0.112-1 +- elfcmp: some more relaxation. +- elflint: many more tests, especially regarding to symbol versioning. +- libelf: Add elfXX_offscn and gelf_offscn. +- libasm: asm_begin interface changes. +- libebl: Add three new interfaces to directly access machine, class, an +ddata encoding information. +- objdump: New program. Just the beginning. + +* Thu Jul 28 2005 Ulrich Drepper <@redhat.com> 0.111-1 +- libdw: now contains all of libdwfl. The latter is not installed anymore. +- elfcmp: little usability tweak, name and index of differing section is + printed. + +* Sun Jul 24 2005 Ulrich Drepper <@redhat.com> 0.110-1 +- libelf: fix a numbe rof problems with elf_update +- elfcmp: fix a few bugs. Compare gaps. +- Fix a few PLT problems and mudflap build issues. +- libebl: Don't expose Ebl structure definition in libebl.h. It's now p +rivate. + +* Thu Jul 21 2005 Ulrich Drepper <@redhat.com> 0.109-1 +- libebl: Check for matching modules. +- elflint: Check that copy relocations only happen for OBJECT or NOTYPE +symbols. +- elfcmp: New program. +- libdwfl: New library. + +* Mon May 9 2005 Ulrich Drepper <@redhat.com> 0.108-1 +- strip: fix bug introduced in last change +- libdw: records returned by dwarf_getsrclines are now sorted by address + +* Sun May 8 2005 Ulrich Drepper <@redhat.com> 0.108-1 +- strip: fix bug introduced in last change + +* Sun May 8 2005 Ulrich Drepper <@redhat.com> 0.107-1 +- readelf: improve DWARF output format +- strip: support Linux kernel modules + +* Fri Apr 29 2005 Ulrich Drepper <drepper@redhat.com> 0.107-1 +- readelf: improve DWARF output format + +* Mon Apr 4 2005 Ulrich Drepper <drepper@redhat.com> 0.106-1 +- libdw: Updated dwarf.h from DWARF3 speclibdw: add new funtions dwarf_f +unc_entrypc, dwarf_func_file, dwarf_func_line,dwarf_func_col, dwarf_ge +tsrc_file + +* Fri Apr 1 2005 Ulrich Drepper <drepper@redhat.com> 0.105-1 +- addr2line: New program +- libdw: add new functions: dwarf_addrdie, dwarf_macro_*, dwarf_getfuncs +,dwarf_func_*. +- findtextrel: use dwarf_addrdie + +* Mon Mar 28 2005 Ulrich Drepper <drepper@redhat.com> 0.104-1 +- findtextrel: New program. + +* Mon Mar 21 2005 Ulrich Drepper <drepper@redhat.com> 0.103-1 +- libdw: Fix using libdw.h with gcc < 4 and C++ code. Compiler bug. + +* Tue Feb 22 2005 Ulrich Drepper <drepper@redhat.com> 0.102-1 +- More Makefile and spec file cleanups. + * Fri Jan 16 2004 Jakub Jelinek <jakub@redhat.com> 0.94-1 - upgrade to 0.94 diff --git a/host-darwin-fixup/AndroidFixup.h b/host-darwin-fixup/AndroidFixup.h new file mode 100644 index 00000000..f7afcd41 --- /dev/null +++ b/host-darwin-fixup/AndroidFixup.h @@ -0,0 +1,59 @@ +#ifndef ANDROID_FIXUP_H +#define ANDROID_FIXUP_H + +#define off_t loff_t +#define off64_t loff_t + +#include <string.h> +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include <errno.h> +#include <locale.h> //LC_MESSAGES + +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(exp) ({ \ + typeof (exp) _rc; \ + do { \ + _rc = (exp); \ + } while (_rc == -1 && errno == EINTR); \ + _rc; }) +#endif + +#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070 +static inline size_t strnlen (const char *__string, size_t __maxlen) +{ + int len = 0; + while (__maxlen-- && *__string++) + len++; + return len; +} +#endif + +static inline void *mempcpy (void * __dest, const void * __src, size_t __n) +{ + memcpy(__dest, __src, __n); + return ((char *)__dest) + __n; +} + +#define __mempcpy mempcpy + +#define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES) + +static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...) +{ + va_list lst; + va_start(lst, fmt); + vfprintf(stderr, fmt, lst); + fprintf(stderr, "error %d: %s\n", errnum, strerror(errno)); + va_end(lst); + exit(status); +} + +static inline char *dcgettext (char *__domainname, char *__msgid, int __category) +{ + error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__); + return NULL; +} + +#endif /* ANDROID_FIXUP_H */ diff --git a/host-darwin-fixup/byteswap.h b/host-darwin-fixup/byteswap.h new file mode 100644 index 00000000..db5192d9 --- /dev/null +++ b/host-darwin-fixup/byteswap.h @@ -0,0 +1,21 @@ +#ifndef ELFUTILS_BYTESWAP_H +#define ELFUTILS_BYTESWAP_H + +static inline unsigned short bswap_16(unsigned short val) +{ + return ((val & 0xff) << 8) | ((val >> 8) & 0xff); +} + +static inline unsigned long bswap_32(unsigned long val) +{ + return bswap_16((unsigned short)val) << 16 | + bswap_16((unsigned short)(val >> 16)); +} + +static inline unsigned long long bswap_64(unsigned long long val) +{ + return ((((unsigned long long)bswap_32(val)) << 32) | + (((unsigned long long)bswap_32(val >> 32)) & 0xffffffffULL)); +} + +#endif /* ELFUTILS_BYTESWAP_H */ diff --git a/host-darwin-fixup/endian.h b/host-darwin-fixup/endian.h new file mode 100644 index 00000000..004acdaa --- /dev/null +++ b/host-darwin-fixup/endian.h @@ -0,0 +1,8 @@ +#ifndef ELFUTILS_ENDIAN_H +#define ELFUTILS_ENDIAN_H + +#define __LITTLE_ENDIAN (1234) +#define __BIG_ENDIAN (4321) +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* ELFUTILS_ENDIAN_H */ diff --git a/host-darwin-fixup/libintl.h b/host-darwin-fixup/libintl.h new file mode 100644 index 00000000..56af5c20 --- /dev/null +++ b/host-darwin-fixup/libintl.h @@ -0,0 +1,6 @@ +#ifndef ELFUTILS_LIBINTL_H +#define ELFUTILS_LIBINTL_H + +/* intentionally blank */ + +#endif /* ELFUTILS_LIBINTL_H */ diff --git a/host-linux-fixup/AndroidFixup.h b/host-linux-fixup/AndroidFixup.h new file mode 100644 index 00000000..e8531630 --- /dev/null +++ b/host-linux-fixup/AndroidFixup.h @@ -0,0 +1,4 @@ +#ifndef ANDROID_FIXUP_H +#define ANDROID_FIXUP_H + +#endif /* ANDROID_FIXUP_H */ diff --git a/lib/ChangeLog b/lib/ChangeLog index 4da33b09..f4c261ab 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,65 @@ +2008-08-25 Roland McGrath <roland@redhat.com> + + * eu-config.h [USE_TLS] (RWLOCK_CALL): New macro. + (rwlock_init, rwlock_fini, rwlock_rdlock, rwlock_wrlock, rwlock_unlock): + Use it. + +2008-08-24 Roland McGrath <roland@redhat.com> + + * eu-config.h: New file. + * Makefile.am (noinst_HEADERS): Add it. + +2008-02-01 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libeu_a_SOURCES): Add sha1.c. + (noinst_HEADERS): Add sha1.h. + * sha1.c: New file. + * sha1.h: New file. + +2008-01-31 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libeu_a_SOURCES): Add md5.c. + (noinst_HEADERS): Add md5.h. + * md5.c: New file. + * md5.h: New file. + +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libeu_a_SOURCES): We don't need xstrdup in the moment. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * system.h: Define pwrite_retry, write_retry, and pread_retry. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (xmalloc_CFLAGS): Define only if !GPROF. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * crc32_file.c: New file. + * Makefile.am (libeu_a_SOURCES): Add it. + * system.h: Declare crc32_file. + +2005-04-30 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Use -ffunction-sections for xmalloc.c. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * dynamicsizehash.c (lookup): Mark val parameter as possibly unused. + +2005-02-06 Ulrich Drepper <drepper@redhat.com> + + * fixedsizehash.h: Mark unused parameters. Correct CLASS and + const order for fshash_find. + + * Makefile.am: Cleanup AM_CFLAGS handling. Add -Wunused -Wextra. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fpic and -fmudflap. + 2004-01-17 Ulrich Drepper <drepper@redhat.com> * Makefile.am: Support building with mudflap. diff --git a/lib/Makefile b/lib/Makefile deleted file mode 100644 index b87ff4eb..00000000 --- a/lib/Makefile +++ /dev/null @@ -1,424 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# lib/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - -SOURCES = $(libeu_a_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = lib -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libeu_a_AR = $(AR) $(ARFLAGS) -libeu_a_LIBADD = -am_libeu_a_OBJECTS = xstrdup.$(OBJEXT) xstrndup.$(OBJEXT) \ - xmalloc.$(OBJEXT) next_prime.$(OBJEXT) crc32.$(OBJEXT) -libeu_a_OBJECTS = $(am_libeu_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libeu_a_SOURCES) -DIST_SOURCES = $(libeu_a_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall $(if $($(*F)_no_Werror),,-Werror) $(picflag) -picflag = -fpic -INCLUDES = -I$(srcdir)/../libelf -I.. -noinst_LIBRARIES = libeu.a -libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c crc32.c -noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h -EXTRA_DIST = dynamicsizehash.c - -# XXX gcc has a bug in that it generates warnings for internal symbols. -#xmalloc_no_Werror = yes -#crc32_no_Werror = yes -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits lib/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libeu.a: $(libeu_a_OBJECTS) $(libeu_a_DEPENDENCIES) - -rm -f libeu.a - $(libeu_a_AR) libeu.a $(libeu_a_OBJECTS) $(libeu_a_LIBADD) - $(RANLIB) libeu.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/crc32.Po -include ./$(DEPDIR)/next_prime.Po -include ./$(DEPDIR)/xmalloc.Po -include ./$(DEPDIR)/xstrdup.Po -include ./$(DEPDIR)/xstrndup.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# 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/lib/Makefile.am b/lib/Makefile.am index 43a13582..b95d3e3b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,37 +1,47 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 1996-2001, 2002, 2004 Red Hat, Inc. +## Copyright (C) 1996-2001, 2002, 2004, 2005, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## 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, version 2. +## Red Hat elfutils 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; version 2 of the License. ## -## 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. +## Red Hat elfutils is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software Foundation, -## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -AM_CFLAGS = -Wall $(if $($(*F)_no_Werror),,-Werror) $(picflag) -if !MUDFLAP -picflag = -fpic +if MUDFLAP +AM_CFLAGS = -fmudflap +else +AM_CFLAGS = endif +AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra $($(*F)_CFLAGS) INCLUDES = -I$(srcdir)/../libelf -I.. noinst_LIBRARIES = libeu.a -libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c crc32.c +libeu_a_SOURCES = xstrndup.c xmalloc.c next_prime.c \ + crc32.c crc32_file.c md5.c sha1.c -noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h +noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h md5.h \ + sha1.h eu-config.h EXTRA_DIST = dynamicsizehash.c -# XXX gcc has a bug in that it generates warnings for internal symbols. -if MUDFLAP -xmalloc_no_Werror = yes -crc32_no_Werror = yes +if !GPROF +xmalloc_CFLAGS = -ffunction-sections endif diff --git a/lib/Makefile.in b/lib/Makefile.in index 8014230f..eac1fe9d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -15,17 +15,11 @@ @SET_MAKE@ -SOURCES = $(libeu_a_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -43,13 +37,11 @@ subdir = lib DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) @@ -57,10 +49,11 @@ AR = ar ARFLAGS = cru libeu_a_AR = $(AR) $(ARFLAGS) libeu_a_LIBADD = -am_libeu_a_OBJECTS = xstrdup.$(OBJEXT) xstrndup.$(OBJEXT) \ - xmalloc.$(OBJEXT) next_prime.$(OBJEXT) crc32.$(OBJEXT) +am_libeu_a_OBJECTS = xstrndup.$(OBJEXT) xmalloc.$(OBJEXT) \ + next_prime.$(OBJEXT) crc32.$(OBJEXT) crc32_file.$(OBJEXT) \ + md5.$(OBJEXT) sha1.$(OBJEXT) libeu_a_OBJECTS = $(am_libeu_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -74,8 +67,6 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -84,43 +75,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -129,7 +116,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -137,12 +123,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -155,44 +143,60 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -AM_CFLAGS = -Wall $(if $($(*F)_no_Werror),,-Werror) $(picflag) -@MUDFLAP_FALSE@picflag = -fpic +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +@MUDFLAP_FALSE@ -Wextra $($(*F)_CFLAGS) +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +@MUDFLAP_TRUE@ -Wunused -Wextra $($(*F)_CFLAGS) INCLUDES = -I$(srcdir)/../libelf -I.. noinst_LIBRARIES = libeu.a -libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c crc32.c -noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h -EXTRA_DIST = dynamicsizehash.c +libeu_a_SOURCES = xstrndup.c xmalloc.c next_prime.c \ + crc32.c crc32_file.c md5.c sha1.c + +noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h md5.h \ + sha1.h eu-config.h -# XXX gcc has a bug in that it generates warnings for internal symbols. -@MUDFLAP_TRUE@xmalloc_no_Werror = yes -@MUDFLAP_TRUE@crc32_no_Werror = yes +EXTRA_DIST = dynamicsizehash.c +@GPROF_FALSE@xmalloc_CFLAGS = -ffunction-sections all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -217,9 +221,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: @@ -236,33 +240,34 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/next_prime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrdup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrndup.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -274,8 +279,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -285,13 +290,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -305,22 +309,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -381,12 +384,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + 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 + installcheck-am: maintainer-clean: maintainer-clean-am @@ -406,18 +417,22 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ + 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 maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am + uninstall-am # 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. diff --git a/lib/crc32.c b/lib/crc32.c index a198e8e4..e0ef2f63 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -1,17 +1,50 @@ /* Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <stdint.h> #include "system.h" diff --git a/lib/crc32_file.c b/lib/crc32_file.c new file mode 100644 index 00000000..5946df96 --- /dev/null +++ b/lib/crc32_file.c @@ -0,0 +1,107 @@ +/* Compute CRC32 checksum of file contents. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "system.h" +#include <errno.h> +#include <unistd.h> +#include <sys/stat.h> +#include <sys/mman.h> + +int +crc32_file (int fd, uint32_t *resp) +{ + unsigned char buffer[1024 * 8]; + uint32_t crc = 0; + off_t off = 0; + ssize_t count; + + struct stat st; + if (fstat (fd, &st) == 0) + { + /* Try mapping in the file data. */ + size_t mapsize = st.st_size; + void *mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); + if (mapped == MAP_FAILED && errno == ENOMEM) + { + const size_t pagesize = sysconf (_SC_PAGE_SIZE); + mapsize = ((mapsize / 2) + pagesize - 1) & -pagesize; + while (mapsize >= pagesize + && (mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE, + fd, 0)) == MAP_FAILED && errno == ENOMEM) + mapsize /= 2; + } + if (mapped != MAP_FAILED) + { + do + { + if (st.st_size <= (off_t) mapsize) + { + *resp = crc32 (crc, mapped, st.st_size); + munmap (mapped, mapsize); + return 0; + } + crc = crc32 (crc, mapped, mapsize); + off += mapsize; + st.st_size -= mapsize; + } while (mmap (mapped, mapsize, PROT_READ, MAP_FIXED|MAP_PRIVATE, + fd, off) == mapped); + munmap (mapped, mapsize); + } + } + + while ((count = TEMP_FAILURE_RETRY (pread (fd, buffer, sizeof buffer, + off))) > 0) + { + off += count; + crc = crc32 (crc, buffer, count); + } + + *resp = crc; + + return count == 0 ? 0 : -1; +} diff --git a/lib/dynamicsizehash.c b/lib/dynamicsizehash.c index 16575f50..b645da6a 100644 --- a/lib/dynamicsizehash.c +++ b/lib/dynamicsizehash.c @@ -1,15 +1,51 @@ -/* Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +/* Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <assert.h> #include <stdlib.h> @@ -32,7 +68,7 @@ static size_t lookup (htab, hval, val) NAME *htab; unsigned long int hval; - TYPE val; + TYPE val __attribute__ ((unused)); { /* First hash function: simply take the modul but prevent zero. */ size_t idx = 1 + hval % htab->size; diff --git a/lib/dynamicsizehash.h b/lib/dynamicsizehash.h index 39a706fd..7cbb169d 100644 --- a/lib/dynamicsizehash.h +++ b/lib/dynamicsizehash.h @@ -1,15 +1,51 @@ /* Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <stddef.h> diff --git a/lib/error.h b/lib/error.h deleted file mode 100644 index bbc15f99..00000000 --- a/lib/error.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef ERROR_H -#define ERROR_H -#endif/* ERROR_H */ diff --git a/lib/eu-config.h b/lib/eu-config.h new file mode 100644 index 00000000..c41cbb0c --- /dev/null +++ b/lib/eu-config.h @@ -0,0 +1,198 @@ +/* Configuration definitions. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef USE_TLS +# include <pthread.h> +# include <assert.h> +# define tls_key_t __thread void * +# define key_create(keyp, freefct) (1) +# define getspecific(key) key +# define setspecific(key,val) key = val +# define once_define(class,name) class struct { } name +# define once_execute(name,fct) ((void) &name, (void) (fct)) +# define rwlock_define(class,name) class pthread_rwlock_t name +# define RWLOCK_CALL(call) \ + ({ int _err = pthread_rwlock_ ## call; assert_perror (_err); }) +# define rwlock_init(lock) RWLOCK_CALL (init (&lock, NULL)) +# define rwlock_fini(lock) RWLOCK_CALL (destroy (&lock)) +# define rwlock_rdlock(lock) RWLOCK_CALL (rdlock (&lock)) +# define rwlock_wrlock(lock) RWLOCK_CALL (wrlock (&lock)) +# define rwlock_unlock(lock) RWLOCK_CALL (unlock (&lock)) +#else +/* Eventually we will allow multi-threaded applications to use the + libraries. Therefore we will add the necessary locking although + the macros used expand to nothing for now. */ +# define lock_lock(lock) ((void) (lock)) +# define rwlock_define(class,name) class int name +# define rwlock_init(lock) ((void) (lock)) +# define rwlock_fini(lock) ((void) (lock)) +# define rwlock_rdlock(lock) ((void) (lock)) +# define rwlock_wrlock(lock) ((void) (lock)) +# define rwlock_unlock(lock) ((void) (lock)) +# define tls_key_t void * +# define key_create(keyp, freefct) (1) +# define getspecific(key) key +# define setspecific(key,val) key = val +# define once_define(class,name) class int name +# define once_execute(name,fct) \ + do { \ + if (name == 0) \ + fct (); \ + name = 1; \ + } while (0) +#endif /* USE_TLS */ + +/* gettext helper macro. */ +#define N_(Str) Str + +/* Compiler-specific definitions. */ +#define strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +#ifdef __i386__ +# define internal_function __attribute__ ((regparm (3), stdcall)) +#else +# define internal_function /* nothing */ +#endif + +#define internal_strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function; + +#define attribute_hidden \ + __attribute__ ((visibility ("hidden"))) + +/* Define ALLOW_UNALIGNED if the architecture allows operations on + unaligned memory locations. */ +#if defined __i386__ || defined __x86_64__ +# define ALLOW_UNALIGNED 1 +#else +# define ALLOW_UNALIGNED 0 +#endif + +#if DEBUGPRED +# ifdef __x86_64__ +asm (".section predict_data, \"aw\"; .previous\n" + ".section predict_line, \"a\"; .previous\n" + ".section predict_file, \"a\"; .previous"); +# ifndef PIC +# define debugpred__(e, E) \ + ({ long int _e = !!(e); \ + asm volatile (".pushsection predict_data; ..predictcnt%=: .quad 0; .quad 0\n" \ + ".section predict_line; .quad %c1\n" \ + ".section predict_file; .quad %c2; .popsection\n" \ + "addq $1,..predictcnt%=(,%0,8)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# endif +# elif defined __i386__ +asm (".section predict_data, \"aw\"; .previous\n" + ".section predict_line, \"a\"; .previous\n" + ".section predict_file, \"a\"; .previous"); +# ifndef PIC +# define debugpred__(e, E) \ + ({ long int _e = !!(e); \ + asm volatile (".pushsection predict_data; ..predictcnt%=: .long 0; .long 0\n" \ + ".section predict_line; .long %c1\n" \ + ".section predict_file; .long %c2; .popsection\n" \ + "incl ..predictcnt%=(,%0,8)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# endif +# endif +# ifdef debugpred__ +# define unlikely(e) debugpred__ (e,0) +# define likely(e) debugpred__ (e,1) +# endif +#endif +#ifndef likely +# define unlikely(expr) __builtin_expect (!!(expr), 0) +# define likely(expr) __builtin_expect (!!(expr), 1) +#endif + +#define obstack_calloc(ob, size) \ + ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) +#define obstack_strdup(ob, str) \ + ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) +#define obstack_strndup(ob, str, n) \ + ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) + +#if __STDC_VERSION__ >= 199901L +# define flexarr_size /* empty */ +#else +# define flexarr_size 0 +#endif + +/* Calling conventions. */ +#ifdef __i386__ +# define CALLING_CONVENTION regparm (3), stdcall +# define AND_CALLING_CONVENTION , regparm (3), stdcall +#else +# define CALLING_CONVENTION +# define AND_CALLING_CONVENTION +#endif + +/* Avoid PLT entries. */ +#ifdef PIC +# define INTUSE(name) _INTUSE(name) +# define _INTUSE(name) __##name##_internal +# define INTDEF(name) _INTDEF(name) +# define _INTDEF(name) \ + extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); +# define INTDECL(name) _INTDECL(name) +# define _INTDECL(name) \ + extern __typeof__ (name) __##name##_internal attribute_hidden; +#else +# define INTUSE(name) name +# define INTDEF(name) /* empty */ +# define INTDECL(name) /* empty */ +#endif + +/* This macro is used by the tests conditionalize for standalone building. */ +#define ELFUTILS_HEADER(name) <lib##name.h> diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h index c5a852c5..a686051c 100644 --- a/lib/fixedsizehash.h +++ b/lib/fixedsizehash.h @@ -1,19 +1,52 @@ /* Fixed size hash table with internal linking. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <errno.h> #include <stdlib.h> @@ -156,7 +189,8 @@ CONCAT(PREFIX,fshash_lookup) (struct CONCAT(PREFIX,fshash) *htab, CLASS int __attribute__ ((unused)) CONCAT(PREFIX,fshash_insert) (struct CONCAT(PREFIX,fshash) *htab, - const char *str, size_t len, TYPE *data) + const char *str, + size_t len __attribute__ ((unused)), TYPE *data) { HASHTYPE hval = HASHFCT (str, len ?: strlen (str)); struct CONCAT(PREFIX,fshashent) *slot; @@ -205,7 +239,9 @@ CONCAT(PREFIX,fshash_insert_hash) (struct CONCAT(PREFIX,fshash) *htab, CLASS int __attribute__ ((unused)) CONCAT(PREFIX,fshash_overwrite) (struct CONCAT(PREFIX,fshash) *htab, - const char *str, size_t len, TYPE *data) + const char *str, + size_t len __attribute__ ((unused)), + TYPE *data) { HASHTYPE hval = HASHFCT (str, len ?: strlen (str)); struct CONCAT(PREFIX,fshashent) *slot; @@ -222,9 +258,10 @@ CONCAT(PREFIX,fshash_overwrite) (struct CONCAT(PREFIX,fshash) *htab, } -const CLASS TYPE * +CLASS const TYPE * CONCAT(PREFIX,fshash_find) (const struct CONCAT(PREFIX,fshash) *htab, - const char *str, size_t len, TYPE *data) + const char *str, + size_t len __attribute__ ((unused)), TYPE *data) { HASHTYPE hval = HASHFCT (str, len ?: strlen (str)); struct CONCAT(PREFIX,fshashent) *slot; diff --git a/lib/libeu.a b/lib/libeu.a Binary files differdeleted file mode 100644 index 321b74dc..00000000 --- a/lib/libeu.a +++ /dev/null @@ -1,15 +1,51 @@ /* Copyright (C) 2001, 2002, 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef LIST_H #define LIST_H 1 diff --git a/lib/md5.c b/lib/md5.c new file mode 100644 index 00000000..0770561c --- /dev/null +++ b/lib/md5.c @@ -0,0 +1,446 @@ +/* Functions to compute MD5 message digest of files or memory blocks. + according to the definition of MD5 in RFC 1321 from April 1992. + Copyright (C) 1995,1996,1997,1999,2000,2001,2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1995. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <endian.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +#include "md5.h" + +#if __BYTE_ORDER == __BIG_ENDIAN +# define SWAP(n) \ + (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#else +# define SWAP(n) (n) +#endif + + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (RFC 1321, 3.1: Step 1) */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + + +/* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +void +md5_init_ctx (ctx) + struct md5_ctx *ctx; +{ + ctx->A = 0x67452301; + ctx->B = 0xefcdab89; + ctx->C = 0x98badcfe; + ctx->D = 0x10325476; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + +/* Put result from CTX in first 16 bytes following RESBUF. The result + must be in little endian byte order. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +md5_read_ctx (ctx, resbuf) + const struct md5_ctx *ctx; + void *resbuf; +{ + ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); + ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); + ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); + ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); + + return resbuf; +} + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +md5_finish_ctx (ctx, resbuf) + struct md5_ctx *ctx; + void *resbuf; +{ + /* Take yet unprocessed bytes into account. */ + md5_uint32 bytes = ctx->buflen; + size_t pad; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) + ++ctx->total[1]; + + pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; + memcpy (&ctx->buffer[bytes], fillbuf, pad); + + /* Put the 64-bit file length in *bits* at the end of the buffer. */ + *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); + *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | + (ctx->total[0] >> 29)); + + /* Process last bytes. */ + md5_process_block (ctx->buffer, bytes + pad + 8, ctx); + + return md5_read_ctx (ctx, resbuf); +} + + +#ifdef NEED_MD5_STREAM +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +int +md5_stream (stream, resblock) + FILE *stream; + void *resblock; +{ + /* Important: BLOCKSIZE must be a multiple of 64. */ +#define BLOCKSIZE 4096 + struct md5_ctx ctx; + char buffer[BLOCKSIZE + 72]; + size_t sum; + + /* Initialize the computation context. */ + md5_init_ctx (&ctx); + + /* Iterate over full file contents. */ + while (1) + { + /* We read the file in blocks of BLOCKSIZE bytes. One call of the + computation function processes the whole buffer so that with the + next round of the loop another block can be read. */ + size_t n; + sum = 0; + + /* Read block. Take care for partial reads. */ + do + { + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); + + sum += n; + } + while (sum < BLOCKSIZE && n != 0); + if (n == 0 && ferror (stream)) + return 1; + + /* If end of file is reached, end the loop. */ + if (n == 0) + break; + + /* Process buffer with BLOCKSIZE bytes. Note that + BLOCKSIZE % 64 == 0 + */ + md5_process_block (buffer, BLOCKSIZE, &ctx); + } + + /* Add the last bytes if necessary. */ + if (sum > 0) + md5_process_bytes (buffer, sum, &ctx); + + /* Construct result in desired memory. */ + md5_finish_ctx (&ctx, resblock); + return 0; +} +#endif + + +#ifdef NEED_MD5_BUFFER +/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +void * +md5_buffer (buffer, len, resblock) + const char *buffer; + size_t len; + void *resblock; +{ + struct md5_ctx ctx; + + /* Initialize the computation context. */ + md5_init_ctx (&ctx); + + /* Process whole buffer but last len % 64 bytes. */ + md5_process_bytes (buffer, len, &ctx); + + /* Put result in desired memory area. */ + return md5_finish_ctx (&ctx, resblock); +} +#endif + + +void +md5_process_bytes (buffer, len, ctx) + const void *buffer; + size_t len; + struct md5_ctx *ctx; +{ + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) + { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy (&ctx->buffer[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 64) + { + md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + + ctx->buflen &= 63; + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], + ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len >= 64) + { +#if !_STRING_ARCH_unaligned +/* To check alignment gcc has an appropriate operator. Other + compilers don't. */ +# if __GNUC__ >= 2 +# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0) +# else +# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0) +# endif + if (UNALIGNED_P (buffer)) + while (len > 64) + { + md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + else +#endif + { + md5_process_block (buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + } + + /* Move remaining bytes in internal buffer. */ + if (len > 0) + { + size_t left_over = ctx->buflen; + + memcpy (&ctx->buffer[left_over], buffer, len); + left_over += len; + if (left_over >= 64) + { + md5_process_block (ctx->buffer, 64, ctx); + left_over -= 64; + memcpy (ctx->buffer, &ctx->buffer[64], left_over); + } + ctx->buflen = left_over; + } +} + + +/* These are the four functions used in the four steps of the MD5 algorithm + and defined in the RFC 1321. The first function is a little bit optimized + (as found in Colin Plumbs public domain implementation). */ +/* #define FF(b, c, d) ((b & c) | (~b & d)) */ +#define FF(b, c, d) (d ^ (b & (c ^ d))) +#define FG(b, c, d) FF (d, b, c) +#define FH(b, c, d) (b ^ c ^ d) +#define FI(b, c, d) (c ^ (b | ~d)) + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. */ + +void +md5_process_block (buffer, len, ctx) + const void *buffer; + size_t len; + struct md5_ctx *ctx; +{ + md5_uint32 correct_words[16]; + const md5_uint32 *words = buffer; + size_t nwords = len / sizeof (md5_uint32); + const md5_uint32 *endp = words + nwords; + md5_uint32 A = ctx->A; + md5_uint32 B = ctx->B; + md5_uint32 C = ctx->C; + md5_uint32 D = ctx->D; + + /* First increment the byte count. RFC 1321 specifies the possible + length of the file up to 2^64 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) + ++ctx->total[1]; + + /* Process all bytes in the buffer with 64 bytes in each round of + the loop. */ + while (words < endp) + { + md5_uint32 *cwp = correct_words; + md5_uint32 A_save = A; + md5_uint32 B_save = B; + md5_uint32 C_save = C; + md5_uint32 D_save = D; + + /* First round: using the given function, the context and a constant + the next context is computed. Because the algorithms processing + unit is a 32-bit word and it is determined to work on words in + little endian byte order we perhaps have to change the byte order + before the computation. To reduce the work for the next steps + we store the swapped words in the array CORRECT_WORDS. */ + +#define OP(a, b, c, d, s, T) \ + do \ + { \ + a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ + ++words; \ + CYCLIC (a, s); \ + a += b; \ + } \ + while (0) + + /* It is unfortunate that C does not provide an operator for + cyclic rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) + + /* Before we start, one word to the strange constants. + They are defined in RFC 1321 as + + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + */ + + /* Round 1. */ + OP (A, B, C, D, 7, 0xd76aa478); + OP (D, A, B, C, 12, 0xe8c7b756); + OP (C, D, A, B, 17, 0x242070db); + OP (B, C, D, A, 22, 0xc1bdceee); + OP (A, B, C, D, 7, 0xf57c0faf); + OP (D, A, B, C, 12, 0x4787c62a); + OP (C, D, A, B, 17, 0xa8304613); + OP (B, C, D, A, 22, 0xfd469501); + OP (A, B, C, D, 7, 0x698098d8); + OP (D, A, B, C, 12, 0x8b44f7af); + OP (C, D, A, B, 17, 0xffff5bb1); + OP (B, C, D, A, 22, 0x895cd7be); + OP (A, B, C, D, 7, 0x6b901122); + OP (D, A, B, C, 12, 0xfd987193); + OP (C, D, A, B, 17, 0xa679438e); + OP (B, C, D, A, 22, 0x49b40821); + + /* For the second to fourth round we have the possibly swapped words + in CORRECT_WORDS. Redefine the macro to take an additional first + argument specifying the function to use. */ +#undef OP +#define OP(f, a, b, c, d, k, s, T) \ + do \ + { \ + a += f (b, c, d) + correct_words[k] + T; \ + CYCLIC (a, s); \ + a += b; \ + } \ + while (0) + + /* Round 2. */ + OP (FG, A, B, C, D, 1, 5, 0xf61e2562); + OP (FG, D, A, B, C, 6, 9, 0xc040b340); + OP (FG, C, D, A, B, 11, 14, 0x265e5a51); + OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); + OP (FG, A, B, C, D, 5, 5, 0xd62f105d); + OP (FG, D, A, B, C, 10, 9, 0x02441453); + OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); + OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); + OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); + OP (FG, D, A, B, C, 14, 9, 0xc33707d6); + OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); + OP (FG, B, C, D, A, 8, 20, 0x455a14ed); + OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); + OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); + OP (FG, C, D, A, B, 7, 14, 0x676f02d9); + OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); + + /* Round 3. */ + OP (FH, A, B, C, D, 5, 4, 0xfffa3942); + OP (FH, D, A, B, C, 8, 11, 0x8771f681); + OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); + OP (FH, B, C, D, A, 14, 23, 0xfde5380c); + OP (FH, A, B, C, D, 1, 4, 0xa4beea44); + OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); + OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); + OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); + OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); + OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); + OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); + OP (FH, B, C, D, A, 6, 23, 0x04881d05); + OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); + OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); + OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); + OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); + + /* Round 4. */ + OP (FI, A, B, C, D, 0, 6, 0xf4292244); + OP (FI, D, A, B, C, 7, 10, 0x432aff97); + OP (FI, C, D, A, B, 14, 15, 0xab9423a7); + OP (FI, B, C, D, A, 5, 21, 0xfc93a039); + OP (FI, A, B, C, D, 12, 6, 0x655b59c3); + OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); + OP (FI, C, D, A, B, 10, 15, 0xffeff47d); + OP (FI, B, C, D, A, 1, 21, 0x85845dd1); + OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); + OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); + OP (FI, C, D, A, B, 6, 15, 0xa3014314); + OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); + OP (FI, A, B, C, D, 4, 6, 0xf7537e82); + OP (FI, D, A, B, C, 11, 10, 0xbd3af235); + OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); + OP (FI, B, C, D, A, 9, 21, 0xeb86d391); + + /* Add the starting values of the context. */ + A += A_save; + B += B_save; + C += C_save; + D += D_save; + } + + /* Put checksum in context given as argument. */ + ctx->A = A; + ctx->B = B; + ctx->C = C; + ctx->D = D; +} diff --git a/lib/md5.h b/lib/md5.h new file mode 100644 index 00000000..3c8b8f31 --- /dev/null +++ b/lib/md5.h @@ -0,0 +1,107 @@ +/* Declaration of functions and data types used for MD5 sum computing + library functions. + Copyright (C) 1995,1996,1997,1999-2001,2004,2005,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1995. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _MD5_H +#define _MD5_H 1 + +#include <limits.h> +#include <stdint.h> +#include <stdio.h> + +#define MD5_DIGEST_SIZE 16 +#define MD5_BLOCK_SIZE 64 + +typedef uint32_t md5_uint32; +typedef uintptr_t md5_uintptr; + +/* Structure to save state of computation between the single steps. */ +struct md5_ctx +{ + md5_uint32 A; + md5_uint32 B; + md5_uint32 C; + md5_uint32 D; + + md5_uint32 total[2]; + md5_uint32 buflen; + char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); +}; + +/* + * The following three functions are build up the low level used in + * the functions `md5_stream' and `md5_buffer'. + */ + +/* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +extern void md5_init_ctx (struct md5_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void md5_process_block (const void *buffer, size_t len, + struct md5_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void md5_process_bytes (const void *buffer, size_t len, + struct md5_ctx *ctx); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 16 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); + + +/* Put result from CTX in first 16 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); + + +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +extern int md5_stream (FILE *stream, void *resblock); + +/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +extern void *md5_buffer (const char *buffer, size_t len, void *resblock); + +#endif /* md5.h */ diff --git a/lib/next_prime.c b/lib/next_prime.c index 5d608046..5d4fc3fc 100644 --- a/lib/next_prime.c +++ b/lib/next_prime.c @@ -1,19 +1,51 @@ /* Determine prime number. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <stddef.h> diff --git a/lib/sha1.c b/lib/sha1.c new file mode 100644 index 00000000..0459cd6d --- /dev/null +++ b/lib/sha1.c @@ -0,0 +1,386 @@ +/* Functions to compute SHA1 message digest of files or memory blocks. + according to the definition of SHA1 in FIPS 180-1 from April 1997. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2008. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <endian.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +#include "sha1.h" + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# include <byteswap.h> +# define SWAP(n) bswap_32 (n) +#else +# define SWAP(n) (n) +#endif + + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + + +/* Initialize structure containing state of computation. */ +void +sha1_init_ctx (ctx) + struct sha1_ctx *ctx; +{ + ctx->A = 0x67452301; + ctx->B = 0xefcdab89; + ctx->C = 0x98badcfe; + ctx->D = 0x10325476; + ctx->E = 0xc3d2e1f0; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + +/* Put result from CTX in first 20 bytes following RESBUF. The result + must be in little endian byte order. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +sha1_read_ctx (ctx, resbuf) + const struct sha1_ctx *ctx; + void *resbuf; +{ + ((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A); + ((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B); + ((sha1_uint32 *) resbuf)[2] = SWAP (ctx->C); + ((sha1_uint32 *) resbuf)[3] = SWAP (ctx->D); + ((sha1_uint32 *) resbuf)[4] = SWAP (ctx->E); + + return resbuf; +} + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +sha1_finish_ctx (ctx, resbuf) + struct sha1_ctx *ctx; + void *resbuf; +{ + /* Take yet unprocessed bytes into account. */ + sha1_uint32 bytes = ctx->buflen; + size_t pad; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) + ++ctx->total[1]; + + pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; + memcpy (&ctx->buffer[bytes], fillbuf, pad); + + /* Put the 64-bit file length in *bits* at the end of the buffer. */ + *(sha1_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | + (ctx->total[0] >> 29)); + *(sha1_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); + + /* Process last bytes. */ + sha1_process_block (ctx->buffer, bytes + pad + 8, ctx); + + return sha1_read_ctx (ctx, resbuf); +} + + +void +sha1_process_bytes (buffer, len, ctx) + const void *buffer; + size_t len; + struct sha1_ctx *ctx; +{ + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) + { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy (&ctx->buffer[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 64) + { + sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + + ctx->buflen &= 63; + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], + ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len >= 64) + { +#if !_STRING_ARCH_unaligned +/* To check alignment gcc has an appropriate operator. Other + compilers don't. */ +# if __GNUC__ >= 2 +# define UNALIGNED_P(p) (((sha1_uintptr) p) % __alignof__ (sha1_uint32) != 0) +# else +# define UNALIGNED_P(p) (((sha1_uintptr) p) % sizeof (sha1_uint32) != 0) +# endif + if (UNALIGNED_P (buffer)) + while (len > 64) + { + sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + else +#endif + { + sha1_process_block (buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + } + + /* Move remaining bytes in internal buffer. */ + if (len > 0) + { + size_t left_over = ctx->buflen; + + memcpy (&ctx->buffer[left_over], buffer, len); + left_over += len; + if (left_over >= 64) + { + sha1_process_block (ctx->buffer, 64, ctx); + left_over -= 64; + memcpy (ctx->buffer, &ctx->buffer[64], left_over); + } + ctx->buflen = left_over; + } +} + + +/* These are the four functions used in the four steps of the SHA1 algorithm + and defined in the FIPS 180-1. */ +/* #define FF(b, c, d) ((b & c) | (~b & d)) */ +#define FF(b, c, d) (d ^ (b & (c ^ d))) +#define FG(b, c, d) (b ^ c ^ d) +/* define FH(b, c, d) ((b & c) | (b & d) | (c & d)) */ +#define FH(b, c, d) (((b | c) & d) | (b & c)) + +/* It is unfortunate that C does not provide an operator for cyclic + rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) (((w) << s) | ((w) >> (32 - s))) + +/* Magic constants. */ +#define K0 0x5a827999 +#define K1 0x6ed9eba1 +#define K2 0x8f1bbcdc +#define K3 0xca62c1d6 + + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. */ + +void +sha1_process_block (buffer, len, ctx) + const void *buffer; + size_t len; + struct sha1_ctx *ctx; +{ + sha1_uint32 computed_words[16]; +#define W(i) computed_words[(i) % 16] + const sha1_uint32 *words = buffer; + size_t nwords = len / sizeof (sha1_uint32); + const sha1_uint32 *endp = words + nwords; + sha1_uint32 A = ctx->A; + sha1_uint32 B = ctx->B; + sha1_uint32 C = ctx->C; + sha1_uint32 D = ctx->D; + sha1_uint32 E = ctx->E; + + /* First increment the byte count. FIPS 180-1 specifies the possible + length of the file up to 2^64 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) + ++ctx->total[1]; + + /* Process all bytes in the buffer with 64 bytes in each round of + the loop. */ + while (words < endp) + { + sha1_uint32 A_save = A; + sha1_uint32 B_save = B; + sha1_uint32 C_save = C; + sha1_uint32 D_save = D; + sha1_uint32 E_save = E; + + /* First round: using the given function, the context and a constant + the next context is computed. Because the algorithms processing + unit is a 32-bit word and it is determined to work on words in + little endian byte order we perhaps have to change the byte order + before the computation. */ + +#define OP(i, a, b, c, d, e) \ + do \ + { \ + W (i) = SWAP (*words); \ + e = CYCLIC (a, 5) + FF (b, c, d) + e + W (i) + K0; \ + ++words; \ + b = CYCLIC (b, 30); \ + } \ + while (0) + + /* Steps 0 to 15. */ + OP (0, A, B, C, D, E); + OP (1, E, A, B, C, D); + OP (2, D, E, A, B, C); + OP (3, C, D, E, A, B); + OP (4, B, C, D, E, A); + OP (5, A, B, C, D, E); + OP (6, E, A, B, C, D); + OP (7, D, E, A, B, C); + OP (8, C, D, E, A, B); + OP (9, B, C, D, E, A); + OP (10, A, B, C, D, E); + OP (11, E, A, B, C, D); + OP (12, D, E, A, B, C); + OP (13, C, D, E, A, B); + OP (14, B, C, D, E, A); + OP (15, A, B, C, D, E); + + /* For the remaining 64 steps we have a more complicated + computation of the input data-derived values. Redefine the + macro to take an additional second argument specifying the + function to use and a new last parameter for the magic + constant. */ +#undef OP +#define OP(i, f, a, b, c, d, e, K) \ + do \ + { \ + W (i) = CYCLIC (W (i - 3) ^ W (i - 8) ^ W (i - 14) ^ W (i - 16), 1);\ + e = CYCLIC (a, 5) + f (b, c, d) + e + W (i) + K; \ + b = CYCLIC (b, 30); \ + } \ + while (0) + + /* Steps 16 to 19. */ + OP (16, FF, E, A, B, C, D, K0); + OP (17, FF, D, E, A, B, C, K0); + OP (18, FF, C, D, E, A, B, K0); + OP (19, FF, B, C, D, E, A, K0); + + /* Steps 20 to 39. */ + OP (20, FG, A, B, C, D, E, K1); + OP (21, FG, E, A, B, C, D, K1); + OP (22, FG, D, E, A, B, C, K1); + OP (23, FG, C, D, E, A, B, K1); + OP (24, FG, B, C, D, E, A, K1); + OP (25, FG, A, B, C, D, E, K1); + OP (26, FG, E, A, B, C, D, K1); + OP (27, FG, D, E, A, B, C, K1); + OP (28, FG, C, D, E, A, B, K1); + OP (29, FG, B, C, D, E, A, K1); + OP (30, FG, A, B, C, D, E, K1); + OP (31, FG, E, A, B, C, D, K1); + OP (32, FG, D, E, A, B, C, K1); + OP (33, FG, C, D, E, A, B, K1); + OP (34, FG, B, C, D, E, A, K1); + OP (35, FG, A, B, C, D, E, K1); + OP (36, FG, E, A, B, C, D, K1); + OP (37, FG, D, E, A, B, C, K1); + OP (38, FG, C, D, E, A, B, K1); + OP (39, FG, B, C, D, E, A, K1); + + /* Steps 40 to 59. */ + OP (40, FH, A, B, C, D, E, K2); + OP (41, FH, E, A, B, C, D, K2); + OP (42, FH, D, E, A, B, C, K2); + OP (43, FH, C, D, E, A, B, K2); + OP (44, FH, B, C, D, E, A, K2); + OP (45, FH, A, B, C, D, E, K2); + OP (46, FH, E, A, B, C, D, K2); + OP (47, FH, D, E, A, B, C, K2); + OP (48, FH, C, D, E, A, B, K2); + OP (49, FH, B, C, D, E, A, K2); + OP (50, FH, A, B, C, D, E, K2); + OP (51, FH, E, A, B, C, D, K2); + OP (52, FH, D, E, A, B, C, K2); + OP (53, FH, C, D, E, A, B, K2); + OP (54, FH, B, C, D, E, A, K2); + OP (55, FH, A, B, C, D, E, K2); + OP (56, FH, E, A, B, C, D, K2); + OP (57, FH, D, E, A, B, C, K2); + OP (58, FH, C, D, E, A, B, K2); + OP (59, FH, B, C, D, E, A, K2); + + /* Steps 60 to 79. */ + OP (60, FG, A, B, C, D, E, K3); + OP (61, FG, E, A, B, C, D, K3); + OP (62, FG, D, E, A, B, C, K3); + OP (63, FG, C, D, E, A, B, K3); + OP (64, FG, B, C, D, E, A, K3); + OP (65, FG, A, B, C, D, E, K3); + OP (66, FG, E, A, B, C, D, K3); + OP (67, FG, D, E, A, B, C, K3); + OP (68, FG, C, D, E, A, B, K3); + OP (69, FG, B, C, D, E, A, K3); + OP (70, FG, A, B, C, D, E, K3); + OP (71, FG, E, A, B, C, D, K3); + OP (72, FG, D, E, A, B, C, K3); + OP (73, FG, C, D, E, A, B, K3); + OP (74, FG, B, C, D, E, A, K3); + OP (75, FG, A, B, C, D, E, K3); + OP (76, FG, E, A, B, C, D, K3); + OP (77, FG, D, E, A, B, C, K3); + OP (78, FG, C, D, E, A, B, K3); + OP (79, FG, B, C, D, E, A, K3); + + /* Add the starting values of the context. */ + A += A_save; + B += B_save; + C += C_save; + D += D_save; + E += E_save; + } + + /* Put checksum in context given as argument. */ + ctx->A = A; + ctx->B = B; + ctx->C = C; + ctx->D = D; + ctx->E = E; +} diff --git a/lib/sha1.h b/lib/sha1.h new file mode 100644 index 00000000..97617546 --- /dev/null +++ b/lib/sha1.h @@ -0,0 +1,90 @@ +/* Declaration of functions and data types used for SHA1 sum computing + library functions. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2008. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _SHA1_H +#define _SHA1_H 1 + +#include <limits.h> +#include <stdint.h> +#include <stdio.h> + +#define SHA1_DIGEST_SIZE 20 +#define SHA1_BLOCK_SIZE 64 + +typedef uint32_t sha1_uint32; +typedef uintptr_t sha1_uintptr; + +/* Structure to save state of computation between the single steps. */ +struct sha1_ctx +{ + sha1_uint32 A; + sha1_uint32 B; + sha1_uint32 C; + sha1_uint32 D; + sha1_uint32 E; + + sha1_uint32 total[2]; + sha1_uint32 buflen; + char buffer[128] __attribute__ ((__aligned__ (__alignof__ (sha1_uint32)))); +}; + +/* Initialize structure containing state of computation. */ +extern void sha1_init_ctx (struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void sha1_process_block (const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void sha1_process_bytes (const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 20 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); + + +/* Put result from CTX in first 20 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); + +#endif /* sha1.h */ diff --git a/lib/system.h b/lib/system.h index 8e46feac..23c666ad 100644 --- a/lib/system.h +++ b/lib/system.h @@ -1,17 +1,50 @@ -/* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. +/* Declarations for common convenience functions. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef LIB_SYSTEM_H #define LIB_SYSTEM_H 1 @@ -28,7 +61,7 @@ extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__)); extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len); - +extern int crc32_file (int fd, uint32_t *resp); /* A special gettext function we use if the strings are too short. */ #define sgettext(Str) \ @@ -37,4 +70,12 @@ extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len); #define gettext_noop(Str) Str + +#define pwrite_retry(fd, buf, len, off) \ + TEMP_FAILURE_RETRY (pwrite (fd, buf, len, off)) +#define write_retry(fd, buf, n) \ + TEMP_FAILURE_RETRY (write (fd, buf, n)) +#define pread_retry(fd, buf, len, off) \ + TEMP_FAILURE_RETRY (pread (fd, buf, len, off)) + #endif /* system.h */ diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 5d077d03..b12b0591 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -1,21 +1,34 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. +/* Convenience functions for allocation. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <error.h> -//#include <libintl.h> +#include <libintl.h> #include <stddef.h> #include <stdlib.h> #include <sys/types.h> diff --git a/lib/xstrdup.c b/lib/xstrdup.c deleted file mode 100644 index ad70a630..00000000 --- a/lib/xstrdup.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <string.h> -#include "system.h" - - -/* Return a newly allocated copy of STRING. */ -char * -xstrdup (string) - const char *string; -{ - return strcpy (xmalloc (strlen (string) + 1), string); -} diff --git a/lib/xstrndup.c b/lib/xstrndup.c index 946f3616..2082c17f 100644 --- a/lib/xstrndup.c +++ b/lib/xstrndup.c @@ -1,14 +1,27 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. +/* Convenience function for string allocation. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 630696d7..c98deb64 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,92 @@ +2008-12-03 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am [USE_TLS]: Like libasm.so with libpthread. + +2008-01-11 Ulrich Drepper <drepper@redhat.com> + + * libasm.h (DisasmGetSymCB_t): Change type of fourth and fifth + parameter. + * disasm_cb.c: Adjust accordingly. + +2008-01-08 Roland McGrath <roland@redhat.com> + + * Makefile.am (euinclude): Variable removed. + (pkginclude_HEADERS): Set this instead of euinclude_HEADERS. + +2007-12-20 Ulrich Drepper <drepper@redhat.com> + + * disasm_cb.c: Add initial support to resolve addresses to symbols. + +2007-02-05 Ulrich Drepper <drepper@redhat.com> + + * disasm_begin.c: New file. + * disasm_cb.c: New file. + * disasm_end.c: New file. + * disasm_str.c: New file. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * Makefile.am (CLEANFILES): Add libasm.so.$(VERSION). + +2005-11-13 Roland McGrath <roland@redhat.com> + + * Makefile.am (INCLUDES): Search in libdw. + +2005-09-02 Ulrich Drepper <drepper@redhat.com> + + * asm_error.c (asm_errmsg): Unify error message. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Use $(LINK) not $(CC) when creating DSO. + (%.os): Use COMPILE.os. + (COMPILE.os): Filter out gconv options. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (AM_CFLAGS): Add -std=gnu99. + * asm_abort.c: Don't try to remove output file if there is none. + * asm_addint8.c: In print mode, print to file not stdout. + * asm_addsleb128.c: Likewise. + * asm_adduleb128.c: Likewise. + * asm_newscn.c: Likewise. + * asm_align.c: Implement print mode. + * asm_begin.c (asm_begin): Change interface. Take binary class and + byte order information from new Ebl parameter. + * libasm.h: Adjust prototype. + * asm_end.c (text_end): Close file if necesary. + * asm_error.c: Add new error ASM_E_IOERROR. + * libasmP.h: Add ASM_E_IOERROR definition. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. + + * asm_end.c (text_end): Mark parameter as possibly unused. + +2005-02-06 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Remove lint handling. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * asm_end.c (binary_end): Don't terminate with error() in case + something goes wrong. + + * Makefile.am: Check for text relocations in constructed DSO. + + * Makefile.am (AM_CFLAGS): More warnings. Add -fmudflap for MUDFLAP. + + * asm_end.c (binary_end): Remove shadowing variables. + Little cleanups. + + * asm_newsym.c: Allocate memory for the string parameter. + +2005-02-04 Ulrich Drepper <drepper@redhat.com> + + * asm_newscn_ingrp.c (asm_newscn_ingrp): Use INTUSE to reference + asm_newscn. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * asm_error.c: Make compile with gcc 4.0. @@ -20,4 +109,4 @@ 2003-08-11 Ulrich Drepper <drepper@redhat.com> - * Moved to CVS archive. + * Moved to CVS archive. diff --git a/libasm/Makefile b/libasm/Makefile deleted file mode 100644 index cf50cdbe..00000000 --- a/libasm/Makefile +++ /dev/null @@ -1,593 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# libasm/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - - -SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) $(libasm_so_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -noinst_PROGRAMS = $(am__EXEEXT_1) -#am_libasm_pic_a_OBJECTS = -subdir = libasm -DIST_COMMON = $(euinclude_HEADERS) $(noinst_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" -libLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libasm_a_AR = $(AR) $(ARFLAGS) -libasm_a_LIBADD = -am_libasm_a_OBJECTS = asm_begin.$(OBJEXT) asm_abort.$(OBJEXT) \ - asm_end.$(OBJEXT) asm_error.$(OBJEXT) asm_getelf.$(OBJEXT) \ - asm_newscn.$(OBJEXT) asm_newscn_ingrp.$(OBJEXT) \ - asm_newsubscn.$(OBJEXT) asm_newsym.$(OBJEXT) \ - asm_newcomsym.$(OBJEXT) asm_newabssym.$(OBJEXT) \ - asm_newscngrp.$(OBJEXT) asm_scngrp_newsignature.$(OBJEXT) \ - asm_fill.$(OBJEXT) asm_align.$(OBJEXT) asm_addstrz.$(OBJEXT) \ - asm_addint8.$(OBJEXT) asm_adduint8.$(OBJEXT) \ - asm_addint16.$(OBJEXT) asm_adduint16.$(OBJEXT) \ - asm_addint32.$(OBJEXT) asm_adduint32.$(OBJEXT) \ - asm_addint64.$(OBJEXT) asm_adduint64.$(OBJEXT) \ - asm_adduleb128.$(OBJEXT) asm_addsleb128.$(OBJEXT) \ - symbolhash.$(OBJEXT) -libasm_a_OBJECTS = $(am_libasm_a_OBJECTS) -libasm_pic_a_AR = $(AR) $(ARFLAGS) -libasm_pic_a_LIBADD = -libasm_pic_a_OBJECTS = $(am_libasm_pic_a_OBJECTS) -am__EXEEXT_1 = libasm.so$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am_libasm_so_OBJECTS = -libasm_so_OBJECTS = $(am_libasm_so_OBJECTS) -libasm_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) \ - $(libasm_so_SOURCES) -DIST_SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) \ - $(libasm_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 1 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Werror -#AM_CFLAGS = -Wall -INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \ - -I$(top_srcdir)/lib - -GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) -LINT = splint -lib_LIBRARIES = libasm.a -noinst_LIBRARIES = libasm_pic.a -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libasm.h -libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ - asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \ - asm_newsubscn.c asm_newsym.c asm_newcomsym.c \ - asm_newabssym.c \ - asm_newscngrp.c asm_scngrp_newsignature.c \ - asm_fill.c asm_align.c asm_addstrz.c \ - asm_addint8.c asm_adduint8.c \ - asm_addint16.c asm_adduint16.c \ - asm_addint32.c asm_adduint32.c \ - asm_addint64.c asm_adduint64.c \ - asm_adduleb128.c asm_addsleb128.c \ - symbolhash.c - -libasm_pic_a_SOURCES = -am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) -libasm_so_SOURCES = -noinst_HEADERS = libasmP.h symbolhash.h -EXTRA_DIST = libasm.map -CLEANFILES = $(am_libasm_pic_a_OBJECTS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libasm/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits libasm/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - p=$(am__strip_dir) \ - echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ - $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ - else :; fi; \ - done - -uninstall-libLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libasm.a: $(libasm_a_OBJECTS) $(libasm_a_DEPENDENCIES) - -rm -f libasm.a - $(libasm_a_AR) libasm.a $(libasm_a_OBJECTS) $(libasm_a_LIBADD) - $(RANLIB) libasm.a -libasm_pic.a: $(libasm_pic_a_OBJECTS) $(libasm_pic_a_DEPENDENCIES) - -rm -f libasm_pic.a - $(libasm_pic_a_AR) libasm_pic.a $(libasm_pic_a_OBJECTS) $(libasm_pic_a_LIBADD) - $(RANLIB) libasm_pic.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -#libasm.so$(EXEEXT): $(libasm_so_OBJECTS) $(libasm_so_DEPENDENCIES) -# @rm -f libasm.so$(EXEEXT) -# $(LINK) $(libasm_so_LDFLAGS) $(libasm_so_OBJECTS) $(libasm_so_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/asm_abort.Po -include ./$(DEPDIR)/asm_addint16.Po -include ./$(DEPDIR)/asm_addint32.Po -include ./$(DEPDIR)/asm_addint64.Po -include ./$(DEPDIR)/asm_addint8.Po -include ./$(DEPDIR)/asm_addsleb128.Po -include ./$(DEPDIR)/asm_addstrz.Po -include ./$(DEPDIR)/asm_adduint16.Po -include ./$(DEPDIR)/asm_adduint32.Po -include ./$(DEPDIR)/asm_adduint64.Po -include ./$(DEPDIR)/asm_adduint8.Po -include ./$(DEPDIR)/asm_adduleb128.Po -include ./$(DEPDIR)/asm_align.Po -include ./$(DEPDIR)/asm_begin.Po -include ./$(DEPDIR)/asm_end.Po -include ./$(DEPDIR)/asm_error.Po -include ./$(DEPDIR)/asm_fill.Po -include ./$(DEPDIR)/asm_getelf.Po -include ./$(DEPDIR)/asm_newabssym.Po -include ./$(DEPDIR)/asm_newcomsym.Po -include ./$(DEPDIR)/asm_newscn.Po -include ./$(DEPDIR)/asm_newscn_ingrp.Po -include ./$(DEPDIR)/asm_newscngrp.Po -include ./$(DEPDIR)/asm_newsubscn.Po -include ./$(DEPDIR)/asm_newsym.Po -include ./$(DEPDIR)/asm_scngrp_newsignature.Po -include ./$(DEPDIR)/symbolhash.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -#install: install-am -install-exec: install-exec-am -install-data: install-data-am -#uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-euincludeHEADERS - -install-exec-am: install-libLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ - ctags distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-info install-info-am install-libLIBRARIES install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-euincludeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -libasm.so: libasm_pic.a libasm.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION) \ - ../libebl/libebl.a ../libelf/libelf.so - ln -fs $@ $@.$(VERSION) - -%.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ - -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ - then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ - rm -f "$(DEPDIR)/$*.Tpo"; \ - else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ - fi - -install: install-am libasm.so - $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so - ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION) - ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so - -uninstall: uninstall-am - rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so - rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION) - rm -f $(DESTDIR)$(libdir)/libasm.so - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils - -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_la_SOURCES)) -# 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/libasm/Makefile.am b/libasm/Makefile.am index 9ba304d1..62b5ee29 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -1,38 +1,51 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 2002, 2004 Red Hat, Inc. +## Copyright (C) 2002, 2004, 2005, 2006, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H if MUDFLAP -AM_CFLAGS = -Wall +AM_CFLAGS = -fmudflap else -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = endif -INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \ +AM_CFLAGS += -std=gnu99 -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 +INCLUDES = -I. -I$(srcdir) -I.. \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw\ -I$(top_srcdir)/lib GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) VERSION = 1 -LINT = splint +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) lib_LIBRARIES = libasm.a if !MUDFLAP noinst_LIBRARIES = libasm_pic.a noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) endif -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libasm.h +pkginclude_HEADERS = libasm.h libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \ @@ -45,23 +58,30 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ asm_addint32.c asm_adduint32.c \ asm_addint64.c asm_adduint64.c \ asm_adduleb128.c asm_addsleb128.c \ + disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \ symbolhash.c if !MUDFLAP libasm_pic_a_SOURCES = am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) +libasm_so_LDLIBS = +if USE_TLS +libasm_so_LDLIBS += -lpthread +endif + libasm_so_SOURCES = libasm.so: libasm_pic.a libasm.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION) \ - ../libebl/libebl.a ../libelf/libelf.so + $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ + -Wl,--soname,$@.$(VERSION) \ + ../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS) + if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ln -fs $@ $@.$(VERSION) %.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ rm -f "$(DEPDIR)/$*.Tpo"; \ @@ -81,12 +101,7 @@ uninstall: uninstall-am rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils endif -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_la_SOURCES)) - noinst_HEADERS = libasmP.h symbolhash.h EXTRA_DIST = libasm.map -CLEANFILES = $(am_libasm_pic_a_OBJECTS) +CLEANFILES = $(am_libasm_pic_a_OBJECTS) *.gcno *.gcda libasm.so.$(VERSION) diff --git a/libasm/Makefile.in b/libasm/Makefile.in index 9683d4d2..6bc21374 100644 --- a/libasm/Makefile.in +++ b/libasm/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -16,17 +16,11 @@ -SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) $(libasm_so_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -42,17 +36,16 @@ build_triplet = @build@ host_triplet = @host@ @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) @MUDFLAP_TRUE@am_libasm_pic_a_OBJECTS = +@MUDFLAP_FALSE@@USE_TLS_TRUE@am__append_1 = -lpthread subdir = libasm -DIST_COMMON = $(euinclude_HEADERS) $(noinst_HEADERS) \ +DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -61,7 +54,7 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) AR = ar @@ -80,7 +73,8 @@ am_libasm_a_OBJECTS = asm_begin.$(OBJEXT) asm_abort.$(OBJEXT) \ asm_addint32.$(OBJEXT) asm_adduint32.$(OBJEXT) \ asm_addint64.$(OBJEXT) asm_adduint64.$(OBJEXT) \ asm_adduleb128.$(OBJEXT) asm_addsleb128.$(OBJEXT) \ - symbolhash.$(OBJEXT) + disasm_begin.$(OBJEXT) disasm_cb.$(OBJEXT) \ + disasm_end.$(OBJEXT) disasm_str.$(OBJEXT) symbolhash.$(OBJEXT) libasm_a_OBJECTS = $(am_libasm_a_OBJECTS) libasm_pic_a_AR = $(AR) $(ARFLAGS) libasm_pic_a_LIBADD = @@ -90,7 +84,7 @@ PROGRAMS = $(noinst_PROGRAMS) am_libasm_so_OBJECTS = libasm_so_OBJECTS = $(am_libasm_so_OBJECTS) libasm_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -101,14 +95,12 @@ SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) \ $(libasm_so_SOURCES) DIST_SOURCES = $(libasm_a_SOURCES) $(libasm_pic_a_SOURCES) \ $(libasm_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(noinst_HEADERS) +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -117,43 +109,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -162,7 +150,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -170,12 +157,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -188,39 +177,56 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -@MUDFLAP_TRUE@AM_CFLAGS = -Wall -INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Werror -Wunused \ +@MUDFLAP_FALSE@ -Wextra -Wformat=2 +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -std=gnu99 -Wall -Wshadow -Werror \ +@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 +INCLUDES = -I. -I$(srcdir) -I.. \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw\ -I$(top_srcdir)/lib GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) -LINT = splint +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + lib_LIBRARIES = libasm.a @MUDFLAP_FALSE@noinst_LIBRARIES = libasm_pic.a -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libasm.h +pkginclude_HEADERS = libasm.h libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \ asm_newsubscn.c asm_newsym.c asm_newcomsym.c \ @@ -232,19 +238,21 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ asm_addint32.c asm_adduint32.c \ asm_addint64.c asm_adduint64.c \ asm_adduleb128.c asm_addsleb128.c \ + disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \ symbolhash.c @MUDFLAP_FALSE@libasm_pic_a_SOURCES = @MUDFLAP_FALSE@am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) +@MUDFLAP_FALSE@libasm_so_LDLIBS = $(am__append_1) @MUDFLAP_FALSE@libasm_so_SOURCES = noinst_HEADERS = libasmP.h symbolhash.h EXTRA_DIST = libasm.map -CLEANFILES = $(am_libasm_pic_a_OBJECTS) +CLEANFILES = $(am_libasm_pic_a_OBJECTS) *.gcno *.gcda libasm.so.$(VERSION) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -269,13 +277,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -318,7 +326,7 @@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) @MUDFLAP_TRUE@libasm.so$(EXEEXT): $(libasm_so_OBJECTS) $(libasm_so_DEPENDENCIES) @MUDFLAP_TRUE@ @rm -f libasm.so$(EXEEXT) -@MUDFLAP_TRUE@ $(LINK) $(libasm_so_LDFLAGS) $(libasm_so_OBJECTS) $(libasm_so_LDADD) $(LIBS) +@MUDFLAP_TRUE@ $(LINK) $(libasm_so_OBJECTS) $(libasm_so_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -352,38 +360,41 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm_newsubscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm_newsym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm_scngrp_newsignature.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disasm_begin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disasm_cb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disasm_end.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disasm_str.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbolhash.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) +install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ done -uninstall-euincludeHEADERS: +uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -391,8 +402,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -404,8 +415,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -415,13 +426,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -435,22 +445,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -465,8 +474,8 @@ check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done @MUDFLAP_TRUE@install: install-am install-exec: install-exec-am @@ -514,14 +523,22 @@ info: info-am info-am: -install-data-am: install-euincludeHEADERS +install-data-am: install-pkgincludeHEADERS + +install-dvi: install-dvi-am install-exec-am: install-libLIBRARIES +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -541,31 +558,35 @@ ps: ps-am ps-am: -uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES +uninstall-am: uninstall-libLIBRARIES uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ ctags distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-info install-info-am install-libLIBRARIES install-man \ + 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-libLIBRARIES install-man install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-euincludeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES + tags uninstall uninstall-am uninstall-libLIBRARIES \ + uninstall-pkgincludeHEADERS @MUDFLAP_FALSE@libasm.so: libasm_pic.a libasm.map -@MUDFLAP_FALSE@ $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ -@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ -@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION) \ -@MUDFLAP_FALSE@ ../libebl/libebl.a ../libelf/libelf.so +@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ +@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ +@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION) \ +@MUDFLAP_FALSE@ ../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS) +@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi @MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION) @MUDFLAP_FALSE@%.os: %.c %.o -@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ +@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ @MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ @MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \ @@ -583,11 +604,6 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \ @MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION) @MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libasm.so @MUDFLAP_FALSE@ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils - -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_la_SOURCES)) # 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/libasm/asm_abort.c b/libasm/asm_abort.c index f35757ca..d12c163d 100644 --- a/libasm/asm_abort.c +++ b/libasm/asm_abort.c @@ -1,16 +1,28 @@ /* Abort operations on the assembler context, free all resources. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -36,7 +48,8 @@ asm_abort (ctx) (void) elf_end (ctx->out.elf); /* Now close the temporary file and remove it. */ - (void) unlink (ctx->tmp_fname); + if (ctx->fd != -1) + (void) unlink (ctx->tmp_fname); /* Free the resources. */ __libasm_finictx (ctx); diff --git a/libasm/asm_addint16.c b/libasm/asm_addint16.c index 98125171..5aa8d60e 100644 --- a/libasm/asm_addint16.c +++ b/libasm/asm_addint16.c @@ -1,16 +1,28 @@ /* Add integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 16 diff --git a/libasm/asm_addint32.c b/libasm/asm_addint32.c index 05ac3d25..25c50cea 100644 --- a/libasm/asm_addint32.c +++ b/libasm/asm_addint32.c @@ -1,16 +1,28 @@ /* Add integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 32 diff --git a/libasm/asm_addint64.c b/libasm/asm_addint64.c index f9d93f80..9116d94c 100644 --- a/libasm/asm_addint64.c +++ b/libasm/asm_addint64.c @@ -1,16 +1,28 @@ /* Add integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 64 diff --git a/libasm/asm_addint8.c b/libasm/asm_addint8.c index 35d9bf57..ff4376b8 100644 --- a/libasm/asm_addint8.c +++ b/libasm/asm_addint8.c @@ -1,16 +1,28 @@ /* Add integer to a section. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -53,22 +65,25 @@ FCT(SIZE) (asmscn, num) { // XXX Needs to use backend specified pseudo-ops if (SIZE == 8) - printf ("\t.byte\t%" PRId8 "\n", (int8_t) num); + fprintf (asmscn->ctx->out.file, "\t.byte\t%" PRId8 "\n", (int8_t) num); else if (SIZE == 16) - printf ("\t.value\t%" PRId16 "\n", (int16_t) num); + fprintf (asmscn->ctx->out.file, "\t.value\t%" PRId16 "\n", + (int16_t) num); else if (SIZE == 32) - printf ("\t.long\t%" PRId32 "\n", (int32_t) num); + fprintf (asmscn->ctx->out.file, "\t.long\t%" PRId32 "\n", + (int32_t) num); else { // XXX This is not necessary for 64-bit machines bool is_leb = (elf_getident (asmscn->ctx->out.elf, NULL)[EI_DATA] == ELFDATA2LSB); - printf ("\t.long\t%" PRId32 "\n\t.long\t%" PRId32 "\n", - (int32_t) (is_leb - ? num % 0x100000000ll : num / 0x100000000ll), - (int32_t) (is_leb - ? num / 0x100000000ll : num % 0x100000000ll)); + fprintf (asmscn->ctx->out.file, + "\t.long\t%" PRId32 "\n\t.long\t%" PRId32 "\n", + (int32_t) (is_leb + ? num % 0x100000000ll : num / 0x100000000ll), + (int32_t) (is_leb + ? num / 0x100000000ll : num % 0x100000000ll)); } } else diff --git a/libasm/asm_addsleb128.c b/libasm/asm_addsleb128.c index 0661b36e..614ba69c 100644 --- a/libasm/asm_addsleb128.c +++ b/libasm/asm_addsleb128.c @@ -1,16 +1,28 @@ /* Add signed little endian base 128 integer to a section. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -37,7 +49,7 @@ asm_addsleb128 (asmscn, num) } if (unlikely (asmscn->ctx->textp)) - printf ("\t.sleb128\t%" PRId32 "\n", num); + fprintf (asmscn->ctx->out.file, "\t.sleb128\t%" PRId32 "\n", num); else { char tmpbuf[(sizeof (num) * 8 + 6) / 7]; diff --git a/libasm/asm_addstrz.c b/libasm/asm_addstrz.c index e183b0b5..ddd03541 100644 --- a/libasm/asm_addstrz.c +++ b/libasm/asm_addstrz.c @@ -1,16 +1,28 @@ /* Add string to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_adduint16.c b/libasm/asm_adduint16.c index 8c1e698f..063e5d42 100644 --- a/libasm/asm_adduint16.c +++ b/libasm/asm_adduint16.c @@ -1,16 +1,28 @@ /* Add unsigned integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 16 diff --git a/libasm/asm_adduint32.c b/libasm/asm_adduint32.c index a2257954..6dc814f8 100644 --- a/libasm/asm_adduint32.c +++ b/libasm/asm_adduint32.c @@ -1,16 +1,28 @@ /* Add unsigned integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 32 diff --git a/libasm/asm_adduint64.c b/libasm/asm_adduint64.c index edda4d38..71bb16a0 100644 --- a/libasm/asm_adduint64.c +++ b/libasm/asm_adduint64.c @@ -1,16 +1,28 @@ /* Add unsigned integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define SIZE 64 diff --git a/libasm/asm_adduint8.c b/libasm/asm_adduint8.c index 7bfb3414..c8801537 100644 --- a/libasm/asm_adduint8.c +++ b/libasm/asm_adduint8.c @@ -1,16 +1,28 @@ /* Add unsigned integer to a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_adduleb128.c b/libasm/asm_adduleb128.c index 521d265a..042c76b3 100644 --- a/libasm/asm_adduleb128.c +++ b/libasm/asm_adduleb128.c @@ -1,16 +1,28 @@ /* Add integer to a section. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -37,7 +49,7 @@ asm_adduleb128 (asmscn, num) } if (unlikely (asmscn->ctx->textp)) - printf ("\t.uleb128\t%" PRIu32 "\n", num); + fprintf (asmscn->ctx->out.file, "\t.uleb128\t%" PRIu32 "\n", num); else { char tmpbuf[(sizeof (num) * 8 + 6) / 7]; diff --git a/libasm/asm_align.c b/libasm/asm_align.c index e7350924..b5a573b2 100644 --- a/libasm/asm_align.c +++ b/libasm/asm_align.c @@ -1,21 +1,34 @@ /* Align section. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <inttypes.h> #include <stdlib.h> #include <sys/param.h> @@ -39,6 +52,25 @@ asm_align (asmscn, value) return -1; } + if (unlikely (asmscn->ctx->textp)) + { + fprintf (asmscn->ctx->out.file, "\t.align %" PRId32 ", ", + (int32_t) value); + if (asmscn->pattern->len == 1) + fprintf (asmscn->ctx->out.file, "%02hhx\n", asmscn->pattern->bytes[0]); + else + { + fputc_unlocked ('"', asmscn->ctx->out.file); + + for (size_t cnt = 0; cnt < asmscn->pattern->len; ++cnt) + fprintf (asmscn->ctx->out.file, "\\x%02hhx", + asmscn->pattern->bytes[cnt]); + + fputs_unlocked ("\"\n", asmscn->ctx->out.file); + } + return 0; + } + rwlock_wrlock (asmscn->ctx->lock); int result = 0; @@ -47,10 +79,7 @@ asm_align (asmscn, value) if ((asmscn->offset & (value - 1)) != 0) { /* Add fillbytes. */ - size_t cnt; - size_t byteptr; - - cnt = value - (asmscn->offset & (value - 1)); + size_t cnt = value - (asmscn->offset & (value - 1)); /* Ensure there is enough room to add the fill bytes. */ result = __libasm_ensure_section_space (asmscn, cnt); @@ -59,7 +88,7 @@ asm_align (asmscn, value) /* Fill in the bytes. We align the pattern according to the current offset. */ - byteptr = asmscn->offset % asmscn->pattern->len; + size_t byteptr = asmscn->offset % asmscn->pattern->len; /* Update the total size. */ asmscn->offset += cnt; diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c index 3896f78f..b8094dcd 100644 --- a/libasm/asm_begin.c +++ b/libasm/asm_begin.c @@ -1,16 +1,28 @@ /* Create descriptor for assembling. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -18,6 +30,8 @@ #include <assert.h> #include <errno.h> +#include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -30,12 +44,27 @@ static AsmCtx_t * prepare_text_output (AsmCtx_t *result) { + if (result->fd == -1) + result->out.file = stdout; + else + { + result->out.file = fdopen (result->fd, "a"); + if (result->out.file == NULL) + { + close (result->fd); + free (result); + result = NULL; + } + + __fsetlocking (result->out.file, FSETLOCKING_BYCALLER); + } + return result; } static AsmCtx_t * -prepare_binary_output (AsmCtx_t *result, int machine, int klass, int data) +prepare_binary_output (AsmCtx_t *result, Ebl *ebl) { GElf_Ehdr *ehdr; GElf_Ehdr ehdr_mem; @@ -53,7 +82,8 @@ prepare_binary_output (AsmCtx_t *result, int machine, int klass, int data) } /* Create the ELF header for the output file. */ - if (gelf_newehdr (result->out.elf, klass) == 0) + int class = ebl_get_elfclass (ebl); + if (gelf_newehdr (result->out.elf, class) == 0) goto err_libelf; ehdr = gelf_getehdr (result->out.elf, &ehdr_mem); @@ -65,11 +95,10 @@ prepare_binary_output (AsmCtx_t *result, int machine, int klass, int data) /* Set the ELF version. */ ehdr->e_version = EV_CURRENT; - /* Use the machine value the user provided. */ - ehdr->e_machine = machine; - /* Same for the class and endianness. */ - ehdr->e_ident[EI_CLASS] = klass; - ehdr->e_ident[EI_DATA] = data; + /* Use the machine, class, and endianess values from the Ebl descriptor. */ + ehdr->e_machine = ebl_get_elfmachine (ebl); + ehdr->e_ident[EI_CLASS] = class; + ehdr->e_ident[EI_DATA] = ebl_get_elfdata (ebl); memcpy (&ehdr->e_ident[EI_MAG0], ELFMAG, SELFMAG); @@ -95,47 +124,48 @@ prepare_binary_output (AsmCtx_t *result, int machine, int klass, int data) AsmCtx_t * -asm_begin (fname, textp, machine, klass, data) +asm_begin (fname, ebl, textp) const char *fname; + Ebl *ebl; bool textp; - int machine; - int klass; - int data; { - size_t fname_len = strlen (fname); - AsmCtx_t *result; - + if (fname == NULL && ! textp) + return NULL; - /* First order of business: find the appropriate backend. If it - does not exist we don't have to look further. */ - // XXX + size_t fname_len = fname != NULL ? strlen (fname) : 0; /* Create the file descriptor. We do not generate the output file right away. Instead we create a temporary file in the same directory which, if everything goes alright, will replace a possibly existing file with the given name. */ - result = (AsmCtx_t *) malloc (sizeof (AsmCtx_t) + 2 * fname_len + 9); + AsmCtx_t *result + = (AsmCtx_t *) malloc (sizeof (AsmCtx_t) + 2 * fname_len + 9); if (result == NULL) return NULL; - /* Initialize the lock. */ - rwlock_init (result->lock); + /* Initialize the lock. */ + rwlock_init (result->lock); - /* Create the name of the temporary file. */ - result->fname = stpcpy (mempcpy (result->tmp_fname, fname, fname_len), - ".XXXXXX") + 1; - memcpy (result->fname, fname, fname_len + 1); - - /* Create the temporary file. */ - result->fd = mkstemp (result->tmp_fname); - if (result->fd == -1) + if (fname != NULL) { - int save_errno = errno; - free (result); - __libasm_seterrno (ASM_E_CANNOT_CREATE); - errno = save_errno; - return NULL; + /* Create the name of the temporary file. */ + result->fname = stpcpy (mempcpy (result->tmp_fname, fname, fname_len), + ".XXXXXX") + 1; + memcpy (result->fname, fname, fname_len + 1); + + /* Create the temporary file. */ + result->fd = mkstemp (result->tmp_fname); + if (result->fd == -1) + { + int save_errno = errno; + free (result); + __libasm_seterrno (ASM_E_CANNOT_CREATE); + errno = save_errno; + return NULL; + } } + else + result->fd = -1; /* Initialize the counter for temporary symbols. */ result->tempsym_count = 0; @@ -145,7 +175,7 @@ asm_begin (fname, textp, machine, klass, data) if (textp) result = prepare_text_output (result); else - result = prepare_binary_output (result, machine, klass, data); + result = prepare_binary_output (result, ebl); return result; } diff --git a/libasm/asm_end.c b/libasm/asm_end.c index 01326a11..1d815fa6 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -1,16 +1,28 @@ /* Finalize operations on the assembler context, free all resources. - Copyright (C) 2002, 2003 Red Hat, Inc. + Copyright (C) 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -31,9 +43,14 @@ static int -text_end (AsmCtx_t *ctx) +text_end (AsmCtx_t *ctx __attribute__ ((unused))) { - // XXX Does anything have to be done? + if (fclose (ctx->out.file) != 0) + { + __libasm_seterrno (ASM_E_IOERROR); + return -1; + } + return 0; } @@ -93,9 +110,10 @@ binary_end (AsmCtx_t *ctx) Elf_Data *newdata = elf_newdata (scn); if (newdata == NULL) - error (EXIT_FAILURE, 0, - _("cannot create section for output file: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } newdata->d_buf = content->data; newdata->d_type = ELF_T_BYTE; @@ -114,26 +132,19 @@ binary_end (AsmCtx_t *ctx) /* Create the symbol table if necessary. */ if (ctx->nsymbol_tab > 0) { - Elf_Scn *symscn; - Elf_Scn *strscn; - AsmSym_t *sym; - int ptr_local; - int ptr_nonlocal; - GElf_Sym syment; - uint32_t *xshndx = NULL; - void *runp; - /* Create the symbol table and string table section names. */ symscn_strent = ebl_strtabadd (ctx->section_strtab, ".symtab", 8); strscn_strent = ebl_strtabadd (ctx->section_strtab, ".strtab", 8); /* Create the symbol string table section. */ - strscn = elf_newscn (ctx->out.elf); + Elf_Scn *strscn = elf_newscn (ctx->out.elf); strtabdata = elf_newdata (strscn); shdr = gelf_getshdr (strscn, &shdr_mem); if (strtabdata == NULL || shdr == NULL) - error (EXIT_FAILURE, 0, _("cannot create section for output file: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } strscnndx = elf_ndxscn (strscn); ebl_strtabfinalize (ctx->symbol_strtab, strtabdata); @@ -144,12 +155,14 @@ binary_end (AsmCtx_t *ctx) (void) gelf_update_shdr (strscn, shdr); /* Create the symbol table section. */ - symscn = elf_newscn (ctx->out.elf); + Elf_Scn *symscn = elf_newscn (ctx->out.elf); data = elf_newdata (symscn); shdr = gelf_getshdr (symscn, &shdr_mem); if (data == NULL || shdr == NULL) - error (EXIT_FAILURE, 0, _("cannot create section for output file: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } symscnndx = elf_ndxscn (symscn); /* We know how many symbols there will be in the symbol table. */ @@ -163,20 +176,19 @@ binary_end (AsmCtx_t *ctx) data->d_off = 0; /* Clear the first entry. */ + GElf_Sym syment; memset (&syment, '\0', sizeof (syment)); (void) gelf_update_sym (data, 0, &syment); /* Iterate over the symbol table. */ - runp = NULL; - ptr_local = 1; /* Start with index 1; zero remains unused. */ - ptr_nonlocal = ctx->nsymbol_tab; + void *runp = NULL; + int ptr_local = 1; /* Start with index 1; zero remains unused. */ + int ptr_nonlocal = ctx->nsymbol_tab; + uint32_t *xshndx = NULL; + AsmSym_t *sym; while ((sym = asm_symbol_tab_iterate (&ctx->symbol_tab, &runp)) != NULL) if (asm_emit_symbol_p (ebl_string (sym->strent))) { - int ptr; - Elf32_Word ndx; - Elf_Scn *scn; - assert (ptr_local <= ptr_nonlocal); syment.st_name = ebl_strtaboffset (sym->strent); @@ -187,14 +199,15 @@ binary_end (AsmCtx_t *ctx) /* Add local symbols at the beginning, the other from the end. */ - ptr = sym->binding == STB_LOCAL ? ptr_local++ : ptr_nonlocal--; + int ptr = sym->binding == STB_LOCAL ? ptr_local++ : ptr_nonlocal--; /* Determine the section index. We have to handle the overflow correctly. */ - scn = (sym->scn->subsection_id == 0 - ? sym->scn->data.main.scn - : sym->scn->data.up->data.main.scn); + Elf_Scn *scn = (sym->scn->subsection_id == 0 + ? sym->scn->data.main.scn + : sym->scn->data.up->data.main.scn); + Elf32_Word ndx; if (unlikely (scn == ASM_ABS_SCN)) ndx = SHN_ABS; else if (unlikely (scn == ASM_COM_SCN)) @@ -206,15 +219,15 @@ binary_end (AsmCtx_t *ctx) /* The extended section index section does not yet exist. */ Elf_Scn *xndxscn; - size_t symscnndx = elf_ndxscn (symscn); xndxscn = elf_newscn (ctx->out.elf); xndxdata = elf_newdata (xndxscn); shdr = gelf_getshdr (xndxscn, &shdr_mem); if (xndxdata == NULL || shdr == NULL) - error (EXIT_FAILURE, 0, _("\ -cannot create extended section index table: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } xndxscnndx = elf_ndxscn (xndxscn); shdr->sh_type = SHT_SYMTAB_SHNDX; @@ -276,8 +289,10 @@ cannot create extended section index table: %s"), shstrtabdata = elf_newdata (shstrscn); shdr = gelf_getshdr (shstrscn, &shdr_mem); if (shstrscn == NULL || shstrtabdata == NULL || shdr == NULL) - error (EXIT_FAILURE, 0, _("cannot create section for output file: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } /* Add the name of the section header string table. */ @@ -300,9 +315,6 @@ cannot create extended section index table: %s"), do { Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - Elf_Data *data; Elf32_Word *grpdata; scn = runp->scn; @@ -312,9 +324,10 @@ cannot create extended section index table: %s"), data = elf_newdata (scn); if (data == NULL) - error (EXIT_FAILURE, 0, - _("cannot create section group for output file: %s"), - elf_errmsg (-1)); + { + __libasm_seterrno (ASM_E_LIBELF); + return -1; + } /* It is correct to use 'elf32_fsize' instead of 'gelf_fsize' here. */ diff --git a/libasm/asm_error.c b/libasm/asm_error.c index 9d2d81ed..29c54cb0 100644 --- a/libasm/asm_error.c +++ b/libasm/asm_error.c @@ -1,16 +1,28 @@ /* Error handling in libasm. - Copyright (C) 2002, 2004 Red Hat, Inc. + Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -112,7 +124,9 @@ static const char *msgs[ASM_E_NUM] = [ASM_E_CANNOT_CHMOD] = N_("cannot change mode of output file"), [ASM_E_CANNOT_RENAME] = N_("cannot rename output file"), [ASM_E_DUPLSYM] = N_("duplicate symbol"), - [ASM_E_TYPE] = N_("invalid section type for operation") + [ASM_E_TYPE] = N_("invalid section type for operation"), + [ASM_E_IOERROR] = N_("error during output of data"), + [ASM_E_ENOSUP] = N_("no backend support available"), }; const char * @@ -146,7 +160,7 @@ asm_errmsg (error) last_error = global_error; if (error < -1) - return _("Unknown error"); + return _("unknown error"); if (error == 0 && last_error == 0) /* No error. */ return NULL; diff --git a/libasm/asm_fill.c b/libasm/asm_fill.c index 67b64417..66f7134b 100644 --- a/libasm/asm_fill.c +++ b/libasm/asm_fill.c @@ -1,16 +1,28 @@ /* Determine fill pattern for a section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_getelf.c b/libasm/asm_getelf.c index 3bbb0d90..df5cffda 100644 --- a/libasm/asm_getelf.c +++ b/libasm/asm_getelf.c @@ -1,16 +1,28 @@ /* Return ELF descriptor associated with the assembler context. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_newabssym.c b/libasm/asm_newabssym.c index fba46f0f..1dacb012 100644 --- a/libasm/asm_newabssym.c +++ b/libasm/asm_newabssym.c @@ -1,16 +1,28 @@ /* Create new ABS symbol. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_newcomsym.c b/libasm/asm_newcomsym.c index 61e5a909..4a7144ec 100644 --- a/libasm/asm_newcomsym.c +++ b/libasm/asm_newcomsym.c @@ -1,16 +1,28 @@ /* Create new COMMON symbol. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c index 75890a60..8a5e78b5 100644 --- a/libasm/asm_newscn.c +++ b/libasm/asm_newscn.c @@ -1,16 +1,28 @@ /* Create new section in output file. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -81,7 +93,8 @@ text_newscn (AsmScn_t *result, GElf_Word type, GElf_Xword flags) /* Terminate the string. */ *wp = '\0'; - printf ("\t.section \"%s\"%s%s\n", result->name, flagstr, typestr); + fprintf (result->ctx->out.file, "\t.section \"%s\"%s%s\n", + result->name, flagstr, typestr); return result; } diff --git a/libasm/asm_newscn_ingrp.c b/libasm/asm_newscn_ingrp.c index dc0c4351..c17e22e9 100644 --- a/libasm/asm_newscn_ingrp.c +++ b/libasm/asm_newscn_ingrp.c @@ -1,16 +1,28 @@ /* Create new section, which is member of a group, in output file. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -29,7 +41,7 @@ asm_newscn_ingrp (ctx, scnname, type, flags, grp) GElf_Xword flags; AsmScnGrp_t *grp; { - AsmScn_t *result = __asm_newscn_internal (ctx, scnname, type, flags); + AsmScn_t *result = INTUSE (asm_newscn) (ctx, scnname, type, flags); if (likely (result != NULL)) { diff --git a/libasm/asm_newscngrp.c b/libasm/asm_newscngrp.c index c1c8be3e..1eed25cd 100644 --- a/libasm/asm_newscngrp.c +++ b/libasm/asm_newscngrp.c @@ -1,16 +1,28 @@ /* Create new section group. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_newsubscn.c b/libasm/asm_newsubscn.c index e767720e..d1a86dd7 100644 --- a/libasm/asm_newsubscn.c +++ b/libasm/asm_newsubscn.c @@ -1,16 +1,28 @@ /* Create new subsection section in given section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c index 6a6df2d8..e2727b15 100644 --- a/libasm/asm_newsym.c +++ b/libasm/asm_newsym.c @@ -1,16 +1,28 @@ /* Define new symbol for current position in given section. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -54,9 +66,13 @@ asm_newsym (asmscn, name, size, type, binding) // XXX This requires getting the format from the machine backend. */ snprintf (tempsym, TEMPSYMLEN, ".L%07u", asmscn->ctx->tempsym_count++); + + name = tempsym; } - result = (AsmSym_t *) malloc (sizeof (AsmSym_t)); + size_t name_len = strlen (name) + 1; + + result = (AsmSym_t *) malloc (sizeof (AsmSym_t) + name_len); if (result == NULL) return NULL; @@ -69,15 +85,12 @@ asm_newsym (asmscn, name, size, type, binding) result->binding = binding; result->symidx = 0; result->strent = ebl_strtabadd (asmscn->ctx->symbol_strtab, - name ?: tempsym, 0); + memcpy (result + 1, name, name_len), 0); if (unlikely (asmscn->ctx->textp)) { /* We are only interested in the name and don't need to know whether it is a local name or not. */ - if (name == NULL) - name = tempsym; - /* First print the binding pseudo-op. */ if (binding == STB_GLOBAL) fprintf (asmscn->ctx->out.file, "\t.globl\t%s\n", name); @@ -97,15 +110,21 @@ asm_newsym (asmscn, name, size, type, binding) else { /* Put the symbol in the hash table so that we can later find it. */ - if (asm_symbol_tab_insert (&asmscn->ctx->symbol_tab, - elf_hash (name ?: tempsym), result) != 0) + if (asm_symbol_tab_insert (&asmscn->ctx->symbol_tab, elf_hash (name), + result) != 0) { /* The symbol already exists. */ __libasm_seterrno (ASM_E_DUPLSYM); + /* Note that we can free the entry since there must be no + reference in the string table to the string. We can only + fail to insert the symbol into the symbol table if there + is already a symbol with this name. In this case the + ebl_strtabadd function would use the previously provided + name. */ free (result); result = NULL; } - else if (name != NULL && asm_emit_symbol_p (name)) + else if (name != tempsym && asm_emit_symbol_p (name)) /* Only count non-private symbols. */ ++asmscn->ctx->nsymbol_tab; } diff --git a/libasm/asm_scngrp_newsignature.c b/libasm/asm_scngrp_newsignature.c index d4042a24..9908e403 100644 --- a/libasm/asm_scngrp_newsignature.c +++ b/libasm/asm_scngrp_newsignature.c @@ -1,16 +1,28 @@ /* Update signature of section group. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/disasm_begin.c b/libasm/disasm_begin.c new file mode 100644 index 00000000..5b98b2a3 --- /dev/null +++ b/libasm/disasm_begin.c @@ -0,0 +1,61 @@ +/* Create context descriptor for disassembler. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdlib.h> + +#include "libasmP.h" +#include "../libebl/libeblP.h" + + +DisasmCtx_t * +disasm_begin (Ebl *ebl, Elf *elf, DisasmGetSymCB_t symcb) +{ + if (ebl == NULL) + return NULL; + + if (ebl->disasm == NULL) + { + __libasm_seterrno (ASM_E_ENOSUP); + return NULL; + } + + DisasmCtx_t *ctx = (DisasmCtx_t *) malloc (sizeof (DisasmCtx_t)); + if (ctx == NULL) + { + __libasm_seterrno (ASM_E_NOMEM); + return NULL; + } + + ctx->ebl = ebl; + ctx->elf = elf; + ctx->symcb = symcb; + + return ctx; +} diff --git a/libasm/disasm_cb.c b/libasm/disasm_cb.c new file mode 100644 index 00000000..56101258 --- /dev/null +++ b/libasm/disasm_cb.c @@ -0,0 +1,176 @@ +/* Copyright (C) 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> + +#include "libasmP.h" +#include "../libebl/libeblP.h" + + +struct symtoken +{ + DisasmCtx_t *ctx; + void *symcbarg; +}; + + +static int +default_elf_getsym (GElf_Addr addr, Elf32_Word scnndx, GElf_Addr value, + char **buf, size_t *buflen, void *arg) +{ + struct symtoken *symtoken = (struct symtoken *) arg; + + /* First try the user provided function. */ + if (symtoken->ctx->symcb != NULL) + { + int res = symtoken->ctx->symcb (addr, scnndx, value, buf, buflen, + symtoken->symcbarg); + if (res >= 0) + return res; + } + + // XXX Look up in ELF file. + + return -1; +} + + +struct symaddrpair +{ + GElf_Addr addr; + const char *name; +}; + + +static void +read_symtab_exec (DisasmCtx_t *ctx) +{ + /* We simply use all we can get our hands on. This will produce + some duplicate information but this is no problem, we simply + ignore the latter definitions. */ + Elf_Scn *scn= NULL; + while ((scn = elf_nextscn (ctx->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + Elf_Data *data; + if (shdr == NULL || shdr->sh_type != SHT_SYMTAB + || (data = elf_getdata (scn, NULL)) == NULL) + continue; + + int xndxscnidx = elf_scnshndx (scn); + Elf_Data *xndxdata = NULL; + if (xndxscnidx > 0) + xndxdata = elf_getdata (elf_getscn (ctx->elf, xndxscnidx), NULL); + + /* Iterate over all symbols. Add all defined symbols. */ + int nsyms = shdr->sh_size / shdr->sh_entsize; + for (int cnt = 1; cnt < nsyms; ++cnt) + { + Elf32_Word xshndx; + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, + &xshndx); + if (sym == NULL) + continue; + + /* Undefined symbols are useless here. */ + if (sym->st_shndx == SHN_UNDEF) + continue; + + + } + } +} + + +static void +read_symtab (DisasmCtx_t *ctx) +{ + /* Find the symbol table(s). */ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (ctx->elf, &ehdr_mem); + if (ehdr == NULL) + return; + + switch (ehdr->e_type) + { + case ET_EXEC: + case ET_DYN: + read_symtab_exec (ctx); + break; + + case ET_REL: + // XXX Handle + break; + + default: + break; + } +} + + +static int +null_elf_getsym (GElf_Addr addr __attribute__ ((unused)), + Elf32_Word scnndx __attribute__ ((unused)), + GElf_Addr value __attribute__ ((unused)), + char **buf __attribute__ ((unused)), + size_t *buflen __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ + return -1; +} + + +int +disasm_cb (DisasmCtx_t *ctx, const uint8_t **startp, const uint8_t *end, + GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, + void *outcbarg, void *symcbarg) +{ + struct symtoken symtoken; + DisasmGetSymCB_t getsym = ctx->symcb ?: null_elf_getsym; + + if (ctx->elf != NULL) + { + /* Read all symbols of the ELF file and stuff them into a hash + table. The key is the address and the section index. */ + read_symtab (ctx); + + symtoken.ctx = ctx; + symtoken.symcbarg = symcbarg; + + symcbarg = &symtoken; + + getsym = default_elf_getsym; + } + + return ctx->ebl->disasm (startp, end, addr, fmt, outcb, getsym, outcbarg, + symcbarg); +} +INTDEF (disasm_cb) diff --git a/libasm/disasm_end.c b/libasm/disasm_end.c new file mode 100644 index 00000000..ee8b2f98 --- /dev/null +++ b/libasm/disasm_end.c @@ -0,0 +1,42 @@ +/* Release descriptor for disassembler. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdlib.h> + +#include "libasmP.h" + + +int +disasm_end (DisasmCtx_t *ctx) +{ + free (ctx); + + return 0; +} diff --git a/libasm/disasm_str.c b/libasm/disasm_str.c new file mode 100644 index 00000000..856fd11d --- /dev/null +++ b/libasm/disasm_str.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> + +#include "libasmP.h" + + +struct buffer +{ + char *buf; + size_t len; +}; + + +static int +buffer_cb (char *str, size_t len, void *arg) +{ + struct buffer *buffer = (struct buffer *) arg; + + if (len > buffer->len) + /* Return additional needed space. */ + return len - buffer->len; + + buffer->buf = mempcpy (buffer->buf, str, len); + buffer->len = len; + + return 0; +} + + +int +disasm_str (DisasmCtx_t *ctx, const uint8_t **startp, const uint8_t *end, + GElf_Addr addr, const char *fmt, char **bufp, size_t len, + void *symcbarg) +{ + struct buffer buffer = { .buf = *bufp, .len = len }; + + int res = INTUSE(disasm_cb) (ctx, startp, end, addr, fmt, buffer_cb, &buffer, + symcbarg); + *bufp = buffer.buf; + return res; +} diff --git a/libasm/libasm.h b/libasm/libasm.h index dbdd6fc2..307c7349 100644 --- a/libasm/libasm.h +++ b/libasm/libasm.h @@ -1,15 +1,27 @@ /* Interface for libasm. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2002, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBASM_H #define _LIBASM_H 1 @@ -17,7 +29,7 @@ #include <stdbool.h> #include <stdint.h> -#include <gelf.h> +#include <libebl.h> /* Opaque type for the assembler context descriptor. */ @@ -33,6 +45,20 @@ typedef struct AsmScnGrp AsmScnGrp_t; typedef struct AsmSym AsmSym_t; +/* Opaque type for the disassembler context descriptor. */ +typedef struct DisasmCtx DisasmCtx_t; + +/* Type used for callback functions to retrieve symbol name. The + symbol reference is in the section designated by the second parameter + at an offset described by the first parameter. The value is the + third parameter. */ +typedef int (*DisasmGetSymCB_t) (GElf_Addr, Elf32_Word, GElf_Addr, char **, + size_t *, void *); + +/* Output function callback. */ +typedef int (*DisasmOutputCB_t) (char *, size_t, void *); + + #ifdef __cplusplus extern "C" { #endif @@ -43,8 +69,7 @@ extern "C" { corresponds to an EM_ constant from <elf.h>, KLASS specifies the class (32- or 64-bit), and DATA specifies the byte order (little or big endian). */ -extern AsmCtx_t *asm_begin (const char *fname, bool textp, int machine, - int klass, int data); +extern AsmCtx_t *asm_begin (const char *fname, Ebl *ebl, bool textp); /* Abort the operation on the assembler context and free all resources. */ extern int asm_abort (AsmCtx_t *ctx); @@ -148,6 +173,25 @@ extern int asm_errno (void); string is returned. */ extern const char *asm_errmsg (int __error); + +/* Create context descriptor for disassembler. */ +extern DisasmCtx_t *disasm_begin (Ebl *ebl, Elf *elf, DisasmGetSymCB_t symcb); + +/* Release descriptor for disassembler. */ +extern int disasm_end (DisasmCtx_t *ctx); + +/* Produce of disassembly output for given memory, store text in + provided buffer. */ +extern int disasm_str (DisasmCtx_t *ctx, const uint8_t **startp, + const uint8_t *end, GElf_Addr addr, const char *fmt, + char **bufp, size_t len, void *symcbarg); + +/* Produce disassembly output for given memory and output it using the + given callback functions. */ +extern int disasm_cb (DisasmCtx_t *ctx, const uint8_t **startp, + const uint8_t *end, GElf_Addr addr, const char *fmt, + DisasmOutputCB_t outcb, void *outcbarg, void *symcbarg); + #ifdef __cplusplus } #endif diff --git a/libasm/libasm.map b/libasm/libasm.map index b0b5b5b7..a36cdbfe 100644 --- a/libasm/libasm.map +++ b/libasm/libasm.map @@ -28,6 +28,11 @@ ELFUTILS_1.0 { asm_newsym; asm_scngrp_newsignature; + disasm_begin; + disasm_cb; + disasm_end; + disasm_str; + local: *; }; diff --git a/libasm/libasmP.h b/libasm/libasmP.h index 2e4954f6..ee7005f5 100644 --- a/libasm/libasmP.h +++ b/libasm/libasmP.h @@ -1,15 +1,27 @@ /* Internal definitions for libasm. - Copyright (C) 2002, 2004 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBASMP_H #define _LIBASMP_H 1 @@ -17,7 +29,6 @@ #include <stdio.h> #include <libasm.h> -#include <libebl.h> /* gettext helper macros. */ #define _(Str) dgettext ("elfutils", Str) @@ -35,6 +46,8 @@ enum ASM_E_DUPLSYM, /* Duplicate symbol definition. */ ASM_E_LIBELF, /* Refer to error in libelf. */ ASM_E_TYPE, /* Invalid section type for operation. */ + ASM_E_IOERROR, /* Error during output of data. */ + ASM_E_ENOSUP, /* No backend support. */ ASM_E_NUM /* Keep this entry as the last. */ }; @@ -223,6 +236,21 @@ struct AsmScnGrp }; +/* Descriptor for disassembler. */ +struct DisasmCtx +{ + /* Handle for the backend library with the disassembler routine. */ + Ebl *ebl; + + /* ELF file containing all the data passed to the function. This + allows to look up symbols. */ + Elf *elf; + + /* Callback function to determine symbol names. */ + DisasmGetSymCB_t symcb; +}; + + /* The default fill pattern: one zero byte. */ extern const struct FillPattern *__libasm_default_pattern attribute_hidden; @@ -257,6 +285,14 @@ extern int __asm_addint64_internal (AsmScn_t *asmscn, int64_t num) attribute_hidden; +/* Produce disassembly output for given memory and output it using the + given callback functions. */ +extern int __disasm_cb_internal (DisasmCtx_t *ctx, const uint8_t **startp, + const uint8_t *end, GElf_Addr addr, + const char *fmt, DisasmOutputCB_t outcb, + void *outcbarp, void *symcbarg) + attribute_hidden; + /* Test whether given symbol is an internal symbol and if yes, whether we should nevertheless emit it in the symbol table. */ diff --git a/libasm/symbolhash.c b/libasm/symbolhash.c index 62d2c852..e3aa5dda 100644 --- a/libasm/symbolhash.c +++ b/libasm/symbolhash.c @@ -1,16 +1,28 @@ /* Symbol hash table implementation. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libasm/symbolhash.h b/libasm/symbolhash.h index 4377b4b5..28768da7 100644 --- a/libasm/symbolhash.h +++ b/libasm/symbolhash.h @@ -1,15 +1,27 @@ /* Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef SYMBOLHASH_H #define SYMBOLHASH_H 1 diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index c46ffcb6..5bc89f9f 100644 --- a/libcpu/ChangeLog +++ b/libcpu/ChangeLog @@ -1,3 +1,320 @@ +2008-12-31 Ulrich Drepper <drepper@redhat.com> + + * i386_disasm.c (i386_disasm): Correct resizing of buffer. + + * i386_parse.y (struct argstring): Add off element. + (off_op_str): New global variable. + (print_op_str): Print strings as concatenated strings. Keep track + of index and length. Update ->off element. + (print_op_str_idx): New function. + (instrtable_out): Mark op%d_fct as const. + Emit two tables for the strings: the string itself (op%d_str) and the + index table (op%d_str_idx). + * i386_disasm.c (i386_disasm): Adjust for new op%d_str definition. + + * i386_disasm.c [X86_64] (i386_disasm): Handle rex prefix when + printing only prefix. + + * i386_disasm.c (i386_disasm): Minor optimizations. + + * i386_parse.y (instrtable_out): No need to emit index, the reader can + keep track. + * i386_disasm.c (i386_disasm): The index is not emitted anymore, no + need to skip it. + + * i386_disasm.c (amd3dnow): Mark as const. + + * defs/i386: Add blendvpd and blendvps opcodes. + +2008-12-30 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Add blendpd and blendps opcodes. + +2008-12-19 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Add entry for AMD 3DNOW. + * i386_disasm.c: Implement AMD 3DNOW disassembly. + +2008-12-17 Ulrich Drepper <drepper@redhat.com> + + * i386_disasm.c (i386_disasm): If instruction matches prefix, + undoing the prefix match finishes the instruction. + +2008-01-21 Roland McGrath <roland@redhat.com> + + * defs/i386: Fix typo in comment. + * i386_disasm.c (i386_disasm): Handle cltq, cqto. + + * i386_parse.y: Add sanity check for NMNES macro value. + * Makefile.am (i386_parse.o): Fix target in dependency rule. + (i386_parse.h): New target with empty commands. + (i386_lex.o): Depend on it in place of i386_parse.c. + +2008-01-21 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Remove defs/x86_64. + +2008-01-14 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Add fixes for opcodes with register number in opcode, + 64-bit immediate forms, nop with rex.B. + * i386_data.h [X86_64] (FCT_imm64$w): New function. + (FCT_oreg): New function. + (FCT_oreg$w): New function. + * i386_disasm.c (i386_disasm): Reinitialize fmt always before + starting the loop to process the string. Handle 0x90 special for + x86-64. + * i386_parse.y (fillin_arg): Expand synonyms before concatening to + form the function name. + +2008-01-11 Ulrich Drepper <drepper@redhat.com> + + * i386_disasm.c (struct output_buffer): Remove symcb and symcbarg. + (i386_disasm): Remove appropriate initializers. + Use symcb to lookup symbol strings. + + * i386_disasm.c (struct output_buffer): Add labelbuf, labelbufsize, + symaddr_use, and symaddr fields. + (i386_disasm): Remove labelbuf and labelbufsize variables. + Add back %e format. Implement %a and %l formats. + + * i386_data.h (general_mod$r_m): Set symaddr_use and symaddr for %rip + base addressing. + + * i386_disasm.c (i386_disasm): Resize output buffer if necessary. + Optimize output_data initialization. Free buffers before return. + (struct output_data): Remove op1str field. Adjust code. + (i386_disasm): Store final NUL btye at end of functions. + +2008-01-10 Ulrich Drepper <drepper@redhat.com> + + * i386_data.h (FCT_crdb): New function. + (FCT_ccc): Use FCT_crdb. + (FCT_ddd): Likewise. + + * defs/i386: Fix a few instructions with immediate arguments. + + * i386_disasm.c: Rewrite interface to callback functions for operands + to take a single pointer to a structure. + * i386_data.h: Adjust all functions. + +2008-01-08 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Enable x86-64 again. + * defs/i386: Lots of changes for x86-64. + * i386_data.h: Add support for use in x86-64 disassembler. + * i386_disasm.c: Likewise. + * i386_parse.y: Likewise. + * defs/x86_64: Removed. + +2008-01-04 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Cleanups, remove masks which are not needed. + Add remaining Intel opcodes. + * i386_data.h (FCT_imm8): Check for input buffer overrun. + * i386_disasm.c (i386_disasm): Likewise. + * i386_parse.y: Remove suffixes which are not needed anymore. + +2008-01-03 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Add yet more SSE instructions. + +2008-01-02 Ulrich Drepper <drepper@redhat.com> + + * i386_disasm.c (i386_disasm): Extend matcher to allow tables to + contain instructions with prefixes. + * defs/i386: Use for many SSE operations. + * i386_data.h (FCT_mmxreg2): Removed. + +2008-01-01 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: More 0f prefix support. + * i386_data.h (FCT_mmxreg): Implement. + (FCT_mmxreg2): Implement. + (FCT_mmreg): Remove. + * i386_disasm.c (i386_disasm): More special instructions. + Fix tttn suffix for cmov. + * i386_parse.y: Simplify test for mod/r_m mode. + +2007-12-31 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Fix order or arguments for mov of control/debug registers. + * i386_data.h (FCT_ccc): Implement + (FCT_ddd): Implement + +2007-12-30 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Fix 0f groups 6 and 7. + * i386_data.c (FCT_mod$16r_m): Implement. + * i386_disasm.c (i386_disasm): Third parameter can also have string. + +2007-12-29 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Add lots of floating point ops. + * i386_data.h (FCT_fmod$fr_m): Removed. + (FCT_freg): Implement. + * i386_disasm.c (i386_disasm): Implement suffix_D. + * i386_parse.y: Emit suffix_D. + + * defs/i386: Use rel instead of dispA. + Fix lcall, dec, div, idiv, imul, inc, jmp, ljmp, mul, neg, not, push, + test. + + * i386_data.h (FCT_dispA): Removed. + (FCT_ds_xx): Add test for end of input buffer. + * i386_disasm.c (ABORT_ENTRY): Removed. + (i386_disasm): Fix handling of SIB. Pass correct address value to + operand callbacks. + + * Makefile.am (*.mnemonics): Filter out INVALID entry. + * defs/i386: Define imms8 and use in appropriate places. + Add INVALID entries for special opcodes with special mnemonics. + Fix int3. Fix typo in shl. Correct xlat. + * i386_data.h (FCT_ds_xx): New function. + (FCT_ds_si): Use it. + (FCT_ds_bx): New function. + (FCT_imms8): New function. + * i386_disasm.c (MNE_INVALID): Define. + (i386_disasm): Handle invalid opcodes in mnemonics printing, not + separately. Fix address value passed to operand handlers. + * i386_parse.y (bx_reg): Define. + (instrtable_out): Handle INVALID entries differently, just use + MNE_INVALID value for .mnemonic. + +2007-12-28 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Fix shift and mov immediate instructions. + * i386_data.h (FCT_imm16): Implement. + + * defs/i386: Use absval instead of abs of lcall and ljmp. + Add parameters for cmps. Fix test and mov immediate. + * i386_data.h: Implement FCT_absval. + * i386_disasm.c: Handle data16 for suffix_w and FCT_imm. + + * defs/i386: Move entries with 0x9b prefix together. + * i386_disasm.c (i386_disasm): Fix recognizing insufficient bytes in + input. Handle data16 with suffix_W. + + * i386_data.h (FCT_*): Add end parameter to all functions. Check + before using more bytes. + (FCT_sel): Implement. + * i386_disasm.c (i386_disasm): Better handle end of input buffer. + Specal opcode 0x99. + + * Makefile.am: Use m4 to preprocess defs/* files. + * defs/i386: Adjust appropriately. + * i386_data.c (FCT_ax): Implement. + (FCT_ax$w): Use FCT_ax. + * i386_disasm.c (ADD_STRING): Use _len instead of len. + (i386_disasm): If no instruction can be matched because of lack of + input and prefixes have been matched, print prefixes. + Recognize abort entries. + Handle special cases. + * i386_gendis.c: Recognize - input file name. + * i386_lex.c: Recognize INVALID token. + * i386_parse.y: Handle INVALID token input. + + * defs/i386: Fix mov, pop. + * i386_data.h (FCT_sreg3): Implement. + +2007-12-27 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Fix adc, add, cmp, or, sbb, sub, xchg, xor. + * i386_data.h (FCT_imms): New function. + (FCT_imm$s): Use FCT_imms for handling of signed values. + (FCT_imm8): Sign extend values. + * i386_disasm.c (i386_disasm): Implement suffix_w0. + * i386_parse.y: Emit suffix w0. + + * i386_data.h (FCT_disp8): Add 0x prefix. + (FCT_ds_si): Implement. + * i386_disasm.c (i386_disasm): Increment addr for invalid prefixes. + Implement tttn suffix. + * i386_parse.y: Emit tttn suffix definition. + +2007-12-26 Ulrich Drepper <drepper@redhat.com> + + * i386_data.h (struct instr_enc): Use suffix field. + (FCT_dx): Fill in body. + (FCT_es_di): Likewise. + (FCT_imm$s): Sign-extended byte values. + * i386_disasm.c: Protect ADD_CHAR and ADD_STRING macros. Adjust uses. + (i386_disasm): Handle suffix. + * i386_parse.y: Emit suffix information. + * defs/i386: Remove unnecessary suffixes. + + * Makefile.am: Disable building x86-64 version for now. + + * defs/i386: Fix and, bound, cmp, or, pop, sbb, sub, xor. + * i386_data.h: Pass pointer to prefix to functions. If not prefixes + are consumed this means invalid input. + * i386_disasm.c: Fix prefix printing. Adjust function calls for + parameter change. + * i386_parse.y: Recognize moda prefix. + +2007-12-21 Ulrich Drepper <drepper@redhat.com> + + * i386_data.h: Fix SIB handling. + * i386_disasm.c: Likewise. + +2007-12-19 Ulrich Drepper <drepper@redhat.com> + + * defs/i386: Fix up 'and' opcode. + +2007-10-31 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add dependencies of the generated files on the source + files. + (i386_lex_CFLAGS): Add -Wno-sign-compare. + + * defs/i386: A lot more data. + * defs/x86_64: Likewise. + * i386_data.h (struct instr_enc): Add off1_3, off2_3, and off3_3 + fields. + (opfct_t): Add parameter for third operand. + (FCT_*): Likewise. + (data_prefix): New function. + (FCT_abs): Implement. + (FCT_ax): Renamed to FCT_ax$w amd implement. + (FCT_disp8): Implement. + (FCT_dispA): Implement. + (FCT_imm): Implement. + (FCT_imm$w): Implement. + (FCT_imm$s): Don't zero-pad numbers. + (FCT_imm8): Likewise. + (FCT_rel): Likewise. + (general_mod$r_m): New function. + (FCT_mod$r_m): Use it. + (FCT_mod$r_m$w): New function. + (FCT_mod$8r_m): New function. + (FCT_reg): Correctly handle 16-bit registers. + (FCT_reg$w): New function. + * i386_disasm.c (i386_disasm): Handle prefixes better. + Pass third parameter to operand functions. + * i386_parse.y (struct instruction): Add off3 field. + Handle third operand throughout. + +2007-02-05 Ulrich Drepper <drepper@redhat.com> + + * i386_disasm.c: New file. + * i386_data.h: New file. + * i386_gendis.c: New file. + * i386_lex.l: New file. + * i386_parse.y: New file. + * memory-access.h: New file. + * x86_64_disasm.c: New file. + * defs/i386: New file. + * defs/i386.doc: New file. + * defs/x86_64: New file. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (AM_CFLAGS): Define, instead of adding things to DEFS. + 2003-08-11 Ulrich Drepper <drepper@redhat.com> - * Moved to CVS archive. + * Moved to CVS archive. diff --git a/libcpu/Makefile b/libcpu/Makefile deleted file mode 100644 index 744b5c09..00000000 --- a/libcpu/Makefile +++ /dev/null @@ -1,408 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# libcpu/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - -SOURCES = $(libcpu_i386_a_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = libcpu -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libcpu_i386_a_AR = $(AR) $(ARFLAGS) -libcpu_i386_a_LIBADD = -am_libcpu_i386_a_OBJECTS = i386_dis.$(OBJEXT) -libcpu_i386_a_OBJECTS = $(am_libcpu_i386_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libcpu_i386_a_SOURCES) -DIST_SOURCES = $(libcpu_i386_a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -INCLUDES = -I$(srcdir) -noinst_LIBRARIES = libcpu_i386.a -libcpu_i386_a_SOURCES = i386_dis.c -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libcpu/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits libcpu/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libcpu_i386.a: $(libcpu_i386_a_OBJECTS) $(libcpu_i386_a_DEPENDENCIES) - -rm -f libcpu_i386.a - $(libcpu_i386_a_AR) libcpu_i386.a $(libcpu_i386_a_OBJECTS) $(libcpu_i386_a_LIBADD) - $(RANLIB) libcpu_i386.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/i386_dis.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# 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/libcpu/Makefile.am b/libcpu/Makefile.am index fc85f37c..51817c1e 100644 --- a/libcpu/Makefile.am +++ b/libcpu/Makefile.am @@ -1,21 +1,83 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 2002 Red Hat, Inc. +## Copyright (C) 2002, 2004, 2005, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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. ## -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow -INCLUDES = -I$(srcdir) +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +if MUDFLAP +AM_CFLAGS = -fmudflap +else +AM_CFLAGS = +endif +AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \ + $($(*F)_CFLAGS) \ + $(if $($(*F)_no_Werror),,-Werror) +INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \ + -I$(srcdir)/../libebl -I$(srcdir)/../libdw -I$(srcdir)/../libasm +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=) +LEX_OUTPUT_ROOT = lex.$(<F:lex.l=) +AM_YFLAGS = -p$(<F:parse.y=) + +if MUDFLAP +libmudflap = -lmudflap +endif + +noinst_LIBRARIES = libcpu_i386.a libcpu_x86_64.a +noinst_PROGRAMS = i386_gendis + +libcpu_i386_a_SOURCES = i386_disasm.c +libcpu_x86_64_a_SOURCES = x86_64_disasm.c + +i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y + +i386_disasm.o: i386.mnemonics i386_dis.h +x86_64_disasm.o: x86_64.mnemonics x86_64_dis.h i386_disasm.c + +i386_dis.h: i386_gendis $(srcdir)/defs/i386 + m4 -Di386 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@ +x86_64_dis.h: i386_gendis $(srcdir)/defs/i386 + m4 -Dx86_64 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@ + +i386.mnemonics x86_64.mnemonics: %.mnemonics: $(srcdir)/defs/i386 + m4 -D$(@:.mnemonics=) -DDISASSEMBLER $^ \ + | sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \ + | sort -u > $@ + +i386_lex_no_Werror = yes + +libeu = ../lib/libeu.a + +i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare +i386_parse.o: i386_parse.c i386.mnemonics +i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics) +i386_lex.o: i386_parse.h +i386_gendis_LDADD = $(libeu) -lm $(libmudflap) + +i386_parse.h: i386_parse.c ; + +noinst_HEADERS = memory-access.h i386_parse.h i386_data.h -noinst_LIBRARIES = libcpu_i386.a +EXTRA_DIST = defs/i386 -libcpu_i386_a_SOURCES = i386_dis.c +CLEANFILES = i386.mnemonics i386_dis.h x86_64.mnemonics x86_64_dis.h diff --git a/libcpu/Makefile.in b/libcpu/Makefile.in index abd67c34..09b22a17 100644 --- a/libcpu/Makefile.in +++ b/libcpu/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -14,17 +14,13 @@ @SET_MAKE@ -SOURCES = $(libcpu_i386_a_SOURCES) -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,16 +34,16 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +noinst_PROGRAMS = i386_gendis$(EXEEXT) subdir = libcpu -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog i386_lex.c i386_parse.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) @@ -55,23 +51,38 @@ AR = ar ARFLAGS = cru libcpu_i386_a_AR = $(AR) $(ARFLAGS) libcpu_i386_a_LIBADD = -am_libcpu_i386_a_OBJECTS = i386_dis.$(OBJEXT) +am_libcpu_i386_a_OBJECTS = i386_disasm.$(OBJEXT) libcpu_i386_a_OBJECTS = $(am_libcpu_i386_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +libcpu_x86_64_a_AR = $(AR) $(ARFLAGS) +libcpu_x86_64_a_LIBADD = +am_libcpu_x86_64_a_OBJECTS = x86_64_disasm.$(OBJEXT) +libcpu_x86_64_a_OBJECTS = $(am_libcpu_x86_64_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_i386_gendis_OBJECTS = i386_gendis.$(OBJEXT) i386_lex.$(OBJEXT) \ + i386_parse.$(OBJEXT) +i386_gendis_OBJECTS = $(am_i386_gendis_OBJECTS) +am__DEPENDENCIES_1 = +i386_gendis_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libcpu_i386_a_SOURCES) -DIST_SOURCES = $(libcpu_i386_a_SOURCES) +@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || +YLWRAP = $(top_srcdir)/config/ylwrap +@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +SOURCES = $(libcpu_i386_a_SOURCES) $(libcpu_x86_64_a_SOURCES) \ + $(i386_gendis_SOURCES) +DIST_SOURCES = $(libcpu_i386_a_SOURCES) $(libcpu_x86_64_a_SOURCES) \ + $(i386_gendis_SOURCES) +HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -80,43 +91,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LEX_OUTPUT_ROOT = lex.$(<F:lex.l=) +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -125,7 +132,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -133,12 +139,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -151,36 +159,70 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -INCLUDES = -I$(srcdir) -noinst_LIBRARIES = libcpu_i386.a -libcpu_i386_a_SOURCES = i386_dis.c +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -Wunused -Wextra -std=gnu99 \ +@MUDFLAP_FALSE@ -fpic $($(*F)_CFLAGS) $(if \ +@MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -Wunused -Wextra \ +@MUDFLAP_TRUE@ -std=gnu99 -fpic $($(*F)_CFLAGS) $(if \ +@MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) +INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \ + -I$(srcdir)/../libebl -I$(srcdir)/../libdw -I$(srcdir)/../libasm + +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -P$(<F:lex.l=) +AM_YFLAGS = -p$(<F:parse.y=) +@MUDFLAP_TRUE@libmudflap = -lmudflap +noinst_LIBRARIES = libcpu_i386.a libcpu_x86_64.a +libcpu_i386_a_SOURCES = i386_disasm.c +libcpu_x86_64_a_SOURCES = x86_64_disasm.c +i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y +i386_lex_no_Werror = yes +libeu = ../lib/libeu.a +i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare +i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics) +i386_gendis_LDADD = $(libeu) -lm $(libmudflap) +noinst_HEADERS = memory-access.h i386_parse.h i386_data.h +EXTRA_DIST = defs/i386 +CLEANFILES = i386.mnemonics i386_dis.h x86_64.mnemonics x86_64_dis.h all: all-am .SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +.SUFFIXES: .c .l .o .obj .y +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -205,9 +247,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: @@ -216,6 +258,16 @@ libcpu_i386.a: $(libcpu_i386_a_OBJECTS) $(libcpu_i386_a_DEPENDENCIES) -rm -f libcpu_i386.a $(libcpu_i386_a_AR) libcpu_i386.a $(libcpu_i386_a_OBJECTS) $(libcpu_i386_a_LIBADD) $(RANLIB) libcpu_i386.a +libcpu_x86_64.a: $(libcpu_x86_64_a_OBJECTS) $(libcpu_x86_64_a_DEPENDENCIES) + -rm -f libcpu_x86_64.a + $(libcpu_x86_64_a_AR) libcpu_x86_64.a $(libcpu_x86_64_a_OBJECTS) $(libcpu_x86_64_a_LIBADD) + $(RANLIB) libcpu_x86_64.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +i386_gendis$(EXEEXT): $(i386_gendis_OBJECTS) $(i386_gendis_DEPENDENCIES) + @rm -f i386_gendis$(EXEEXT) + $(LINK) $(i386_gendis_OBJECTS) $(i386_gendis_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -223,30 +275,39 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_dis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_disasm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_gendis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_lex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_parse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_disasm.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: + +.l.c: + $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +.y.c: + $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -258,8 +319,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -269,13 +330,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -289,22 +349,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -317,7 +376,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LIBRARIES) +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am @@ -336,6 +395,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -343,9 +403,12 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -rm -f i386_lex.c + -rm -f i386_parse.c clean: clean-am -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -365,12 +428,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + 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 + installcheck-am: maintainer-clean: maintainer-clean-am @@ -390,19 +461,40 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic 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 maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am + uninstall-am + + +i386_disasm.o: i386.mnemonics i386_dis.h +x86_64_disasm.o: x86_64.mnemonics x86_64_dis.h i386_disasm.c + +i386_dis.h: i386_gendis $(srcdir)/defs/i386 + m4 -Di386 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@ +x86_64_dis.h: i386_gendis $(srcdir)/defs/i386 + m4 -Dx86_64 -DDISASSEMBLER $(srcdir)/defs/i386 | ./i386_gendis - > $@ + +i386.mnemonics x86_64.mnemonics: %.mnemonics: $(srcdir)/defs/i386 + m4 -D$(@:.mnemonics=) -DDISASSEMBLER $^ \ + | sed '1,/^%%/d;/^#/d;/^[[:space:]]*$$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\1)/;s/{[^}]*}//g;/INVALID/d' \ + | sort -u > $@ +i386_parse.o: i386_parse.c i386.mnemonics +i386_lex.o: i386_parse.h +i386_parse.h: i386_parse.c ; # 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/libcpu/defs/i386 b/libcpu/defs/i386 new file mode 100644 index 00000000..d928a4d8 --- /dev/null +++ b/libcpu/defs/i386 @@ -0,0 +1,922 @@ +%mask {s} 1 +%mask {w} 1 +%mask {w1} 1 +%mask {W1} 1 +%mask {W2} 1 +dnl floating point reg suffix +%mask {D} 1 +%mask {imm8} 8 +%mask {imms8} 8 +%mask {imm16} 16 +%mask {reg} 3 +%mask {oreg} 3 +%mask {reg16} 3 +%mask {reg64} 3 +%mask {tttn} 4 +%mask {mod} 2 +%mask {moda} 2 +%mask {MOD} 2 +%mask {r_m} 3 +dnl like {r_m} but referencing byte register +%mask {8r_m} 3 +dnl like {r_m} but referencing 16-bit register +%mask {16r_m} 3 +dnl like {r_m} but referencing 32- or 64-bit register +%mask {64r_m} 3 +%mask {disp8} 8 +dnl imm really is 8/16/32 bit depending on the situation. +%mask {imm} 8 +%mask {imm64} 8 +%mask {imms} 8 +%mask {rel} 32 +%mask {abs} 32 +%mask {absval} 32 +%mask {sel} 16 +%mask {imm32} 32 +%mask {ccc} 3 +%mask {ddd} 3 +%mask {sreg3} 3 +%mask {sreg2} 2 +%mask {mmxreg} 3 +%mask {R_M} 3 +%mask {Mod} 2 +%mask {xmmreg} 3 +%mask {R_m} 3 +%mask {xmmreg1} 3 +%mask {xmmreg2} 3 +%mask {mmxreg1} 3 +%mask {mmxreg2} 3 +%mask {predps} 8 +%mask {freg} 3 +%mask {fmod} 2 +%mask {fr_m} 3 +%prefix {R} +%prefix {RE} +%suffix {W} +%suffix {w0} +%synonym {xmmreg1} {xmmreg} +%synonym {xmmreg2} {xmmreg} +%synonym {mmxreg1} {mmxreg} +%synonym {mmxreg2} {mmxreg} +ifdef(`i386', +`%synonym {oreg} {reg} +%synonym {imm64} {imm} +')dnl + +%% +ifdef(`i386', +`00110111:aaa +11010101,00001010:aad +11010100,00001010:aam +00111111:aas +')dnl +0001010{w},{imm}:adc {imm}{w},{ax}{w} +1000000{w},{mod}010{r_m},{imm}:adc{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}010{r_m},{imms8}:adc{w} {imms8},{mod}{r_m} +0001000{w},{mod}{reg}{r_m}:adc {reg}{w},{mod}{r_m}{w} +0001001{w},{mod}{reg}{r_m}:adc {mod}{r_m}{w},{reg}{w} +0000010{w},{imm}:add {imm}{w},{ax}{w} +1000000{w},{mod}000{r_m},{imm}:add{w} {imm}{w},{mod}{r_m}{w} +10000011,{mod}000{r_m},{imms8}:add{w} {imms8},{mod}{r_m} +0000000{w},{mod}{reg}{r_m}:add {reg}{w},{mod}{r_m}{w} +0000001{w},{mod}{reg}{r_m}:add {mod}{r_m}{w},{reg}{w} +01100110,00001111,11010000,{Mod}{xmmreg}{R_m}:addsubpd {Mod}{R_m},{xmmreg} +11110010,00001111,11010000,{Mod}{xmmreg}{R_m}:addsubps {Mod}{R_m},{xmmreg} +0010010{w},{imm}:and {imm}{w},{ax}{w} +1000000{w},{mod}100{r_m},{imm}:and{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}100{r_m},{imms8}:and{w} {imms8},{mod}{r_m} +0010000{w},{mod}{reg}{r_m}:and {reg}{w},{mod}{r_m}{w} +0010001{w},{mod}{reg}{r_m}:and {mod}{r_m}{w},{reg}{w} +01100110,00001111,01010100,{Mod}{xmmreg}{R_m}:andpd {Mod}{R_m},{xmmreg} +00001111,01010100,{Mod}{xmmreg}{R_m}:andps {Mod}{R_m},{xmmreg} +01100110,00001111,01010101,{Mod}{xmmreg}{R_m}:andnpd {Mod}{R_m},{xmmreg} +00001111,01010101,{Mod}{xmmreg}{R_m}:andnps {Mod}{R_m},{xmmreg} +ifdef(`i386', +`01100011,{mod}{reg16}{r_m}:arpl {reg16},{mod}{r_m} +01100010,{moda}{reg}{r_m}:bound {reg},{moda}{r_m} +', +`01100011,{mod}{reg64}{r_m}:movslq {mod}{r_m},{reg64} +')dnl +00001111,10111100,{mod}{reg}{r_m}:bsf {mod}{r_m},{reg} +00001111,10111101,{mod}{reg}{r_m}:bsr {mod}{r_m},{reg} +00001111,11001{reg}:bswap {reg} +00001111,10100011,{mod}{reg}{r_m}:bt {reg},{mod}{r_m} +00001111,10111010,{mod}100{r_m},{imm8}:bt{w} {imm8},{mod}{r_m} +00001111,10111011,{mod}{reg}{r_m}:btc {reg},{mod}{r_m} +00001111,10111010,{mod}111{r_m},{imm8}:btc{w} {imm8},{mod}{r_m} +00001111,10110011,{mod}{reg}{r_m}:btr {reg},{mod}{r_m} +00001111,10111010,{mod}110{r_m},{imm8}:btr{w} {imm8},{mod}{r_m} +00001111,10101011,{mod}{reg}{r_m}:bts {reg},{mod}{r_m} +00001111,10111010,{mod}101{r_m},{imm8}:bts{w} {imm8},{mod}{r_m} +11101000,{rel}:call{W} {rel} +11111111,{mod}010{64r_m}:call{W} *{mod}{64r_m} +ifdef(`i386', +`10011010,{absval},{sel}:lcall {sel},{absval} +')dnl +11111111,{mod}011{64r_m}:lcall{W} *{mod}{64r_m} +# SPECIAL 10011000:[{rex.w}?cltq:{dpfx}?cbtw:cwtl] +10011000:INVALID +# SPECIAL 10011001:[{rex.w}?cqto:{dpfx}?cltd:cwtd] +10011001:INVALID +11111000:clc +11111100:cld +11111010:cli +00001111,00000101:syscall +00001111,00000110:clts +00001111,00000111:sysret +00001111,00110100:sysenter +00001111,00110101:sysexit +11110101:cmc +00001111,0100{tttn},{mod}{reg}{r_m}:cmov{tttn} {mod}{r_m},{reg} +0011110{w},{imm}:cmp {imm}{w},{ax}{w} +1000000{w},{mod}111{r_m},{imm}:cmp{w} {imm}{w},{mod}{r_m}{w} +10000011,{mod}111{r_m},{imms8}:cmp{w} {imms8},{mod}{r_m} +0011100{w},{mod}{reg}{r_m}:cmp {reg}{w},{mod}{r_m}{w} +0011101{w},{mod}{reg}{r_m}:cmp {mod}{r_m}{w},{reg}{w} +ifdef(`ASSEMBLER', +`11110010,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:cmpsd {imm8},{Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:cmpss {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:cmppd {imm8},{Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:cmpps {imm8},{Mod}{R_m},{xmmreg} +', +`11110010,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:INVALID {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:INVALID {Mod}{R_m},{xmmreg} +01100110,00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:INVALID {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},{imm8}:INVALID {Mod}{R_m},{xmmreg} +')dnl +1010011{w}:{RE}cmps{w} {es_di},{ds_si} +00001111,1011000{w},{mod}{reg}{r_m}:cmpxchg {reg}{w},{mod}{r_m}{w} +ifdef(`i386', +`00001111,11000111,{mod}001{r_m}:cmpxchg8b {mod}{r_m} +', +`# SPECIAL 00001111,11000111,{mod}001{r_m}:[{rex.w}?cmpxchg16b:cmpxchg8b] {reg},{mod}{r_m} +00001111,11000111,{mod}001{r_m}:INVALID {mod}{r_m} +')dnl +00001111,10100010:cpuid +11110011,00001111,11100110,{Mod}{xmmreg}{R_m}:cvtdq2pd {Mod}{R_m},{xmmreg} +11110010,00001111,11100110,{Mod}{xmmreg}{R_m}:cvtpd2dq {Mod}{R_m},{xmmreg} +01100110,00001111,11100110,{Mod}{xmmreg}{R_m}:cvttpd2dq {Mod}{R_m},{xmmreg} +ifdef(`i386', +`00100111:daa +00101111:das +')dnl +1111111{w},{mod}001{r_m}:dec{w} {mod}{r_m}{w} +ifdef(`i386', +`01001{reg}:dec {reg} +')dnl +1111011{w},{mod}110{r_m}:div{w} {mod}{r_m}{w} +00001111,01110111:emms +11001000,{imm16},{imm8}:enter{W} {imm16},{imm8} +11011001,11010000:fnop +11011001,11100000:fchs +11011001,11100001:fabs +11011001,11100100:ftst +11011001,11100101:fxam +11011001,11101000:fld1 +11011001,11101001:fldl2t +11011001,11101010:fldl2e +11011001,11101011:fldpi +11011001,11101100:fldlg2 +11011001,11101101:fldln2 +11011001,11101110:fldz +11011001,11110000:f2xm1 +11011001,11110001:fyl2x +11011001,11110010:fptan +11011001,11110011:fpatan +11011001,11110100:fxtract +11011001,11110101:fprem1 +11011001,11110110:fdecstp +11011001,11110111:fincstp +11011001,11111000:fprem +11011001,11111001:fyl2xp1 +11011001,11111010:fsqrt +11011001,11111011:fsincos +11011001,11111100:frndint +11011001,11111101:fscale +11011001,11111110:fsin +11011001,11111111:fcos +# ORDER +11011000,11000{freg}:fadd {freg},%st +11011100,11000{freg}:fadd %st,{freg} +11011{D}00,{mod}000{r_m}:fadd{D} {mod}{r_m} +# ORDER END +# ORDER +11011000,11001{freg}:fmul {freg},%st +11011100,11001{freg}:fmul %st,{freg} +11011{D}00,{mod}001{r_m}:fmul{D} {mod}{r_m} +# ORDER END +# ORDER +11011000,11100{freg}:fsub {freg},%st +11011100,11100{freg}:fsub %st,{freg} +11011{D}00,{mod}100{r_m}:fsub{D} {mod}{r_m} +# ORDER END +# ORDER +11011000,11101{freg}:fsubr {freg},%st +11011100,11101{freg}:fsubr %st,{freg} +11011{D}00,{mod}101{r_m}:fsubr{D} {mod}{r_m} +# ORDER END +# ORDER +11011101,11010{freg}:fst {freg} +11011{D}01,{mod}010{r_m}:fst{D} {mod}{r_m} +# ORDER END +# ORDER +11011101,11011{freg}:fstp {freg} +11011{D}01,{mod}011{r_m}:fstp{D} {mod}{r_m} +# ORDER END +11011001,{mod}100{r_m}:fldenv {mod}{r_m} +11011001,{mod}101{r_m}:fldcw {mod}{r_m} +11011001,{mod}110{r_m}:fnstenv {mod}{r_m} +11011001,{mod}111{r_m}:fnstcw {mod}{r_m} +11011001,11001{freg}:fxch {freg} +# ORDER +11011110,11000{freg}:faddp %st,{freg} +ifdef(`ASSEMBLER', +`11011110,11000001:faddp +')dnl +# ORDER +11011010,11000{freg}:fcmovb {freg},%st +11011{w1}10,{mod}000{r_m}:fiadd{w1} {mod}{r_m} +# ORDER END +# ORDER +11011010,11001{freg}:fcmove {freg},%st +11011110,11001{freg}:fmulp %st,{freg} +11011{w1}10,{mod}001{r_m}:fimul{w1} {mod}{r_m} +# ORDER END +# ORDER +11011110,11100{freg}:fsubp %st,{freg} +11011{w1}10,{mod}100{r_m}:fisub{w1} {mod}{r_m} +# ORDER END +# ORDER +11011110,11101{freg}:fsubrp %st,{freg} +11011{w1}10,{mod}101{r_m}:fisubr{w1} {mod}{r_m} +# ORDER END +# ORDER +11011111,11100000:fnstsw %ax +11011111,{mod}100{r_m}:fbld {mod}{r_m} +# ORDER END +# ORDER +11011111,11110{freg}:fcomip {freg},%st +11011111,{mod}110{r_m}:fbstp {mod}{r_m} +# ORDER END +11011001,11100000:fchs +# ORDER +10011011,11011011,11100010:fclex +10011011,11011011,11100011:finit +10011011:fwait +# END ORDER +11011011,11100010:fnclex +11011010,11000{freg}:fcmovb {freg},%st +11011010,11001{freg}:fcmove {freg},%st +11011010,11010{freg}:fcmovbe {freg},%st +11011010,11011{freg}:fcmovu {freg},%st +11011011,11000{freg}:fcmovnb {freg},%st +11011011,11001{freg}:fcmovne {freg},%st +11011011,11010{freg}:fcmovnbe {freg},%st +11011011,11011{freg}:fcmovnu {freg},%st +# ORDER +11011000,11010{freg}:fcom {freg} +ifdef(`ASSEMBLER', +`11011000,11010001:fcom +')dnl +11011{D}00,{mod}010{r_m}:fcom{D} {mod}{r_m} +# END ORDER +# ORDER +11011000,11011{freg}:fcomp {freg} +ifdef(`ASSEMBLER', +`11011000,11011001:fcomp +')dnl +11011{D}00,{mod}011{r_m}:fcomp{D} {mod}{r_m} +# END ORDER +11011110,11011001:fcompp +11011011,11110{freg}:fcomi {freg},%st +11011111,11110{freg}:fcomip {freg},%st +11011011,11101{freg}:fucomi {freg},%st +11011111,11101{freg}:fucomip {freg},%st +11011001,11111111:fcos +11011001,11110110:fdecstp +# ORDER +11011000,11110{freg}:fdiv {freg},%st +11011100,11110{freg}:fdiv %st,{freg} +11011{D}00,{mod}110{r_m}:fdiv{D} {mod}{r_m} +# END ORDER +11011010,{mod}110{r_m}:fidivl {mod}{r_m} +# ORDER +11011110,11110{freg}:fdivp %st,{freg} +11011110,{mod}110{r_m}:fidiv {mod}{r_m} +# END ORDER +11011110,11111{freg}:fdivrp %st,{freg} +ifdef(`ASSEMBLER', +`11011110,11111001:fdivp +')dnl +# ORDER +11011000,11111{freg}:fdivr {freg},%st +11011100,11111{freg}:fdivr %st,{freg} +11011{D}00,{mod}111{r_m}:fdivr{D} {mod}{r_m} +# END ORDER +11011010,{mod}111{r_m}:fidivrl {mod}{r_m} +11011110,{mod}111{r_m}:fidivr {mod}{r_m} +11011110,11110{freg}:fdivrp %st,{freg} +ifdef(`ASSEMBLER', +`11011110,11110001:fdivrp +')dnl +11011101,11000{freg}:ffree {freg} +11011010,11010{freg}:fcmovbe {freg} +11011{w1}10,{mod}010{r_m}:ficom{w1} {mod}{r_m} +11011010,11011{freg}:fcmovu {freg} +11011{w1}10,{mod}011{r_m}:ficomp{w1} {mod}{r_m} +11011111,{mod}000{r_m}:fild {mod}{r_m} +11011011,{mod}000{r_m}:fildl {mod}{r_m} +11011111,{mod}101{r_m}:fildll {mod}{r_m} +11011001,11110111:fincstp +11011011,11100011:fninit +11011{w1}11,{mod}010{r_m}:fist{w1} {mod}{r_m} +11011{w1}11,{mod}011{r_m}:fistp{w1} {mod}{r_m} +11011111,{mod}111{r_m}:fistpll {mod}{r_m} +11011{w1}11,{mod}001{r_m}:fisttp{w1} {mod}{r_m} +11011101,{mod}001{r_m}:fisttpll {mod}{r_m} +11011011,{mod}101{r_m}:fldt {mod}{r_m} +11011011,{mod}111{r_m}:fstpt {mod}{r_m} +# ORDER +11011001,11000{freg}:fld {freg} +11011{D}01,{mod}000{r_m}:fld{D} {mod}{r_m} +# ORDER END +# ORDER +11011101,11100{freg}:fucom {freg} +11011101,{mod}100{r_m}:frstor {mod}{r_m} +# ORDER END +11011101,11101{freg}:fucomp {freg} +11011101,{mod}110{r_m}:fnsave {mod}{r_m} +11011101,{mod}111{r_m}:fnstsw {mod}{r_m} +# +# +# +11110100:hlt +1111011{w},{mod}111{r_m}:idiv{w} {mod}{r_m}{w} +1111011{w},{mod}101{r_m}:imul{w} {mod}{r_m}{w} +00001111,10101111,{mod}{reg}{r_m}:imul {mod}{r_m},{reg} +011010{s}1,{mod}{reg}{r_m},{imm}:imul {imm}{s},{mod}{r_m},{reg} +1110010{w},{imm8}:in {imm8},{ax}{w} +1110110{w}:in {dx},{ax}{w} +1111111{w},{mod}000{r_m}:inc{w} {mod}{r_m}{w} +ifdef(`i386', +`01000{reg}:inc {reg} +')dnl +0110110{w}:{R}ins{w} {dx},{es_di} +11001101,{imm8}:int {imm8} +11001100:int3 +ifdef(`i386', +`11001110:into +')dnl +00001111,00001000:invd +# ORDER +00001111,00000001,11111000:swapgs +00001111,00000001,{mod}111{r_m}:invlpg {mod}{r_m} +# ORDER END +11001111:iret{W1} +0111{tttn},{disp8}:j{tttn} {disp8} +00001111,1000{tttn},{rel}:j{tttn} {rel} +00001111,1001{tttn},{mod}000{8r_m}:set{tttn} {mod}{8r_m} +# SPECIAL 11100011,{disp8}:[{dpfx}?jcxz:jecxz] {disp8} +11100011,{disp8}:INVALID {disp8} +11101011,{disp8}:jmp {disp8} +11101001,{rel}:jmp{W} {rel} +11111111,{mod}100{64r_m}:jmp{W} *{mod}{64r_m} +11101010,{absval},{sel}:ljmp {sel},{absval} +11111111,{mod}101{64r_m}:ljmp{W} *{mod}{64r_m} +10011111:lahf +00001111,00000010,{mod}{reg}{16r_m}:lar {mod}{16r_m},{reg} +ifdef(`i386', +`11000101,{mod}{reg}{r_m}:lds {mod}{r_m},{reg} +')dnl +10001101,{mod}{reg}{r_m}:lea {mod}{r_m},{reg} +11001001:leave{W} +ifdef(`i386', +`11000100,{mod}{reg}{r_m}:les {mod}{r_m},{reg} +')dnl +00001111,10110100,{mod}{reg}{r_m}:lfs {mod}{r_m},{reg} +00001111,10110101,{mod}{reg}{r_m}:lgs {mod}{r_m},{reg} +ifdef(`i386', +`00001111,00000001,{mod}010{r_m}:lgdt{w0} {mod}{r_m} +00001111,00000001,{mod}011{r_m}:lidt{w0} {mod}{r_m} +', +`00001111,00000001,{mod}010{r_m}:lgdt {mod}{r_m} +00001111,00000001,{mod}011{r_m}:lidt {mod}{r_m} +')dnl +00001111,00000000,{mod}010{16r_m}:lldt {mod}{16r_m} +00001111,00000001,{mod}110{16r_m}:lmsw {mod}{16r_m} +11110000:lock +1010110{w}:{R}lods {ds_si},{ax}{w} +11100010,{disp8}:loop {disp8} +11100001,{disp8}:loope {disp8} +11100000,{disp8}:loopne {disp8} +00001111,00000011,{mod}{reg}{16r_m}:lsl {mod}{16r_m},{reg} +00001111,10110010,{mod}{reg}{r_m}:lss {mod}{r_m},{reg} +00001111,00000000,{mod}011{16r_m}:ltr {mod}{16r_m} +1000100{w},{mod}{reg}{r_m}:mov {reg}{w},{mod}{r_m}{w} +1000101{w},{mod}{reg}{r_m}:mov {mod}{r_m}{w},{reg}{w} +1100011{w},{mod}000{r_m},{imm}:mov{w} {imm}{w},{mod}{r_m}{w} +1011{w}{oreg},{imm64}:mov {imm64}{w},{oreg}{w} +1010000{w},{abs}:mov {abs},{ax}{w} +1010001{w},{abs}:mov {ax}{w},{abs} +00001111,00100000,11{ccc}{reg64}:mov {ccc},{reg64} +00001111,00100010,11{ccc}{reg64}:mov {reg64},{ccc} +00001111,00100001,11{ddd}{reg64}:mov {ddd},{reg64} +00001111,00100011,11{ddd}{reg64}:mov {reg64},{ddd} +10001100,{mod}{sreg3}{r_m}:mov {sreg3},{mod}{r_m} +10001110,{mod}{sreg3}{r_m}:mov {mod}{r_m},{sreg3} +1010010{w}:{R}movs{w} {ds_si},{es_di} +00001111,10111110,{mod}{reg}{8r_m}:movsbl {mod}{8r_m},{reg} +00001111,10111111,{mod}{reg}{16r_m}:movswl {mod}{16r_m},{reg} +00001111,10110110,{mod}{reg}{8r_m}:movzbl {mod}{8r_m},{reg} +00001111,10110111,{mod}{reg}{16r_m}:movzwl {mod}{16r_m},{reg} +1111011{w},{mod}100{r_m}:mul{w} {mod}{r_m}{w} +1111011{w},{mod}011{r_m}:neg{w} {mod}{r_m}{w} +11110011,10010000:pause +ifdef(`i386', +`10010000:nop +', +`10010000:INVALID +')dnl +1111011{w},{mod}010{r_m}:not{w} {mod}{r_m}{w} +0000100{w},{mod}{reg}{r_m}:or {reg}{w},{mod}{r_m}{w} +0000101{w},{mod}{reg}{r_m}:or {mod}{r_m}{w},{reg}{w} +1000000{w},{mod}001{r_m},{imm}:or{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}001{r_m},{imms8}:or{w} {imms8},{mod}{r_m}{w} +0000110{w},{imm}:or {imm}{w},{ax}{w} +1110011{w},{imm8}:out {ax}{w},{imm8} +1110111{w}:out {ax}{w},{dx} +0110111{w}:{R}outs{w} {ds_si},{dx} +ifdef(`i386', +`10001111,{mod}000{r_m}:pop{w} {mod}{r_m} +', +# XXX This is not the cleanest way... +`10001111,11000{reg64}:pop {reg64} +10001111,{mod}000{r_m}:pop{W} {mod}{r_m} +')dnl +00001111,10{sreg3}001:pop{W} {sreg3} +10011101:popf{W} +# XXX This is not the cleanest way... +ifdef(`i386', +`11111111,{mod}110{r_m}:push{w} {mod}{r_m} +', +`11111111,11110{reg64}:push {reg64} +11111111,{mod}110{r_m}:pushq {mod}{r_m} +')dnl +ifdef(`i386', +`01010{reg}:push {reg} +01011{reg}:pop {reg} +', +`01010{reg64}:push {reg64} +01011{reg64}:pop {reg64} +')dnl +011010{s}0,{imm}:push{W} {imm}{s} +000{sreg2}110:push {sreg2} +00001111,10{sreg3}000:push{W} {sreg3} +ifdef(`i386', +`01100000:pusha{W} +01100001:popa{W} +')dnl +10011100:pushf{W} +1101000{w},{mod}010{r_m}:rcl{w} {mod}{r_m}{w} +1101001{w},{mod}010{r_m}:rcl{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}010{r_m},{imm8}:rcl{w} {imm8},{mod}{r_m}{w} +1101000{w},{mod}011{r_m}:rcr{w} {mod}{r_m}{w} +1101001{w},{mod}011{r_m}:rcr{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}011{r_m},{imm8}:rcr{w} {imm8},{mod}{r_m}{w} +00001111,00110010:rdmsr +00001111,00110011:rdpmc +00001111,00110001:rdtsc +11000011:ret{W} +11000010,{imm16}:ret{W} {imm16} +11001011:lret +11001010,{imm16}:lret {imm16} +1101000{w},{mod}000{r_m}:rol{w} {mod}{r_m}{w} +1101001{w},{mod}000{r_m}:rol{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}000{r_m},{imm8}:rol{w} {imm8},{mod}{r_m}{w} +1101000{w},{mod}001{r_m}:ror{w} {mod}{r_m}{w} +1101001{w},{mod}001{r_m}:ror{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}001{r_m},{imm8}:ror{w} {imm8},{mod}{r_m}{w} +00001111,10101010:rsm +10011110:sahf +1101000{w},{mod}111{r_m}:sar{w} {mod}{r_m}{w} +1101001{w},{mod}111{r_m}:sar{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}111{r_m},{imm8}:sar{w} {imm8},{mod}{r_m}{w} +0001100{w},{mod}{reg}{r_m}:sbb {reg}{w},{mod}{r_m}{w} +0001101{w},{mod}{reg}{r_m}:sbb {mod}{r_m}{w},{reg}{w} +0001110{w},{imm}:sbb {imm}{w},{ax}{w} +1000000{w},{mod}011{r_m},{imm}:sbb{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}011{r_m},{imms8}:sbb{w} {imms8},{mod}{r_m} +1010111{w}:{RE}scas {es_di},{ax}{w} +00001111,1001{tttn},{mod}000{r_m}:set{tttn} {mod}{r_m} +1101000{w},{mod}100{r_m}:shl{w} {mod}{r_m}{w} +1101001{w},{mod}100{r_m}:shl{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}100{r_m},{imm8}:shl{w} {imm8},{mod}{r_m}{w} +1101000{w},{mod}101{r_m}:shr{w} {mod}{r_m}{w} +00001111,10100100,{mod}{reg}{r_m},{imm8}:shld {imm8},{reg},{mod}{r_m} +00001111,10100101,{mod}{reg}{r_m}:shld %cl,{reg},{mod}{r_m} +1101001{w},{mod}101{r_m}:shr{w} %cl,{mod}{r_m}{w} +1100000{w},{mod}101{r_m},{imm8}:shr{w} {imm8},{mod}{r_m}{w} +00001111,10101100,{mod}{reg}{r_m},{imm8}:shrd {imm8},{reg},{mod}{r_m} +00001111,10101101,{mod}{reg}{r_m}:shrd %cl,{reg},{mod}{r_m} +# ORDER +00001111,00000001,11000001:vmcall +00001111,00000001,11000010:vmlaunch +00001111,00000001,11000011:vmresume +00001111,00000001,11000100:vmxoff +00001111,01111000,{mod}{reg64}{64r_m}:vmread {reg64},{mod}{64r_m} +00001111,01111001,{mod}{reg64}{64r_m}:vmwrite {mod}{64r_m},{reg64} +ifdef(`i386', +`00001111,00000001,{mod}000{r_m}:sgdtl {mod}{r_m} +', +`00001111,00000001,{mod}000{r_m}:sgdt {mod}{r_m} +')dnl +# ORDER END +# ORDER +ifdef(`i386', +`00001111,00000001,11001000:monitor %eax,%ecx,%edx +00001111,00000001,11001001:mwait %eax,%ecx +', +`00001111,00000001,11001000:monitor %rax,%rcx,%rdx +00001111,00000001,11001001:mwait %rax,%rcx +')dnl +ifdef(`i386', +`00001111,00000001,{mod}001{r_m}:sidtl {mod}{r_m} +', +`00001111,00000001,{mod}001{r_m}:sidt {mod}{r_m} +')dnl +# ORDER END +00001111,00000000,{mod}000{r_m}:sldt {mod}{r_m} +00001111,00000001,{mod}100{r_m}:smsw {mod}{r_m} +11111001:stc +11111101:std +11111011:sti +1010101{w}:{R}stos {ax}{w},{es_di} +00001111,00000000,{mod}001{r_m}:str {mod}{r_m} +0010100{w},{mod}{reg}{r_m}:sub {reg}{w},{mod}{r_m}{w} +0010101{w},{mod}{reg}{r_m}:sub {mod}{r_m}{w},{reg}{w} +0010110{w},{imm}:sub {imm}{w},{ax}{w} +1000000{w},{mod}101{r_m},{imm}:sub{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}101{r_m},{imms8}:sub{w} {imms8},{mod}{r_m} +1000010{w},{mod}{reg}{r_m}:test {reg}{w},{mod}{r_m}{w} +1010100{w},{imm}:test {imm}{w},{ax}{w} +1111011{w},{mod}000{r_m},{imm}:test{w} {imm}{w},{mod}{r_m}{w} +00001111,00001011:ud2a +00001111,00000000,{mod}100{16r_m}:verr {mod}{16r_m} +00001111,00000000,{mod}101{16r_m}:verw {mod}{16r_m} +00001111,00001001:wbinvd +00001111,00001101,{mod}000{8r_m}:prefetch {mod}{8r_m} +00001111,00001101,{mod}001{8r_m}:prefetchw {mod}{8r_m} +00001111,00011000,{mod}000{r_m}:prefetchnta {mod}{r_m} +00001111,00011000,{mod}001{r_m}:prefetcht0 {mod}{r_m} +00001111,00011000,{mod}010{r_m}:prefetcht1 {mod}{r_m} +00001111,00011000,{mod}011{r_m}:prefetcht2 {mod}{r_m} +00001111,00011111,{mod}{reg}{r_m}:nop{w} {mod}{r_m} +00001111,00110000:wrmsr +00001111,1100000{w},{mod}{reg}{r_m}:xadd {reg}{w},{mod}{r_m}{w} +1000011{w},{mod}{reg}{r_m}:xchg {reg}{w},{mod}{r_m}{w} +10010{oreg}:xchg {ax},{oreg} +11010111:xlat {ds_bx} +0011000{w},{mod}{reg}{r_m}:xor {reg}{w},{mod}{r_m}{w} +0011001{w},{mod}{reg}{r_m}:xor {mod}{r_m}{w},{reg}{w} +0011010{w},{imm}:xor {imm}{w},{ax}{w} +1000000{w},{mod}110{r_m},{imm}:xor{w} {imm}{w},{mod}{r_m}{w} +1000001{w},{mod}110{r_m},{imms8}:xor{w} {imms8},{mod}{r_m} +00001111,01110111:emms +01100110,00001111,11011011,{Mod}{xmmreg}{R_m}:pand {Mod}{R_m},{xmmreg} +00001111,11011011,{MOD}{mmxreg}{R_M}:pand {MOD}{R_M},{mmxreg} +01100110,00001111,11011111,{Mod}{xmmreg}{R_m}:pandn {Mod}{R_m},{xmmreg} +00001111,11011111,{MOD}{mmxreg}{R_M}:pandn {MOD}{R_M},{mmxreg} +01100110,00001111,11110101,{Mod}{xmmreg}{R_m}:pmaddwd {Mod}{R_m},{xmmreg} +00001111,11110101,{MOD}{mmxreg}{R_M}:pmaddwd {MOD}{R_M},{mmxreg} +01100110,00001111,11101011,{Mod}{xmmreg}{R_m}:por {Mod}{R_m},{xmmreg} +00001111,11101011,{MOD}{mmxreg}{R_M}:por {MOD}{R_M},{mmxreg} +01100110,00001111,11101111,{Mod}{xmmreg}{R_m}:pxor {Mod}{R_m},{xmmreg} +00001111,11101111,{MOD}{mmxreg}{R_M}:pxor {MOD}{R_M},{mmxreg} +00001111,01010101,{Mod}{xmmreg}{R_m}:andnps {Mod}{R_m},{xmmreg} +00001111,01010100,{Mod}{xmmreg}{R_m}:andps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000000:cmpeqps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000001:cmpltps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000010:cmpleps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000011:cmpunordps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000100:cmpneqps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000101:cmpnltps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000110:cmpnleps {Mod}{R_m},{xmmreg} +00001111,11000010,{Mod}{xmmreg}{R_m},00000111:cmpordps {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000000:cmpeqss {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000001:cmpltss {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000010:cmpless {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000011:cmpunordss {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000100:cmpneqss {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000101:cmpnltss {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000110:cmpnless {Mod}{R_m},{xmmreg} +11110011,00001111,11000010,{Mod}{xmmreg}{R_m},00000111:cmpordss {Mod}{R_m},{xmmreg} +00001111,10101110,{mod}001{r_m}:fxrstor {mod}{r_m} +00001111,10101110,{mod}000{r_m}:fxsave {mod}{r_m} +00001111,10101110,{mod}010{r_m}:ldmxcsr {mod}{r_m} +00001111,10101110,{mod}011{r_m}:stmxcsr {mod}{r_m} +11110010,00001111,00010000,{Mod}{xmmreg}{R_m}:movsd {Mod}{R_m},{xmmreg} +11110011,00001111,00010000,{Mod}{xmmreg}{R_m}:movss {Mod}{R_m},{xmmreg} +01100110,00001111,00010000,{Mod}{xmmreg}{R_m}:movupd {Mod}{R_m},{xmmreg} +00001111,00010000,{Mod}{xmmreg}{R_m}:movups {Mod}{R_m},{xmmreg} +11110010,00001111,00010001,{Mod}{xmmreg}{R_m}:movsd {xmmreg},{Mod}{R_m} +11110011,00001111,00010001,{Mod}{xmmreg}{R_m}:movss {xmmreg},{Mod}{R_m} +01100110,00001111,00010001,{Mod}{xmmreg}{R_m}:movupd {xmmreg},{Mod}{R_m} +00001111,00010001,{Mod}{xmmreg}{R_m}:movups {xmmreg},{Mod}{R_m} +11110010,00001111,00010010,{Mod}{xmmreg}{R_m}:movddup {Mod}{R_m},{xmmreg} +11110011,00001111,00010010,{Mod}{xmmreg}{R_m}:movsldup {Mod}{R_m},{xmmreg} +01100110,00001111,00010010,{Mod}{xmmreg}{R_m}:movlpd {Mod}{R_m},{xmmreg} +00001111,00010010,11{xmmreg1}{xmmreg2}:movhlps {xmmreg2},{xmmreg1} +00001111,00010010,{Mod}{xmmreg}{R_m}:movlps {Mod}{R_m},{xmmreg} +01100110,00001111,00010011,11{xmmreg1}{xmmreg2}:movhlpd {xmmreg1},{xmmreg2} +00001111,00010011,11{xmmreg1}{xmmreg2}:movhlps {xmmreg1},{xmmreg2} +01100110,00001111,00010011,{Mod}{xmmreg}{R_m}:movlpd {xmmreg},{Mod}{R_m} +00001111,00010011,{Mod}{xmmreg}{R_m}:movlps {xmmreg},{Mod}{R_m} +01100110,00001111,00010100,{Mod}{xmmreg}{R_m}:unpcklpd {Mod}{R_m},{xmmreg} +00001111,00010100,{Mod}{xmmreg}{R_m}:unpcklps {Mod}{R_m},{xmmreg} +01100110,00001111,00010101,{Mod}{xmmreg}{R_m}:unpckhpd {Mod}{R_m},{xmmreg} +00001111,00010101,{Mod}{xmmreg}{R_m}:unpckhps {Mod}{R_m},{xmmreg} +11110011,00001111,00010110,{Mod}{xmmreg}{R_m}:movshdup {Mod}{R_m},{xmmreg} +01100110,00001111,00010110,{Mod}{xmmreg}{R_m}:movhpd {Mod}{R_m},{xmmreg} +00001111,00010110,11{xmmreg1}{xmmreg2}:movlhps {xmmreg2},{xmmreg1} +00001111,00010110,{Mod}{xmmreg}{R_m}:movhps {Mod}{R_m},{xmmreg} +01100110,00001111,00010111,11{xmmreg1}{xmmreg2}:movlhpd {xmmreg1},{xmmreg2} +00001111,00010111,11{xmmreg1}{xmmreg2}:movlhps {xmmreg1},{xmmreg2} +01100110,00001111,00010111,{Mod}{xmmreg}{R_m}:movhpd {xmmreg},{Mod}{R_m} +00001111,00010111,{Mod}{xmmreg}{R_m}:movhps {xmmreg},{Mod}{R_m} +01100110,00001111,00101000,{Mod}{xmmreg}{R_m}:movapd {Mod}{R_m},{xmmreg} +00001111,00101000,{Mod}{xmmreg}{R_m}:movaps {Mod}{R_m},{xmmreg} +01100110,00001111,00101001,{Mod}{xmmreg}{R_m}:movapd {xmmreg},{Mod}{R_m} +00001111,00101001,{Mod}{xmmreg}{R_m}:movaps {xmmreg},{Mod}{R_m} +11110010,00001111,00101010,{mod}{xmmreg}{r_m}:cvtsi2sd {mod}{r_m},{xmmreg} +11110011,00001111,00101010,{mod}{xmmreg}{r_m}:cvtsi2ss {mod}{r_m},{xmmreg} +01100110,00001111,00101010,{MOD}{xmmreg}{R_M}:cvtpi2pd {MOD}{R_M},{xmmreg} +00001111,00101010,{MOD}{xmmreg}{R_M}:cvtpi2ps {MOD}{R_M},{xmmreg} +01100110,00001111,00101011,{mod}{xmmreg}{r_m}:movntpd {xmmreg},{mod}{r_m} +00001111,00101011,{mod}{xmmreg}{r_m}:movntps {xmmreg},{mod}{r_m} +11110010,00001111,00101100,{Mod}{reg}{R_m}:cvttsd2si {Mod}{R_m},{reg} +11110011,00001111,00101100,{Mod}{reg}{R_m}:cvttss2si {Mod}{R_m},{reg} +01100110,00001111,00101100,{Mod}{mmxreg}{R_m}:cvttpd2pi {Mod}{R_m},{mmxreg} +00001111,00101100,{Mod}{mmxreg}{R_m}:cvttps2pi {Mod}{R_m},{mmxreg} +01100110,00001111,00101101,{Mod}{mmxreg}{R_m}:cvtpd2pi {Mod}{R_m},{mmxreg} +11110010,00001111,00101101,{Mod}{reg}{R_m}:cvtsd2si {Mod}{R_m},{reg} +11110011,00001111,00101101,{Mod}{reg}{R_m}:cvtss2si {Mod}{R_m},{reg} +00001111,00101101,{Mod}{mmxreg}{R_m}:cvtps2pi {Mod}{R_m},{mmxreg} +01100110,00001111,00101110,{Mod}{xmmreg}{R_m}:ucomisd {Mod}{R_m},{xmmreg} +00001111,00101110,{Mod}{xmmreg}{R_m}:ucomiss {Mod}{R_m},{xmmreg} +01100110,00001111,00101111,{Mod}{xmmreg}{R_m}:comisd {Mod}{R_m},{xmmreg} +00001111,00101111,{Mod}{xmmreg}{R_m}:comiss {Mod}{R_m},{xmmreg} +00001111,00110111:getsec +01100110,00001111,01010000,11{reg}{xmmreg}:movmskpd {xmmreg},{reg} +00001111,01010000,11{reg}{xmmreg}:movmskps {xmmreg},{reg} +01100110,00001111,01010001,{Mod}{xmmreg}{R_m}:sqrtpd {Mod}{R_m},{xmmreg} +11110010,00001111,01010001,{Mod}{xmmreg}{R_m}:sqrtsd {Mod}{R_m},{xmmreg} +11110011,00001111,01010001,{Mod}{xmmreg}{R_m}:sqrtss {Mod}{R_m},{xmmreg} +00001111,01010001,{Mod}{xmmreg}{R_m}:sqrtps {Mod}{R_m},{xmmreg} +11110011,00001111,01010010,{Mod}{xmmreg}{R_m}:rsqrtss {Mod}{R_m},{xmmreg} +00001111,01010010,{Mod}{xmmreg}{R_m}:rsqrtps {Mod}{R_m},{xmmreg} +11110011,00001111,01010011,{Mod}{xmmreg}{R_m}:rcpss {Mod}{R_m},{xmmreg} +00001111,01010011,{Mod}{xmmreg}{R_m}:rcpps {Mod}{R_m},{xmmreg} +01100110,00001111,01010100,{Mod}{xmmreg}{R_m}:andpd {Mod}{R_m},{xmmreg} +00001111,01010100,{Mod}{xmmreg}{R_m}:andps {Mod}{R_m},{xmmreg} +01100110,00001111,01010101,{Mod}{xmmreg}{R_m}:andnpd {Mod}{R_m},{xmmreg} +00001111,01010101,{Mod}{xmmreg}{R_m}:andnps {Mod}{R_m},{xmmreg} +01100110,00001111,01010110,{Mod}{xmmreg}{R_m}:orpd {Mod}{R_m},{xmmreg} +00001111,01010110,{Mod}{xmmreg}{R_m}:orps {Mod}{R_m},{xmmreg} +01100110,00001111,01010111,{Mod}{xmmreg}{R_m}:xorpd {Mod}{R_m},{xmmreg} +00001111,01010111,{Mod}{xmmreg}{R_m}:xorps {Mod}{R_m},{xmmreg} +11110010,00001111,01011000,{Mod}{xmmreg}{R_m}:addsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011000,{Mod}{xmmreg}{R_m}:addss {Mod}{R_m},{xmmreg} +01100110,00001111,01011000,{Mod}{xmmreg}{R_m}:addpd {Mod}{R_m},{xmmreg} +00001111,01011000,{Mod}{xmmreg}{R_m}:addps {Mod}{R_m},{xmmreg} +11110010,00001111,01011001,{Mod}{xmmreg}{R_m}:mulsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011001,{Mod}{xmmreg}{R_m}:mulss {Mod}{R_m},{xmmreg} +01100110,00001111,01011001,{Mod}{xmmreg}{R_m}:mulpd {Mod}{R_m},{xmmreg} +00001111,01011001,{Mod}{xmmreg}{R_m}:mulps {Mod}{R_m},{xmmreg} +11110010,00001111,01011010,{Mod}{xmmreg}{R_m}:cvtsd2ss {Mod}{R_m},{xmmreg} +11110011,00001111,01011010,{Mod}{xmmreg}{R_m}:cvtss2sd {Mod}{R_m},{xmmreg} +01100110,00001111,01011010,{Mod}{xmmreg}{R_m}:cvtpd2ps {Mod}{R_m},{xmmreg} +00001111,01011010,{Mod}{xmmreg}{R_m}:cvtps2pd {Mod}{R_m},{xmmreg} +01100110,00001111,01011011,{Mod}{xmmreg}{R_m}:cvtps2dq {Mod}{R_m},{xmmreg} +11110011,00001111,01011011,{Mod}{xmmreg}{R_m}:cvttps2dq {Mod}{R_m},{xmmreg} +00001111,01011011,{Mod}{xmmreg}{R_m}:cvtdq2ps {Mod}{R_m},{xmmreg} +11110010,00001111,01011100,{Mod}{xmmreg}{R_m}:subsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011100,{Mod}{xmmreg}{R_m}:subss {Mod}{R_m},{xmmreg} +01100110,00001111,01011100,{Mod}{xmmreg}{R_m}:subpd {Mod}{R_m},{xmmreg} +00001111,01011100,{Mod}{xmmreg}{R_m}:subps {Mod}{R_m},{xmmreg} +11110010,00001111,01011101,{Mod}{xmmreg}{R_m}:minsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011101,{Mod}{xmmreg}{R_m}:minss {Mod}{R_m},{xmmreg} +01100110,00001111,01011101,{Mod}{xmmreg}{R_m}:minpd {Mod}{R_m},{xmmreg} +00001111,01011101,{Mod}{xmmreg}{R_m}:minps {Mod}{R_m},{xmmreg} +11110010,00001111,01011110,{Mod}{xmmreg}{R_m}:divsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011110,{Mod}{xmmreg}{R_m}:divss {Mod}{R_m},{xmmreg} +01100110,00001111,01011110,{Mod}{xmmreg}{R_m}:divpd {Mod}{R_m},{xmmreg} +00001111,01011110,{Mod}{xmmreg}{R_m}:divps {Mod}{R_m},{xmmreg} +11110010,00001111,01011111,{Mod}{xmmreg}{R_m}:maxsd {Mod}{R_m},{xmmreg} +11110011,00001111,01011111,{Mod}{xmmreg}{R_m}:maxss {Mod}{R_m},{xmmreg} +01100110,00001111,01011111,{Mod}{xmmreg}{R_m}:maxpd {Mod}{R_m},{xmmreg} +00001111,01011111,{Mod}{xmmreg}{R_m}:maxps {Mod}{R_m},{xmmreg} +01100110,00001111,01100000,{Mod}{xmmreg}{R_m}:punpcklbw {Mod}{R_m},{xmmreg} +00001111,01100000,{MOD}{mmxreg}{R_M}:punpcklbw {MOD}{R_M},{mmxreg} +01100110,00001111,01100001,{Mod}{xmmreg}{R_m}:punpcklwd {Mod}{R_m},{xmmreg} +00001111,01100001,{MOD}{mmxreg}{R_M}:punpcklwd {MOD}{R_M},{mmxreg} +01100110,00001111,01100010,{Mod}{xmmreg}{R_m}:punpckldq {Mod}{R_m},{xmmreg} +00001111,01100010,{MOD}{mmxreg}{R_M}:punpckldq {MOD}{R_M},{mmxreg} +01100110,00001111,01100011,{Mod}{xmmreg}{R_m}:packsswb {Mod}{R_m},{xmmreg} +00001111,01100011,{MOD}{mmxreg}{R_M}:packsswb {MOD}{R_M},{mmxreg} +01100110,00001111,01100100,{Mod}{xmmreg}{R_m}:pcmpgtb {Mod}{R_m},{xmmreg} +00001111,01100100,{MOD}{mmxreg}{R_M}:pcmpgtb {MOD}{R_M},{mmxreg} +01100110,00001111,01100101,{Mod}{xmmreg}{R_m}:pcmpgtw {Mod}{R_m},{xmmreg} +00001111,01100101,{MOD}{mmxreg}{R_M}:pcmpgtw {MOD}{R_M},{mmxreg} +01100110,00001111,01100110,{Mod}{xmmreg}{R_m}:pcmpgtd {Mod}{R_m},{xmmreg} +00001111,01100110,{MOD}{mmxreg}{R_M}:pcmpgtd {MOD}{R_M},{mmxreg} +01100110,00001111,01100111,{Mod}{xmmreg}{R_m}:packuswb {Mod}{R_m},{xmmreg} +00001111,01100111,{MOD}{mmxreg}{R_M}:packuswb {MOD}{R_M},{mmxreg} +01100110,00001111,01101000,{Mod}{xmmreg}{R_m}:punpckhbw {Mod}{R_m},{xmmreg} +00001111,01101000,{MOD}{mmxreg}{R_M}:punpckhbw {MOD}{R_M},{mmxreg} +01100110,00001111,01101001,{Mod}{xmmreg}{R_m}:punpckhwd {Mod}{R_m},{xmmreg} +00001111,01101001,{MOD}{mmxreg}{R_M}:punpckhwd {MOD}{R_M},{mmxreg} +01100110,00001111,01101010,{Mod}{xmmreg}{R_m}:punpckhdq {Mod}{R_m},{xmmreg} +00001111,01101010,{MOD}{mmxreg}{R_M}:punpckhdq {MOD}{R_M},{mmxreg} +01100110,00001111,01101011,{Mod}{xmmreg}{R_m}:packssdw {Mod}{R_m},{xmmreg} +00001111,01101011,{MOD}{mmxreg}{R_M}:packssdw {MOD}{R_M},{mmxreg} +01100110,00001111,01101100,{Mod}{xmmreg}{R_m}:punpcklqdq {Mod}{R_m},{xmmreg} +01100110,00001111,01101101,{Mod}{xmmreg}{R_m}:punpckhqdq {Mod}{R_m},{xmmreg} +01100110,00001111,01101110,{mod}{xmmreg}{r_m}:movd {mod}{r_m},{xmmreg} +00001111,01101110,{mod}{mmxreg}{r_m}:movd {mod}{r_m},{mmxreg} +01100110,00001111,01101111,{Mod}{xmmreg}{R_m}:movdqa {Mod}{R_m},{xmmreg} +11110011,00001111,01101111,{Mod}{xmmreg}{R_m}:movdqu {Mod}{R_m},{xmmreg} +00001111,01101111,{MOD}{mmxreg}{R_M}:movq {MOD}{R_M},{mmxreg} +01100110,00001111,01110000,{Mod}{xmmreg}{R_m},{imm8}:pshufd {imm8},{Mod}{R_m},{xmmreg} +11110010,00001111,01110000,{Mod}{xmmreg}{R_m},{imm8}:pshuflw {imm8},{Mod}{R_m},{xmmreg} +11110011,00001111,01110000,{Mod}{xmmreg}{R_m},{imm8}:pshufhw {imm8},{Mod}{R_m},{xmmreg} +00001111,01110000,{MOD}{mmxreg}{R_M},{imm8}:pshufw {imm8},{MOD}{R_M},{mmxreg} +01100110,00001111,01110100,{Mod}{xmmreg}{R_m}:pcmpeqb {Mod}{R_m},{xmmreg} +00001111,01110100,{MOD}{mmxreg}{R_M}:pcmpeqb {MOD}{R_M},{mmxreg} +01100110,00001111,01110101,{Mod}{xmmreg}{R_m}:pcmpeqw {Mod}{R_m},{xmmreg} +00001111,01110101,{MOD}{mmxreg}{R_M}:pcmpeqw {MOD}{R_M},{mmxreg} +01100110,00001111,01110110,{Mod}{xmmreg}{R_m}:pcmpeqd {Mod}{R_m},{xmmreg} +00001111,01110110,{MOD}{mmxreg}{R_M}:pcmpeqd {MOD}{R_M},{mmxreg} +01100110,00001111,01111100,{Mod}{xmmreg}{R_m}:haddpd {Mod}{R_m},{xmmreg} +11110010,00001111,01111100,{Mod}{xmmreg}{R_m}:haddps {Mod}{R_m},{xmmreg} +01100110,00001111,01111101,{Mod}{xmmreg}{R_m}:hsubpd {Mod}{R_m},{xmmreg} +11110010,00001111,01111101,{Mod}{xmmreg}{R_m}:hsubps {Mod}{R_m},{xmmreg} +01100110,00001111,01111110,{mod}{xmmreg}{r_m}:movd {xmmreg},{mod}{r_m} +11110011,00001111,01111110,{Mod}{xmmreg}{R_m}:movq {Mod}{R_m},{xmmreg} +00001111,01111110,{mod}{mmxreg}{r_m}:movd {mmxreg},{mod}{r_m} +01100110,00001111,01111111,{Mod}{xmmreg}{R_m}:movdqa {xmmreg},{Mod}{R_m} +11110011,00001111,01111111,{Mod}{xmmreg}{R_m}:movdqu {xmmreg},{Mod}{R_m} +00001111,01111111,{MOD}{mmxreg}{R_M}:movq {mmxreg},{MOD}{R_M} +00001111,11000011,{mod}{reg}{r_m}:movnti {reg},{mod}{r_m} +01100110,00001111,11000100,{mod}{xmmreg}{r_m},{imm8}:pinsrw {imm8},{mod}{r_m},{xmmreg} +00001111,11000100,{mod}{mmxreg}{r_m},{imm8}:pinsrw {imm8},{mod}{r_m},{mmxreg} +01100110,00001111,11000101,11{reg}{xmmreg},{imm8}:pextrw {imm8},{xmmreg},{reg} +00001111,11000101,11{reg}{mmxreg},{imm8}:pextrw {imm8},{mmxreg},{reg} +01100110,00001111,11000110,{Mod}{xmmreg}{R_m},{imm8}:shufpd {imm8},{Mod}{R_m},{xmmreg} +00001111,11000110,{Mod}{xmmreg}{R_m},{imm8}:shufps {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,11010001,{Mod}{xmmreg}{R_m}:psrlw {Mod}{R_m},{xmmreg} +00001111,11010001,{MOD}{mmxreg}{R_M}:psrlw {MOD}{R_M},{mmxreg} +01100110,00001111,11010010,{Mod}{xmmreg}{R_m}:psrld {Mod}{R_m},{xmmreg} +00001111,11010010,{MOD}{mmxreg}{R_M}:psrld {MOD}{R_M},{mmxreg} +01100110,00001111,11010011,{Mod}{xmmreg}{R_m}:psrlq {Mod}{R_m},{xmmreg} +00001111,11010011,{MOD}{mmxreg}{R_M}:psrlq {MOD}{R_M},{mmxreg} +01100110,00001111,11010100,{Mod}{xmmreg}{R_m}:paddq {Mod}{R_m},{xmmreg} +00001111,11010100,{MOD}{mmxreg}{R_M}:paddq {MOD}{R_M},{mmxreg} +01100110,00001111,11010101,{Mod}{xmmreg}{R_m}:pmullw {Mod}{R_m},{xmmreg} +00001111,11010101,{MOD}{mmxreg}{R_M}:pmullw {MOD}{R_M},{mmxreg} +01100110,00001111,11010110,{Mod}{xmmreg}{R_m}:movq {xmmreg},{Mod}{R_m} +11110010,00001111,11010110,11{mmxreg}{xmmreg}:movdq2q {xmmreg},{mmxreg} +11110011,00001111,11010110,11{xmmreg}{mmxreg}:movq2dq {mmxreg},{xmmreg} +01100110,00001111,11010111,11{reg}{xmmreg}:pmovmskb {xmmreg},{reg} +00001111,11010111,11{reg}{mmxreg}:pmovmskb {mmxreg},{reg} +01100110,00001111,11011000,{Mod}{xmmreg}{R_m}:psubusb {Mod}{R_m},{xmmreg} +00001111,11011000,{MOD}{mmxreg}{R_M}:psubusb {MOD}{R_M},{mmxreg} +01100110,00001111,11011001,{Mod}{xmmreg}{R_m}:psubusw {Mod}{R_m},{xmmreg} +00001111,11011001,{MOD}{mmxreg}{R_M}:psubusw {MOD}{R_M},{mmxreg} +01100110,00001111,11011010,{Mod}{xmmreg}{R_m}:pminub {Mod}{R_m},{xmmreg} +00001111,11011010,{MOD}{mmxreg}{R_M}:pminub {MOD}{R_M},{mmxreg} +01100110,00001111,11011100,{Mod}{xmmreg}{R_m}:paddusb {Mod}{R_m},{xmmreg} +00001111,11011100,{MOD}{mmxreg}{R_M}:paddusb {MOD}{R_M},{mmxreg} +01100110,00001111,11011101,{Mod}{xmmreg}{R_m}:paddusw {Mod}{R_m},{xmmreg} +00001111,11011101,{MOD}{mmxreg}{R_M}:paddusw {MOD}{R_M},{mmxreg} +01100110,00001111,11011110,{Mod}{xmmreg}{R_m}:pmaxub {Mod}{R_m},{xmmreg} +00001111,11011110,{MOD}{mmxreg}{R_M}:pmaxub {MOD}{R_M},{mmxreg} +01100110,00001111,11100000,{Mod}{xmmreg}{R_m}:pavgb {Mod}{R_m},{xmmreg} +00001111,11100000,{MOD}{mmxreg}{R_M}:pavgb {MOD}{R_M},{mmxreg} +01100110,00001111,11100001,{Mod}{xmmreg}{R_m}:psraw {Mod}{R_m},{xmmreg} +00001111,11100001,{MOD}{mmxreg}{R_M}:psraw {MOD}{R_M},{mmxreg} +01100110,00001111,11100010,{Mod}{xmmreg}{R_m}:psrad {Mod}{R_m},{xmmreg} +00001111,11100010,{MOD}{mmxreg}{R_M}:psrad {MOD}{R_M},{mmxreg} +01100110,00001111,11100011,{Mod}{xmmreg}{R_m}:pavgw {Mod}{R_m},{xmmreg} +00001111,11100011,{MOD}{mmxreg}{R_M}:pavgw {MOD}{R_M},{mmxreg} +01100110,00001111,11100100,{Mod}{xmmreg}{R_m}:pmulhuw {Mod}{R_m},{xmmreg} +00001111,11100100,{MOD}{mmxreg}{R_M}:pmulhuw {MOD}{R_M},{mmxreg} +01100110,00001111,11100101,{Mod}{xmmreg}{R_m}:pmulhw {Mod}{R_m},{xmmreg} +00001111,11100101,{MOD}{mmxreg}{R_M}:pmulhw {MOD}{R_M},{mmxreg} +01100110,00001111,11100111,{Mod}{xmmreg}{R_m}:movntdq {xmmreg},{Mod}{R_m} +00001111,11100111,{MOD}{mmxreg}{R_M}:movntq {mmxreg},{MOD}{R_M} +01100110,00001111,11101000,{Mod}{xmmreg}{R_m}:psubsb {Mod}{R_m},{xmmreg} +00001111,11101000,{MOD}{mmxreg}{R_M}:psubsb {MOD}{R_M},{mmxreg} +01100110,00001111,11101001,{Mod}{xmmreg}{R_m}:psubsw {Mod}{R_m},{xmmreg} +00001111,11101001,{MOD}{mmxreg}{R_M}:psubsw {MOD}{R_M},{mmxreg} +01100110,00001111,11101010,{Mod}{xmmreg}{R_m}:pminsw {Mod}{R_m},{xmmreg} +00001111,11101010,{MOD}{mmxreg}{R_M}:pminsw {MOD}{R_M},{mmxreg} +01100110,00001111,11101100,{Mod}{xmmreg}{R_m}:paddsb {Mod}{R_m},{xmmreg} +00001111,11101100,{MOD}{mmxreg}{R_M}:paddsb {MOD}{R_M},{mmxreg} +01100110,00001111,11101101,{Mod}{xmmreg}{R_m}:paddsw {Mod}{R_m},{xmmreg} +00001111,11101101,{MOD}{mmxreg}{R_M}:paddsw {MOD}{R_M},{mmxreg} +01100110,00001111,11101110,{Mod}{xmmreg}{R_m}:pmaxsw {Mod}{R_m},{xmmreg} +00001111,11101110,{MOD}{mmxreg}{R_M}:pmaxsw {MOD}{R_M},{mmxreg} +11110010,00001111,11110000,{mod}{xmmreg}{r_m}:lddqu {mod}{r_m},{xmmreg} +01100110,00001111,11110001,{Mod}{xmmreg}{R_m}:psllw {Mod}{R_m},{xmmreg} +00001111,11110001,{MOD}{mmxreg}{R_M}:psllw {MOD}{R_M},{mmxreg} +01100110,00001111,11110010,{Mod}{xmmreg}{R_m}:pslld {Mod}{R_m},{xmmreg} +00001111,11110010,{MOD}{mmxreg}{R_M}:pslld {MOD}{R_M},{mmxreg} +01100110,00001111,11110011,{Mod}{xmmreg}{R_m}:psllq {Mod}{R_m},{xmmreg} +00001111,11110011,{MOD}{mmxreg}{R_M}:psllq {MOD}{R_M},{mmxreg} +01100110,00001111,11110100,{Mod}{xmmreg}{R_m}:pmuludq {Mod}{R_m},{xmmreg} +00001111,11110100,{MOD}{mmxreg}{R_M}:pmuludq {MOD}{R_M},{mmxreg} +01100110,00001111,11110110,{Mod}{xmmreg}{R_m}:psadbw {Mod}{R_m},{xmmreg} +00001111,11110110,{MOD}{mmxreg}{R_M}:psadbw {MOD}{R_M},{mmxreg} +01100110,00001111,11110111,11{xmmreg1}{xmmreg2}:maskmovdqu {xmmreg2},{xmmreg1} +00001111,11110111,11{mmxreg1}{mmxreg2}:maskmovq {mmxreg2},{mmxreg1} +01100110,00001111,11111000,{Mod}{xmmreg}{R_m}:psubb {Mod}{R_m},{xmmreg} +00001111,11111000,{MOD}{mmxreg}{R_M}:psubb {MOD}{R_M},{mmxreg} +01100110,00001111,11111001,{Mod}{xmmreg}{R_m}:psubw {Mod}{R_m},{xmmreg} +00001111,11111001,{MOD}{mmxreg}{R_M}:psubw {MOD}{R_M},{mmxreg} +01100110,00001111,11111010,{Mod}{xmmreg}{R_m}:psubd {Mod}{R_m},{xmmreg} +00001111,11111010,{MOD}{mmxreg}{R_M}:psubd {MOD}{R_M},{mmxreg} +01100110,00001111,11111011,{Mod}{xmmreg}{R_m}:psubq {Mod}{R_m},{xmmreg} +00001111,11111011,{MOD}{mmxreg}{R_M}:psubq {MOD}{R_M},{mmxreg} +01100110,00001111,11111100,{Mod}{xmmreg}{R_m}:paddb {Mod}{R_m},{xmmreg} +00001111,11111100,{MOD}{mmxreg}{R_M}:paddb {MOD}{R_M},{mmxreg} +01100110,00001111,11111101,{Mod}{xmmreg}{R_m}:paddw {Mod}{R_m},{xmmreg} +00001111,11111101,{MOD}{mmxreg}{R_M}:paddw {MOD}{R_M},{mmxreg} +01100110,00001111,11111110,{Mod}{xmmreg}{R_m}:paddd {Mod}{R_m},{xmmreg} +00001111,11111110,{MOD}{mmxreg}{R_M}:paddd {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000000,{Mod}{xmmreg}{R_m}:pshufb {Mod}{R_m},{xmmreg} +00001111,00111000,00000000,{MOD}{mmxreg}{R_M}:pshufb {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000001,{Mod}{xmmreg}{R_m}:phaddw {Mod}{R_m},{xmmreg} +00001111,00111000,00000001,{MOD}{mmxreg}{R_M}:phaddw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000010,{Mod}{xmmreg}{R_m}:phaddd {Mod}{R_m},{xmmreg} +00001111,00111000,00000010,{MOD}{mmxreg}{R_M}:phaddd {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000011,{Mod}{xmmreg}{R_m}:phaddsw {Mod}{R_m},{xmmreg} +00001111,00111000,00000011,{MOD}{mmxreg}{R_M}:phaddsw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000100,{Mod}{xmmreg}{R_m}:pmaddubsw {Mod}{R_m},{xmmreg} +00001111,00111000,00000100,{MOD}{mmxreg}{R_M}:pmaddubsw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000101,{Mod}{xmmreg}{R_m}:phsubw {Mod}{R_m},{xmmreg} +00001111,00111000,00000101,{MOD}{mmxreg}{R_M}:phsubw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000110,{Mod}{xmmreg}{R_m}:phsubd {Mod}{R_m},{xmmreg} +00001111,00111000,00000110,{MOD}{mmxreg}{R_M}:phsubd {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00000111,{Mod}{xmmreg}{R_m}:phsubsw {Mod}{R_m},{xmmreg} +00001111,00111000,00000111,{MOD}{mmxreg}{R_M}:phsubsw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00001000,{Mod}{xmmreg}{R_m}:psignb {Mod}{R_m},{xmmreg} +00001111,00111000,00001000,{MOD}{mmxreg}{R_M}:psignb {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00001001,{Mod}{xmmreg}{R_m}:psignw {Mod}{R_m},{xmmreg} +00001111,00111000,00001001,{MOD}{mmxreg}{R_M}:psignw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00001010,{Mod}{xmmreg}{R_m}:psignd {Mod}{R_m},{xmmreg} +00001111,00111000,00001010,{MOD}{mmxreg}{R_M}:psignd {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00001011,{Mod}{xmmreg}{R_m}:pmulhrsw {Mod}{R_m},{xmmreg} +00001111,00111000,00001011,{MOD}{mmxreg}{R_M}:pmulhrsw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00011100,{Mod}{xmmreg}{R_m}:pabsb {Mod}{R_m},{xmmreg} +00001111,00111000,00011100,{MOD}{mmxreg}{R_M}:pabsb {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00011101,{Mod}{xmmreg}{R_m}:pabsw {Mod}{R_m},{xmmreg} +00001111,00111000,00011101,{MOD}{mmxreg}{R_M}:pabsw {MOD}{R_M},{mmxreg} +01100110,00001111,00111000,00011110,{Mod}{xmmreg}{R_m}:pabsd {Mod}{R_m},{xmmreg} +00001111,00111000,00011110,{MOD}{mmxreg}{R_M}:pabsd {MOD}{R_M},{mmxreg} +01100110,00001111,00111010,00001111,{Mod}{xmmreg}{R_m},{imm8}:palignr {imm8},{Mod}{R_m},{xmmreg} +00001111,00111010,00001111,{MOD}{mmxreg}{R_M},{imm8}:palignr {imm8},{MOD}{R_M},{mmxreg} +01100110,00001111,11000111,{mod}110{r_m}:vmclear {mod}{r_m} +11110011,00001111,11000111,{mod}110{r_m}:vmxon {mod}{r_m} +00001111,11000111,{mod}110{r_m}:vmptrld {mod}{r_m} +00001111,11000111,{mod}111{r_m}:vmptrst {mod}{r_m} +01100110,00001111,01110001,11010{xmmreg},{imm8}:psrlw {imm8},{xmmreg} +00001111,01110001,11010{mmxreg},{imm8}:psrlw {imm8},{mmxreg} +01100110,00001111,01110001,11100{xmmreg},{imm8}:psraw {imm8},{xmmreg} +00001111,01110001,11100{mmxreg},{imm8}:psraw {imm8},{mmxreg} +01100110,00001111,01110001,11110{xmmreg},{imm8}:psllw {imm8},{xmmreg} +00001111,01110001,11110{mmxreg},{imm8}:psllw {imm8},{mmxreg} +01100110,00001111,01110010,11010{xmmreg},{imm8}:psrld {imm8},{xmmreg} +00001111,01110010,11010{mmxreg},{imm8}:psrld {imm8},{mmxreg} +01100110,00001111,01110010,11100{xmmreg},{imm8}:psrad {imm8},{xmmreg} +00001111,01110010,11100{mmxreg},{imm8}:psrad {imm8},{mmxreg} +01100110,00001111,01110010,11110{xmmreg},{imm8}:pslld {imm8},{xmmreg} +00001111,01110010,11110{mmxreg},{imm8}:pslld {imm8},{mmxreg} +01100110,00001111,01110011,11010{xmmreg},{imm8}:psrlq {imm8},{xmmreg} +00001111,01110011,11010{mmxreg},{imm8}:psrlq {imm8},{mmxreg} +01100110,00001111,01110011,11011{xmmreg},{imm8}:psrldq {imm8},{xmmreg} +01100110,00001111,01110011,11110{xmmreg},{imm8}:psllq {imm8},{xmmreg} +00001111,01110011,11110{mmxreg},{imm8}:psllq {imm8},{mmxreg} +01100110,00001111,01110011,11111{xmmreg},{imm8}:pslldq {imm8},{xmmreg} +00001111,10101110,11101000:lfence +00001111,10101110,11110000:mfence +00001111,10101110,11111000:sfence +00001111,10101110,{mod}111{r_m}:clflush {mod}{r_m} +00001111,00001111,{MOD}{mmxreg}{R_M}:INVALID {MOD}{R_M},{mmxreg} +01100110,00001111,00111010,00001100,{Mod}{xmmreg}{R_m},{imm8}:blendps {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001101,{Mod}{xmmreg}{R_m},{imm8}:blendpd {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010100,{Mod}{xmmreg}{R_m}:blendvps %xmm0,{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010101,{Mod}{xmmreg}{R_m}:blendvpd %xmm0,{Mod}{R_m},{xmmreg} +# ORDER: +dnl Many previous entries depend on this being last. +000{sreg2}111:pop {sreg2} +# ORDER END: diff --git a/libcpu/i386_data.h b/libcpu/i386_data.h new file mode 100644 index 00000000..42e66500 --- /dev/null +++ b/libcpu/i386_data.h @@ -0,0 +1,1415 @@ +/* Helper routines for disassembler for x86/x86-64. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <stdint.h> +#include <libasm.h> + +struct instr_enc +{ + /* The mnemonic. Especially encoded for the optimized table. */ + unsigned int mnemonic : MNEMONIC_BITS; + + /* The rep/repe prefixes. */ + unsigned int rep : 1; + unsigned int repe : 1; + + /* Mnemonic suffix. */ + unsigned int suffix : SUFFIX_BITS; + + /* Nonzero if the instruction uses modr/m. */ + unsigned int modrm : 1; + + /* 1st parameter. */ + unsigned int fct1 : FCT1_BITS; +#ifdef STR1_BITS + unsigned int str1 : STR1_BITS; +#endif + unsigned int off1_1 : OFF1_1_BITS; + unsigned int off1_2 : OFF1_2_BITS; + unsigned int off1_3 : OFF1_3_BITS; + + /* 2nd parameter. */ + unsigned int fct2 : FCT2_BITS; +#ifdef STR2_BITS + unsigned int str2 : STR2_BITS; +#endif + unsigned int off2_1 : OFF2_1_BITS; + unsigned int off2_2 : OFF2_2_BITS; + unsigned int off2_3 : OFF2_3_BITS; + + /* 3rd parameter. */ + unsigned int fct3 : FCT3_BITS; +#ifdef STR3_BITS + unsigned int str3 : STR3_BITS; +#endif + unsigned int off3_1 : OFF3_1_BITS; +#ifdef OFF3_2_BITS + unsigned int off3_2 : OFF3_2_BITS; +#endif +#ifdef OFF3_3_BITS + unsigned int off3_3 : OFF3_3_BITS; +#endif +}; + + +typedef int (*opfct_t) (struct output_data *); + + +static int +data_prefix (struct output_data *d) +{ + char ch = '\0'; + if (*d->prefixes & has_cs) + { + ch = 'c'; + *d->prefixes &= ~has_cs; + } + else if (*d->prefixes & has_ds) + { + ch = 'd'; + *d->prefixes &= ~has_ds; + } + else if (*d->prefixes & has_es) + { + ch = 'e'; + *d->prefixes &= ~has_es; + } + else if (*d->prefixes & has_fs) + { + ch = 'f'; + *d->prefixes &= ~has_fs; + } + else if (*d->prefixes & has_gs) + { + ch = 'g'; + *d->prefixes &= ~has_gs; + } + else if (*d->prefixes & has_ss) + { + ch = 's'; + *d->prefixes &= ~has_ss; + } + else + return 0; + + if (*d->bufcntp + 4 > d->bufsize) + return *d->bufcntp + 4 - d->bufsize; + + d->bufp[(*d->bufcntp)++] = '%'; + d->bufp[(*d->bufcntp)++] = ch; + d->bufp[(*d->bufcntp)++] = 's'; + d->bufp[(*d->bufcntp)++] = ':'; + + return 0; +} + +#ifdef X86_64 +static const char hiregs[8][4] = + { + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" + }; +static const char aregs[8][4] = + { + "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi" + }; +static const char dregs[8][4] = + { + "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" + }; +#else +static const char aregs[8][4] = + { + "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" + }; +# define dregs aregs +#endif + +static int +general_mod$r_m (struct output_data *d) +{ + int r = data_prefix (d); + if (r != 0) + return r; + + int prefixes = *d->prefixes; + const uint8_t *data = &d->data[d->opoff1 / 8]; + char *bufp = d->bufp; + size_t *bufcntp = d->bufcntp; + size_t bufsize = d->bufsize; + + uint_fast8_t modrm = data[0]; +#ifndef X86_64 + if (unlikely ((prefixes & has_addr16) != 0)) + { + int16_t disp = 0; + bool nodisp = false; + + if ((modrm & 0xc7) == 6 || (modrm & 0xc0) == 0x80) + /* 16 bit displacement. */ + disp = read_2sbyte_unaligned (&data[1]); + else if ((modrm & 0xc0) == 0x40) + /* 8 bit displacement. */ + disp = *(const int8_t *) &data[1]; + else if ((modrm & 0xc0) == 0) + nodisp = true; + + char tmpbuf[sizeof ("-0x1234(%rr,%rr)")]; + int n; + if ((modrm & 0xc7) == 6) + n = snprintf (tmpbuf, sizeof (tmpbuf), "0x%" PRIx16, disp); + else + { + n = 0; + if (!nodisp) + n = snprintf (tmpbuf, sizeof (tmpbuf), "%s0x%" PRIx16, + disp < 0 ? "-" : "", disp < 0 ? -disp : disp); + + if ((modrm & 0x4) == 0) + n += snprintf (tmpbuf + n, sizeof (tmpbuf) - n, "(%%b%c,%%%ci)", + "xp"[(modrm >> 1) & 1], "sd"[modrm & 1]); + else + n += snprintf (tmpbuf + n, sizeof (tmpbuf) - n, "(%%%s)", + ((const char [4][3]) { "si", "di", "bp", "bx" })[modrm & 3]); + } + + if (*bufcntp + n + 1 > bufsize) + return *bufcntp + n + 1 - bufsize; + + memcpy (&bufp[*bufcntp], tmpbuf, n + 1); + *bufcntp += n; + } + else +#endif + { + if ((modrm & 7) != 4) + { + int32_t disp = 0; + bool nodisp = false; + + if ((modrm & 0xc7) == 5 || (modrm & 0xc0) == 0x80) + /* 32 bit displacement. */ + disp = read_4sbyte_unaligned (&data[1]); + else if ((modrm & 0xc0) == 0x40) + /* 8 bit displacement. */ + disp = *(const int8_t *) &data[1]; + else if ((modrm & 0xc0) == 0) + nodisp = true; + + char tmpbuf[sizeof ("-0x12345678(%rrrr)")]; + int n; + if (nodisp) + { + n = snprintf (tmpbuf, sizeof (tmpbuf), "(%%%s)", +#ifdef X86_64 + (prefixes & has_rex_b) ? hiregs[modrm & 7] : +#endif + aregs[modrm & 7]); +#ifdef X86_64 + if (prefixes & has_addr16) + { + if (prefixes & has_rex_b) + tmpbuf[n++] = 'd'; + else + tmpbuf[2] = 'e'; + } +#endif + } + else if ((modrm & 0xc7) != 5) + { + int p; + n = snprintf (tmpbuf, sizeof (tmpbuf), "%s0x%" PRIx32 "(%%%n%s)", + disp < 0 ? "-" : "", disp < 0 ? -disp : disp, &p, +#ifdef X86_64 + (prefixes & has_rex_b) ? hiregs[modrm & 7] : +#endif + aregs[modrm & 7]); +#ifdef X86_64 + if (prefixes & has_addr16) + { + if (prefixes & has_rex_b) + tmpbuf[n++] = 'd'; + else + tmpbuf[p] = 'e'; + } +#endif + } + else + { +#ifdef X86_64 + n = snprintf (tmpbuf, sizeof (tmpbuf), "%s0x%" PRIx32 "(%%rip)", + disp < 0 ? "-" : "", disp < 0 ? -disp : disp); + + d->symaddr_use = addr_rel_always; + d->symaddr = disp; +#else + n = snprintf (tmpbuf, sizeof (tmpbuf), "0x%" PRIx32, disp); +#endif + } + + if (*bufcntp + n + 1 > bufsize) + return *bufcntp + n + 1 - bufsize; + + memcpy (&bufp[*bufcntp], tmpbuf, n + 1); + *bufcntp += n; + } + else + { + /* SIB */ + uint_fast8_t sib = data[1]; + int32_t disp = 0; + bool nodisp = false; + + if ((modrm & 0xc7) == 5 || (modrm & 0xc0) == 0x80 + || ((modrm & 0xc7) == 0x4 && (sib & 0x7) == 0x5)) + /* 32 bit displacement. */ + disp = read_4sbyte_unaligned (&data[2]); + else if ((modrm & 0xc0) == 0x40) + /* 8 bit displacement. */ + disp = *(const int8_t *) &data[2]; + else + nodisp = true; + + char tmpbuf[sizeof ("-0x12345678(%rrrr,%rrrr,N)")]; + char *cp = tmpbuf; + int n; + if ((modrm & 0xc0) != 0 || (sib & 0x3f) != 0x25 +#ifdef X86_64 + || (prefixes & has_rex_x) != 0 +#endif + ) + { + if (!nodisp) + { + n = snprintf (cp, sizeof (tmpbuf), "%s0x%" PRIx32, + disp < 0 ? "-" : "", disp < 0 ? -disp : disp); + cp += n; + } + + *cp++ = '('; + + if ((modrm & 0xc7) != 0x4 || (sib & 0x7) != 0x5) + { + *cp++ = '%'; + cp = stpcpy (cp, +#ifdef X86_64 + (prefixes & has_rex_b) ? hiregs[sib & 7] : + (prefixes & has_addr16) ? dregs[sib & 7] : +#endif + aregs[sib & 7]); +#ifdef X86_64 + if ((prefixes & (has_rex_b | has_addr16)) + == (has_rex_b | has_addr16)) + *cp++ = 'd'; +#endif + } + + if ((sib & 0x38) != 0x20 +#ifdef X86_64 + || (prefixes & has_rex_x) != 0 +#endif + ) + { + *cp++ = ','; + *cp++ = '%'; + cp = stpcpy (cp, +#ifdef X86_64 + (prefixes & has_rex_x) + ? hiregs[(sib >> 3) & 7] : + (prefixes & has_addr16) + ? dregs[(sib >> 3) & 7] : +#endif + aregs[(sib >> 3) & 7]); +#ifdef X86_64 + if ((prefixes & (has_rex_b | has_addr16)) + == (has_rex_b | has_addr16)) + *cp++ = 'd'; +#endif + + *cp++ = ','; + *cp++ = '0' + (1 << (sib >> 6)); + } + + *cp++ = ')'; + } + else + { + assert (! nodisp); +#ifdef X86_64 + if ((prefixes & has_addr16) == 0) + n = snprintf (cp, sizeof (tmpbuf), "0x%" PRIx64, + (int64_t) disp); + else +#endif + n = snprintf (cp, sizeof (tmpbuf), "0x%" PRIx32, disp); + cp += n; + } + + if (*bufcntp + (cp - tmpbuf) > bufsize) + return *bufcntp + (cp - tmpbuf) - bufsize; + + memcpy (&bufp[*bufcntp], tmpbuf, cp - tmpbuf); + *bufcntp += cp - tmpbuf; + } + } + return 0; +} + + +static int +FCT_MOD$R_M (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + assert (d->opoff1 / 8 == d->opoff2 / 8); + assert (d->opoff2 % 8 == 5); + //uint_fast8_t byte = d->data[d->opoff2 / 8] & 7; + uint_fast8_t byte = modrm & 7; + + size_t *bufcntp = d->bufcntp; + char *buf = d->bufp + *bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed; + if (*d->prefixes & (has_rep | has_repne)) + needed = snprintf (buf, avail, "%%%s", dregs[byte]); + else + needed = snprintf (buf, avail, "%%mm%" PRIxFAST8, byte); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; + } + + return general_mod$r_m (d); +} + + +static int +FCT_Mod$R_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + assert (d->opoff1 / 8 == d->opoff2 / 8); + assert (d->opoff2 % 8 == 5); + //uint_fast8_t byte = data[opoff2 / 8] & 7; + uint_fast8_t byte = modrm & 7; + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%xmm%" PRIxFAST8, + byte); + if ((size_t) needed > avail) + return needed - avail; + *d->bufcntp += needed; + return 0; + } + + return general_mod$r_m (d); +} + +static int +generic_abs (struct output_data *d, const char *absstring +#ifdef X86_64 + , int abslen +#else +# define abslen 4 +#endif + ) +{ + int r = data_prefix (d); + if (r != 0) + return r; + + assert (d->opoff1 % 8 == 0); + assert (d->opoff1 / 8 == 1); + if (*d->param_start + abslen > d->end) + return -1; + *d->param_start += abslen; +#ifndef X86_64 + uint32_t absval; +# define ABSPRIFMT PRIx32 +#else + uint64_t absval; +# define ABSPRIFMT PRIx64 + if (abslen == 8) + absval = read_8ubyte_unaligned (&d->data[1]); + else +#endif + absval = read_4ubyte_unaligned (&d->data[1]); + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%s0x%" ABSPRIFMT, + absstring, absval); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_absval (struct output_data *d) +{ + return generic_abs (d, "$" +#ifdef X86_64 + , 4 +#endif + ); +} + +static int +FCT_abs (struct output_data *d) +{ + return generic_abs (d, "" +#ifdef X86_64 + , 8 +#endif + ); +} + +static int +FCT_ax (struct output_data *d) +{ + int is_16bit = (*d->prefixes & has_data16) != 0; + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + size_t bufsize = d->bufsize; + + if (*bufcntp + 4 - is_16bit > bufsize) + return *bufcntp + 4 - is_16bit - bufsize; + + bufp[(*bufcntp)++] = '%'; + if (! is_16bit) + bufp[(*bufcntp)++] = ( +#ifdef X86_64 + (*d->prefixes & has_rex_w) ? 'r' : +#endif + 'e'); + bufp[(*bufcntp)++] = 'a'; + bufp[(*bufcntp)++] = 'x'; + + return 0; +} + + +static int +FCT_ax$w (struct output_data *d) +{ + if ((d->data[d->opoff2 / 8] & (1 << (7 - (d->opoff2 & 7)))) != 0) + return FCT_ax (d); + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + size_t bufsize = d->bufsize; + + if (*bufcntp + 3 > bufsize) + return *bufcntp + 3 - bufsize; + + bufp[(*bufcntp)++] = '%'; + bufp[(*bufcntp)++] = 'a'; + bufp[(*bufcntp)++] = 'l'; + + return 0; +} + + +static int +__attribute__ ((noinline)) +FCT_crdb (struct output_data *d, const char *regstr) +{ + if (*d->prefixes & has_data16) + return -1; + + size_t *bufcntp = d->bufcntp; + + // XXX If this assert is true, use absolute offset below + assert (d->opoff1 / 8 == 2); + assert (d->opoff1 % 8 == 2); + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%%s%" PRIx32, + regstr, (uint32_t) (d->data[d->opoff1 / 8] >> 3) & 7); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_ccc (struct output_data *d) +{ + return FCT_crdb (d, "cr"); +} + + +static int +FCT_ddd (struct output_data *d) +{ + return FCT_crdb (d, "db"); +} + + +static int +FCT_disp8 (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + if (*d->param_start >= d->end) + return -1; + int32_t offset = *(const int8_t *) (*d->param_start)++; + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "0x%" PRIx32, + (uint32_t) (d->addr + (*d->param_start - d->data) + + offset)); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +__attribute__ ((noinline)) +FCT_ds_xx (struct output_data *d, const char *reg) +{ + int prefix = *d->prefixes & SEGMENT_PREFIXES; + + if (prefix == 0) + *d->prefixes |= prefix = has_ds; + /* Make sure only one bit is set. */ + else if ((prefix - 1) & prefix) + return -1; + + int r = data_prefix (d); + + assert ((*d->prefixes & prefix) == 0); + + if (r != 0) + return r; + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "(%%%s%s)", +#ifdef X86_64 + *d->prefixes & idx_addr16 ? "e" : "r", +#else + *d->prefixes & idx_addr16 ? "" : "e", +#endif + reg); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + + return 0; +} + + +static int +FCT_ds_bx (struct output_data *d) +{ + return FCT_ds_xx (d, "bx"); +} + + +static int +FCT_ds_si (struct output_data *d) +{ + return FCT_ds_xx (d, "si"); +} + + +static int +FCT_dx (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + + if (*bufcntp + 7 > d->bufsize) + return *bufcntp + 7 - d->bufsize; + + memcpy (&d->bufp[*bufcntp], "(%dx)", 5); + *bufcntp += 5; + + return 0; +} + + +static int +FCT_es_di (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%es:(%%%sdi)", +#ifdef X86_64 + *d->prefixes & idx_addr16 ? "e" : "r" +#else + *d->prefixes & idx_addr16 ? "" : "e" +#endif + ); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + + return 0; +} + + +static int +FCT_imm (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed; + if (*d->prefixes & has_data16) + { + if (*d->param_start + 2 > d->end) + return -1; + uint16_t word = read_2ubyte_unaligned_inc (*d->param_start); + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx16, word); + } + else + { + if (*d->param_start + 4 > d->end) + return -1; + int32_t word = read_4sbyte_unaligned_inc (*d->param_start); +#ifdef X86_64 + if (*d->prefixes & has_rex_w) + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64, + (int64_t) word); + else +#endif + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, word); + } + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_imm$w (struct output_data *d) +{ + if ((d->data[d->opoff2 / 8] & (1 << (7 - (d->opoff2 & 7)))) != 0) + return FCT_imm (d); + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if (*d->param_start>= d->end) + return -1; + uint_fast8_t word = *(*d->param_start)++; + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIxFAST8, word); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +#ifdef X86_64 +static int +FCT_imm64$w (struct output_data *d) +{ + if ((d->data[d->opoff2 / 8] & (1 << (7 - (d->opoff2 & 7)))) == 0 + || (*d->prefixes & has_data16) != 0) + return FCT_imm$w (d); + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed; + if (*d->prefixes & has_rex_w) + { + if (*d->param_start + 8 > d->end) + return -1; + uint64_t word = read_8ubyte_unaligned_inc (*d->param_start); + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64, word); + } + else + { + if (*d->param_start + 4 > d->end) + return -1; + int32_t word = read_4sbyte_unaligned_inc (*d->param_start); + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, word); + } + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} +#endif + + +static int +FCT_imms (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if (*d->param_start>= d->end) + return -1; + int8_t byte = *(*d->param_start)++; +#ifdef X86_64 + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64, + (int64_t) byte); +#else + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, + (int32_t) byte); +#endif + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_imm$s (struct output_data *d) +{ + uint_fast8_t opcode = d->data[d->opoff2 / 8]; + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if ((opcode & 2) != 0) + return FCT_imms (d); + + if ((*d->prefixes & has_data16) == 0) + { + if (*d->param_start + 4 > d->end) + return -1; + int32_t word = read_4sbyte_unaligned_inc (*d->param_start); +#ifdef X86_64 + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64, + (int64_t) word); +#else + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, word); +#endif + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + } + else + { + if (*d->param_start + 2 > d->end) + return -1; + uint16_t word = read_2ubyte_unaligned_inc (*d->param_start); + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx16, word); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + } + return 0; +} + + +static int +FCT_imm16 (struct output_data *d) +{ + if (*d->param_start + 2 > d->end) + return -1; + uint16_t word = read_2ubyte_unaligned_inc (*d->param_start); + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx16, word); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_imms8 (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if (*d->param_start >= d->end) + return -1; + int_fast8_t byte = *(*d->param_start)++; + int needed; +#ifdef X86_64 + if (*d->prefixes & has_rex_w) + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64, + (int64_t) byte); + else +#endif + needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, + (int32_t) byte); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_imm8 (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if (*d->param_start >= d->end) + return -1; + uint_fast8_t byte = *(*d->param_start)++; + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, + (uint32_t) byte); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_rel (struct output_data *d) +{ + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + if (*d->param_start + 4 > d->end) + return -1; + int32_t rel = read_4sbyte_unaligned_inc (*d->param_start); +#ifdef X86_64 + int needed = snprintf (&d->bufp[*bufcntp], avail, "0x%" PRIx64, + (uint64_t) (d->addr + rel + + (*d->param_start - d->data))); +#else + int needed = snprintf (&d->bufp[*bufcntp], avail, "0x%" PRIx32, + (uint32_t) (d->addr + rel + + (*d->param_start - d->data))); +#endif + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_mmxreg (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 == 2 || d->opoff1 % 8 == 5); + byte = (byte >> (5 - d->opoff1 % 8)) & 7; + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%mm%" PRIxFAST8, byte); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_mod$r_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + int prefixes = *d->prefixes; + if (prefixes & has_addr16) + return -1; + + int is_16bit = (prefixes & has_data16) != 0; + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + if (*bufcntp + 5 - is_16bit > d->bufsize) + return *bufcntp + 5 - is_16bit - d->bufsize; + bufp[(*bufcntp)++] = '%'; + + char *cp; +#ifdef X86_64 + if ((prefixes & has_rex_b) != 0 && !is_16bit) + { + cp = stpcpy (&bufp[*bufcntp], hiregs[modrm & 7]); + if ((prefixes & has_rex_w) == 0) + *cp++ = 'd'; + } + else +#endif + { + cp = stpcpy (&bufp[*bufcntp], dregs[modrm & 7] + is_16bit); +#ifdef X86_64 + if ((prefixes & has_rex_w) != 0) + bufp[*bufcntp] = 'r'; +#endif + } + *bufcntp = cp - bufp; + return 0; + } + + return general_mod$r_m (d); +} + + +#ifndef X86_64 +static int +FCT_moda$r_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + if (*d->prefixes & has_addr16) + return -1; + + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 3 > d->bufsize) + return *bufcntp + 3 - d->bufsize; + + memcpy (&d->bufp[*bufcntp], "???", 3); + *bufcntp += 3; + + return 0; + } + + return general_mod$r_m (d); +} +#endif + + +#ifdef X86_64 +static const char rex_8bit[8][3] = + { + [0] = "a", [1] = "c", [2] = "d", [3] = "b", + [4] = "sp", [5] = "bp", [6] = "si", [7] = "di" + }; +#endif + + +static int +FCT_mod$r_m$w (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + const uint8_t *data = d->data; + uint_fast8_t modrm = data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + int prefixes = *d->prefixes; + + if (prefixes & has_addr16) + return -1; + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + if (*bufcntp + 5 > d->bufsize) + return *bufcntp + 5 - d->bufsize; + + if ((data[d->opoff3 / 8] & (1 << (7 - (d->opoff3 & 7)))) == 0) + { + bufp[(*bufcntp)++] = '%'; + +#ifdef X86_64 + if (prefixes & has_rex) + { + if (prefixes & has_rex_r) + *bufcntp += snprintf (bufp + *bufcntp, d->bufsize - *bufcntp, + "r%db", 8 + (modrm & 7)); + else + { + char *cp = stpcpy (bufp + *bufcntp, hiregs[modrm & 7]); + *cp++ = 'l'; + *bufcntp = cp - bufp; + } + } + else +#endif + { + bufp[(*bufcntp)++] = "acdb"[modrm & 3]; + bufp[(*bufcntp)++] = "lh"[(modrm & 4) >> 2]; + } + } + else + { + int is_16bit = (prefixes & has_data16) != 0; + + bufp[(*bufcntp)++] = '%'; + + char *cp; +#ifdef X86_64 + if ((prefixes & has_rex_b) != 0 && !is_16bit) + { + cp = stpcpy (&bufp[*bufcntp], hiregs[modrm & 7]); + if ((prefixes & has_rex_w) == 0) + *cp++ = 'd'; + } + else +#endif + { + cp = stpcpy (&bufp[*bufcntp], dregs[modrm & 7] + is_16bit); +#ifdef X86_64 + if ((prefixes & has_rex_w) != 0) + bufp[*bufcntp] = 'r'; +#endif + } + *bufcntp = cp - bufp; + } + return 0; + } + + return general_mod$r_m (d); +} + + +static int +FCT_mod$8r_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + if (*bufcntp + 3 > d->bufsize) + return *bufcntp + 3 - d->bufsize; + bufp[(*bufcntp)++] = '%'; + bufp[(*bufcntp)++] = "acdb"[modrm & 3]; + bufp[(*bufcntp)++] = "lh"[(modrm & 4) >> 2]; + return 0; + } + + return general_mod$r_m (d); +} + + +static int +FCT_mod$16r_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + assert (d->opoff1 / 8 == d->opoff2 / 8); + //uint_fast8_t byte = data[opoff2 / 8] & 7; + uint_fast8_t byte = modrm & 7; + + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 3 > d->bufsize) + return *bufcntp + 3 - d->bufsize; + d->bufp[(*bufcntp)++] = '%'; + memcpy (&d->bufp[*bufcntp], dregs[byte] + 1, sizeof (dregs[0]) - 1); + *bufcntp += 2; + return 0; + } + + return general_mod$r_m (d); +} + + +#ifdef X86_64 +static int +FCT_mod$64r_m (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + uint_fast8_t modrm = d->data[d->opoff1 / 8]; + if ((modrm & 0xc0) == 0xc0) + { + assert (d->opoff1 / 8 == d->opoff2 / 8); + //uint_fast8_t byte = data[opoff2 / 8] & 7; + uint_fast8_t byte = modrm & 7; + + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 4 > d->bufsize) + return *bufcntp + 4 - d->bufsize; + char *cp = &d->bufp[*bufcntp]; + *cp++ = '%'; + cp = stpcpy (cp, + (*d->prefixes & has_rex_b) ? hiregs[byte] : aregs[byte]); + *bufcntp = cp - d->bufp; + return 0; + } + + return general_mod$r_m (d); +} +#else +static typeof (FCT_mod$r_m) FCT_mod$64r_m __attribute__ ((alias ("FCT_mod$r_m"))); +#endif + + +static int +FCT_reg (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 + 3 <= 8); + byte >>= 8 - (d->opoff1 % 8 + 3); + byte &= 7; + int is_16bit = (*d->prefixes & has_data16) != 0; + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 5 > d->bufsize) + return *bufcntp + 5 - d->bufsize; + d->bufp[(*bufcntp)++] = '%'; +#ifdef X86_64 + if ((*d->prefixes & has_rex_r) != 0 && !is_16bit) + { + *bufcntp += snprintf (&d->bufp[*bufcntp], d->bufsize - *bufcntp, "r%d", + 8 + byte); + if ((*d->prefixes & has_rex_w) == 0) + d->bufp[(*bufcntp)++] = 'd'; + } + else +#endif + { + memcpy (&d->bufp[*bufcntp], dregs[byte] + is_16bit, 3 - is_16bit); +#ifdef X86_64 + if ((*d->prefixes & has_rex_w) != 0 && !is_16bit) + d->bufp[*bufcntp] = 'r'; +#endif + *bufcntp += 3 - is_16bit; + } + return 0; +} + + +#ifdef X86_64 +static int +FCT_oreg (struct output_data *d) +{ + /* Special form where register comes from opcode. The rex.B bit is used, + rex.R and rex.X are ignored. */ + int save_prefixes = *d->prefixes; + + *d->prefixes = ((save_prefixes & ~has_rex_r) + | ((save_prefixes & has_rex_b) << (idx_rex_r - idx_rex_b))); + + int r = FCT_reg (d); + + *d->prefixes = save_prefixes; + + return r; +} +#endif + + +static int +FCT_reg64 (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 + 3 <= 8); + byte >>= 8 - (d->opoff1 % 8 + 3); + byte &= 7; + if ((*d->prefixes & has_data16) != 0) + return -1; + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 5 > d->bufsize) + return *bufcntp + 5 - d->bufsize; + d->bufp[(*bufcntp)++] = '%'; +#ifdef X86_64 + if ((*d->prefixes & has_rex_r) != 0) + { + *bufcntp += snprintf (&d->bufp[*bufcntp], d->bufsize - *bufcntp, "r%d", + 8 + byte); + if ((*d->prefixes & has_rex_w) == 0) + d->bufp[(*bufcntp)++] = 'd'; + } + else +#endif + { + memcpy (&d->bufp[*bufcntp], aregs[byte], 3); + *bufcntp += 3; + } + return 0; +} + + +static int +FCT_reg$w (struct output_data *d) +{ + if (d->data[d->opoff2 / 8] & (1 << (7 - (d->opoff2 & 7)))) + return FCT_reg (d); + + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 + 3 <= 8); + byte >>= 8 - (d->opoff1 % 8 + 3); + byte &= 7; + + size_t *bufcntp = d->bufcntp; + if (*bufcntp + 4 > d->bufsize) + return *bufcntp + 4 - d->bufsize; + + d->bufp[(*bufcntp)++] = '%'; + +#ifdef X86_64 + if (*d->prefixes & has_rex) + { + if (*d->prefixes & has_rex_r) + *bufcntp += snprintf (d->bufp + *bufcntp, d->bufsize - *bufcntp, + "r%db", 8 + byte); + else + { + char* cp = stpcpy (d->bufp + *bufcntp, rex_8bit[byte]); + *cp++ = 'l'; + *bufcntp = cp - d->bufp; + } + } + else +#endif + { + d->bufp[(*bufcntp)++] = "acdb"[byte & 3]; + d->bufp[(*bufcntp)++] = "lh"[byte >> 2]; + } + return 0; +} + + +#ifdef X86_64 +static int +FCT_oreg$w (struct output_data *d) +{ + /* Special form where register comes from opcode. The rex.B bit is used, + rex.R and rex.X are ignored. */ + int save_prefixes = *d->prefixes; + + *d->prefixes = ((save_prefixes & ~has_rex_r) + | ((save_prefixes & has_rex_b) << (idx_rex_r - idx_rex_b))); + + int r = FCT_reg$w (d); + + *d->prefixes = save_prefixes; + + return r; +} +#endif + + +static int +FCT_freg (struct output_data *d) +{ + assert (d->opoff1 / 8 == 1); + assert (d->opoff1 % 8 == 5); + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%st(%" PRIx32 ")", + (uint32_t) (d->data[1] & 7)); + if ((size_t) needed > avail) + return (size_t) needed - avail; + *bufcntp += needed; + return 0; +} + + +#ifndef X86_64 +static int +FCT_reg16 (struct output_data *d) +{ + if (*d->prefixes & has_data16) + return -1; + + *d->prefixes |= has_data16; + return FCT_reg (d); +} +#endif + + +static int +FCT_sel (struct output_data *d) +{ + assert (d->opoff1 % 8 == 0); + assert (d->opoff1 / 8 == 5); + if (*d->param_start + 2 > d->end) + return -1; + *d->param_start += 2; + uint16_t absval = read_2ubyte_unaligned (&d->data[5]); + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx16, absval); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} + + +static int +FCT_sreg2 (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 + 3 <= 8); + byte >>= 8 - (d->opoff1 % 8 + 2); + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + if (*bufcntp + 3 > d->bufsize) + return *bufcntp + 3 - d->bufsize; + + bufp[(*bufcntp)++] = '%'; + bufp[(*bufcntp)++] = "ecsd"[byte & 3]; + bufp[(*bufcntp)++] = 's'; + + return 0; +} + + +static int +FCT_sreg3 (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 + 4 <= 8); + byte >>= 8 - (d->opoff1 % 8 + 3); + + if ((byte & 7) >= 6) + return -1; + + size_t *bufcntp = d->bufcntp; + char *bufp = d->bufp; + if (*bufcntp + 3 > d->bufsize) + return *bufcntp + 3 - d->bufsize; + + bufp[(*bufcntp)++] = '%'; + bufp[(*bufcntp)++] = "ecsdfg"[byte & 7]; + bufp[(*bufcntp)++] = 's'; + + return 0; +} + + +static int +FCT_string (struct output_data *d __attribute__ ((unused))) +{ + return 0; +} + + +static int +FCT_xmmreg (struct output_data *d) +{ + uint_fast8_t byte = d->data[d->opoff1 / 8]; + assert (d->opoff1 % 8 == 2 || d->opoff1 % 8 == 5); + byte = (byte >> (5 - d->opoff1 % 8)) & 7; + + size_t *bufcntp = d->bufcntp; + size_t avail = d->bufsize - *bufcntp; + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%xmm%" PRIxFAST8, byte); + if ((size_t) needed > avail) + return needed - avail; + *bufcntp += needed; + return 0; +} diff --git a/libcpu/i386_dis.c b/libcpu/i386_dis.c deleted file mode 100644 index 971746e3..00000000 --- a/libcpu/i386_dis.c +++ /dev/null @@ -1 +0,0 @@ -int foo; diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c new file mode 100644 index 00000000..76b5a393 --- /dev/null +++ b/libcpu/i386_disasm.c @@ -0,0 +1,1042 @@ +/* Disassembler for x86. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <config.h> +#include <ctype.h> +#include <endian.h> +#include <errno.h> +#include <gelf.h> +#include <stddef.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <sys/param.h> + +#include "../libebl/libeblP.h" + +#define MACHINE_ENCODING __LITTLE_ENDIAN +#include "memory-access.h" + + +#ifndef MNEFILE +# define MNEFILE "i386.mnemonics" +#endif + +#define MNESTRFIELD(line) MNESTRFIELD1 (line) +#define MNESTRFIELD1(line) str##line +static const union mnestr_t +{ + struct + { +#define MNE(name) char MNESTRFIELD (__LINE__)[sizeof (#name)]; +#include MNEFILE +#undef MNE + }; + char str[0]; +} mnestr = + { + { +#define MNE(name) #name, +#include MNEFILE +#undef MNE + } + }; + +/* The index can be stored in the instrtab. */ +enum + { +#define MNE(name) MNE_##name, +#include MNEFILE +#undef MNE + MNE_INVALID + }; + +static const unsigned short int mneidx[] = + { +#define MNE(name) \ + [MNE_##name] = offsetof (union mnestr_t, MNESTRFIELD (__LINE__)), +#include MNEFILE +#undef MNE + }; + + +enum + { + idx_rex_b = 0, + idx_rex_x, + idx_rex_r, + idx_rex_w, + idx_rex, + idx_cs, + idx_ds, + idx_es, + idx_fs, + idx_gs, + idx_ss, + idx_data16, + idx_addr16, + idx_rep, + idx_repne, + idx_lock + }; + +enum + { +#define prefbit(pref) has_##pref = 1 << idx_##pref + prefbit (rex_b), + prefbit (rex_x), + prefbit (rex_r), + prefbit (rex_w), + prefbit (rex), + prefbit (cs), + prefbit (ds), + prefbit (es), + prefbit (fs), + prefbit (gs), + prefbit (ss), + prefbit (data16), + prefbit (addr16), + prefbit (rep), + prefbit (repne), + prefbit (lock) +#undef prefbit + }; +#define SEGMENT_PREFIXES \ + (has_cs | has_ds | has_es | has_fs | has_gs | has_ss) + +#define prefix_cs 0x2e +#define prefix_ds 0x3e +#define prefix_es 0x26 +#define prefix_fs 0x64 +#define prefix_gs 0x65 +#define prefix_ss 0x36 +#define prefix_data16 0x66 +#define prefix_addr16 0x67 +#define prefix_rep 0xf3 +#define prefix_repne 0xf2 +#define prefix_lock 0xf0 + + +static const uint8_t known_prefixes[] = + { +#define newpref(pref) [idx_##pref] = prefix_##pref + newpref (cs), + newpref (ds), + newpref (es), + newpref (fs), + newpref (gs), + newpref (ss), + newpref (data16), + newpref (addr16), + newpref (rep), + newpref (repne), + newpref (lock) +#undef newpref + }; +#define nknown_prefixes (sizeof (known_prefixes) / sizeof (known_prefixes[0])) + + +#if 0 +static const char *prefix_str[] = + { +#define newpref(pref) [idx_##pref] = #pref + newpref (cs), + newpref (ds), + newpref (es), + newpref (fs), + newpref (gs), + newpref (ss), + newpref (data16), + newpref (addr16), + newpref (rep), + newpref (repne), + newpref (lock) +#undef newpref + }; +#endif + + +static const char amd3dnowstr[] = +#define MNE_3DNOW_PAVGUSB 1 + "pavgusb\0" +#define MNE_3DNOW_PFADD (MNE_3DNOW_PAVGUSB + 8) + "pfadd\0" +#define MNE_3DNOW_PFSUB (MNE_3DNOW_PFADD + 6) + "pfsub\0" +#define MNE_3DNOW_PFSUBR (MNE_3DNOW_PFSUB + 6) + "pfsubr\0" +#define MNE_3DNOW_PFACC (MNE_3DNOW_PFSUBR + 7) + "pfacc\0" +#define MNE_3DNOW_PFCMPGE (MNE_3DNOW_PFACC + 6) + "pfcmpge\0" +#define MNE_3DNOW_PFCMPGT (MNE_3DNOW_PFCMPGE + 8) + "pfcmpgt\0" +#define MNE_3DNOW_PFCMPEQ (MNE_3DNOW_PFCMPGT + 8) + "pfcmpeq\0" +#define MNE_3DNOW_PFMIN (MNE_3DNOW_PFCMPEQ + 8) + "pfmin\0" +#define MNE_3DNOW_PFMAX (MNE_3DNOW_PFMIN + 6) + "pfmax\0" +#define MNE_3DNOW_PI2FD (MNE_3DNOW_PFMAX + 6) + "pi2fd\0" +#define MNE_3DNOW_PF2ID (MNE_3DNOW_PI2FD + 6) + "pf2id\0" +#define MNE_3DNOW_PFRCP (MNE_3DNOW_PF2ID + 6) + "pfrcp\0" +#define MNE_3DNOW_PFRSQRT (MNE_3DNOW_PFRCP + 6) + "pfrsqrt\0" +#define MNE_3DNOW_PFMUL (MNE_3DNOW_PFRSQRT + 8) + "pfmul\0" +#define MNE_3DNOW_PFRCPIT1 (MNE_3DNOW_PFMUL + 6) + "pfrcpit1\0" +#define MNE_3DNOW_PFRSQIT1 (MNE_3DNOW_PFRCPIT1 + 9) + "pfrsqit1\0" +#define MNE_3DNOW_PFRCPIT2 (MNE_3DNOW_PFRSQIT1 + 9) + "pfrcpit2\0" +#define MNE_3DNOW_PMULHRW (MNE_3DNOW_PFRCPIT2 + 9) + "pmulhrw"; + +#define AMD3DNOW_LOW_IDX 0x0d +#define AMD3DNOW_HIGH_IDX (sizeof (amd3dnow) + AMD3DNOW_LOW_IDX - 1) +#define AMD3DNOW_IDX(val) ((val) - AMD3DNOW_LOW_IDX) +static const unsigned char amd3dnow[] = + { + [AMD3DNOW_IDX (0xbf)] = MNE_3DNOW_PAVGUSB, + [AMD3DNOW_IDX (0x9e)] = MNE_3DNOW_PFADD, + [AMD3DNOW_IDX (0x9a)] = MNE_3DNOW_PFSUB, + [AMD3DNOW_IDX (0xaa)] = MNE_3DNOW_PFSUBR, + [AMD3DNOW_IDX (0xae)] = MNE_3DNOW_PFACC, + [AMD3DNOW_IDX (0x90)] = MNE_3DNOW_PFCMPGE, + [AMD3DNOW_IDX (0xa0)] = MNE_3DNOW_PFCMPGT, + [AMD3DNOW_IDX (0xb0)] = MNE_3DNOW_PFCMPEQ, + [AMD3DNOW_IDX (0x94)] = MNE_3DNOW_PFMIN, + [AMD3DNOW_IDX (0xa4)] = MNE_3DNOW_PFMAX, + [AMD3DNOW_IDX (0x0d)] = MNE_3DNOW_PI2FD, + [AMD3DNOW_IDX (0x1d)] = MNE_3DNOW_PF2ID, + [AMD3DNOW_IDX (0x96)] = MNE_3DNOW_PFRCP, + [AMD3DNOW_IDX (0x97)] = MNE_3DNOW_PFRSQRT, + [AMD3DNOW_IDX (0xb4)] = MNE_3DNOW_PFMUL, + [AMD3DNOW_IDX (0xa6)] = MNE_3DNOW_PFRCPIT1, + [AMD3DNOW_IDX (0xa7)] = MNE_3DNOW_PFRSQIT1, + [AMD3DNOW_IDX (0xb6)] = MNE_3DNOW_PFRCPIT2, + [AMD3DNOW_IDX (0xb7)] = MNE_3DNOW_PMULHRW + }; + + +struct output_data +{ + GElf_Addr addr; + int *prefixes; + size_t opoff1; + size_t opoff2; + size_t opoff3; + char *bufp; + size_t *bufcntp; + size_t bufsize; + const uint8_t *data; + const uint8_t **param_start; + const uint8_t *end; + char *labelbuf; + size_t labelbufsize; + enum + { + addr_none = 0, + addr_abs_symbolic, + addr_abs_always, + addr_rel_symbolic, + addr_rel_always + } symaddr_use; + GElf_Addr symaddr; +}; + + +#ifndef DISFILE +# define DISFILE "i386_dis.h" +#endif +#include DISFILE + + +#define ADD_CHAR(ch) \ + do { \ + if (unlikely (bufcnt == bufsize)) \ + goto enomem; \ + buf[bufcnt++] = (ch); \ + } while (0) + +#define ADD_STRING(str) \ + do { \ + const char *_str = (str); \ + size_t _len = strlen (_str); \ + if (unlikely (bufcnt + _len > bufsize)) \ + goto enomem; \ + memcpy (buf + bufcnt, str, _len); \ + bufcnt += _len; \ + } while (0) + + +int +i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, + const char *fmt, DisasmOutputCB_t outcb, DisasmGetSymCB_t symcb, + void *outcbarg, void *symcbarg) +{ + const char *save_fmt = fmt; + +#define BUFSIZE 512 + char initbuf[BUFSIZE]; + int prefixes; + size_t bufcnt; + size_t bufsize = BUFSIZE; + char *buf = initbuf; + const uint8_t *param_start; + + struct output_data output_data = + { + .prefixes = &prefixes, + .bufp = buf, + .bufsize = bufsize, + .bufcntp = &bufcnt, + .param_start = ¶m_start, + .end = end + }; + + int retval = 0; + while (1) + { + prefixes = 0; + + const uint8_t *data = *startp; + const uint8_t *begin = data; + + /* Recognize all prefixes. */ + int last_prefix_bit = 0; + while (data < end) + { + unsigned int i; + for (i = idx_cs; i < nknown_prefixes; ++i) + if (known_prefixes[i] == *data) + break; + if (i == nknown_prefixes) + break; + + prefixes |= last_prefix_bit = 1 << i; + + ++data; + } + +#ifdef X86_64 + if (data < end && (*data & 0xf0) == 0x40) + prefixes |= ((*data++) & 0xf) | has_rex; +#endif + + bufcnt = 0; + size_t cnt = 0; + + const uint8_t *curr = match_data; + const uint8_t *const match_end = match_data + sizeof (match_data); + + assert (data <= end); + if (data == end) + { + if (prefixes != 0) + goto print_prefix; + + retval = -1; + goto do_ret; + } + + next_match: + while (curr < match_end) + { + uint_fast8_t len = *curr++; + const uint8_t *start = curr; + + assert (len > 0); + assert (curr + 2 * len <= match_end); + + const uint8_t *codep = data; + int correct_prefix = 0; + int opoff = 0; + + if (data > begin && codep[-1] == curr[1] && curr[0] == 0xff) + { + /* We match a prefix byte. This is exactly one byte and + is matched exactly, without a mask. */ + --len; + start += 2; + opoff = 8; + + curr += 2; + + assert (last_prefix_bit != 0); + correct_prefix = last_prefix_bit; + } + + size_t avail = len; + while (avail > 0) + { + uint_fast8_t masked = *codep++ & *curr++; + if (masked != *curr++) + { + not: + curr = start + 2 * len; + ++cnt; + goto next_match; + } + + --avail; + if (codep == end && avail > 0) + goto do_ret; + } + + if (len > end - data) + /* There is not enough data for the entire instruction. The + caller can figure this out by looking at the pointer into + the input data. */ + goto do_ret; + + assert (correct_prefix == 0 + || (prefixes & correct_prefix) != 0); + prefixes ^= correct_prefix; + + if (0) + { + /* Resize the buffer. */ + char *oldbuf; + enomem: + oldbuf = buf; + if (buf == initbuf) + buf = malloc (2 * bufsize); + else + buf = realloc (buf, 2 * bufsize); + if (buf == NULL) + { + buf = oldbuf; + retval = ENOMEM; + goto do_ret; + } + bufsize *= 2; + + output_data.bufp = buf; + output_data.bufsize = bufsize; + bufcnt = 0; + + if (data == end) + { + assert (prefixes != 0); + goto print_prefix; + } + + /* gcc is not clever enough to see the following variables + are not used uninitialized. */ + asm ("" + : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep), + "=mr" (start), "=mr" (len)); + } + + size_t prefix_size = 0; + + // XXXonly print as prefix if valid? + if ((prefixes & has_lock) != 0) + { + ADD_STRING ("lock "); + prefix_size += 5; + } + + if (instrtab[cnt].rep) + { + if ((prefixes & has_rep) != 0) + { + ADD_STRING ("rep "); + prefix_size += 4; + } + } + else if (instrtab[cnt].repe + && (prefixes & (has_rep | has_repne)) != 0) + { + if ((prefixes & has_repne) != 0) + { + ADD_STRING ("repne "); + prefix_size += 6; + } + else if ((prefixes & has_rep) != 0) + { + ADD_STRING ("repe "); + prefix_size += 5; + } + } + else if ((prefixes & (has_rep | has_repne)) != 0) + { + uint_fast8_t byte; + print_prefix: + bufcnt = 0; + byte = *begin; + /* This is a prefix byte. Print it. */ + switch (byte) + { + case prefix_rep: + ADD_STRING ("rep"); + break; + case prefix_repne: + ADD_STRING ("repne"); + break; + case prefix_cs: + ADD_STRING ("cs"); + break; + case prefix_ds: + ADD_STRING ("ds"); + break; + case prefix_es: + ADD_STRING ("es"); + break; + case prefix_fs: + ADD_STRING ("fs"); + break; + case prefix_gs: + ADD_STRING ("gs"); + break; + case prefix_ss: + ADD_STRING ("ss"); + break; + case prefix_data16: + ADD_STRING ("data16"); + break; + case prefix_addr16: + ADD_STRING ("addr16"); + break; + case prefix_lock: + ADD_STRING ("lock"); + break; +#ifdef X86_64 + case 0x40 ... 0x4f: + ADD_STRING ("rex"); + if (byte != 0x40) + { + ADD_CHAR ('.'); + if (byte & 0x8) + ADD_CHAR ('w'); + if (byte & 0x4) + ADD_CHAR ('r'); + if (byte & 0x3) + ADD_CHAR ('x'); + if (byte & 0x1) + ADD_CHAR ('b'); + } + break; +#endif + default: + /* Cannot happen. */ + puts ("unknown prefix"); + abort (); + } + data = begin + 1; + ++addr; + + goto out; + } + + /* We have a match. First determine how many bytes are + needed for the adressing mode. */ + param_start = codep; + if (instrtab[cnt].modrm) + { + uint_fast8_t modrm = codep[-1]; + +#ifndef X86_64 + if (likely ((prefixes & has_addr16) != 0)) + { + /* Account for displacement. */ + if ((modrm & 0xc7) == 6 || (modrm & 0xc0) == 0x80) + param_start += 2; + else if ((modrm & 0xc0) == 0x40) + param_start += 1; + } + else +#endif + { + /* Account for SIB. */ + if ((modrm & 0xc0) != 0xc0 && (modrm & 0x7) == 0x4) + param_start += 1; + + /* Account for displacement. */ + if ((modrm & 0xc7) == 5 || (modrm & 0xc0) == 0x80 + || ((modrm & 0xc7) == 0x4 && (codep[0] & 0x7) == 0x5)) + param_start += 4; + else if ((modrm & 0xc0) == 0x40) + param_start += 1; + } + + if (unlikely (param_start > end)) + goto not; + } + + output_data.addr = addr + (data - begin); + output_data.data = data; + + unsigned long string_end_idx = 0; + fmt = save_fmt; + while (*fmt != '\0') + { + if (*fmt != '%') + { + char ch = *fmt++; + if (ch == '\\') + { + switch ((ch = *fmt++)) + { + case '0' ... '7': + { + int val = ch - '0'; + ch = *fmt; + if (ch >= '0' && ch <= '7') + { + val *= 8; + val += ch - '0'; + ch = *++fmt; + if (ch >= '0' && ch <= '7' && val < 32) + { + val *= 8; + val += ch - '0'; + ++fmt; + } + } + ch = val; + } + break; + + case 'n': + ch = '\n'; + break; + + case 't': + ch = '\t'; + break; + + default: + retval = EINVAL; + goto do_ret; + } + } + ADD_CHAR (ch); + continue; + } + ++fmt; + + int width = 0; + while (isdigit (*fmt)) + width = width * 10 + (*fmt++ - '0'); + + int prec = 0; + if (*fmt == '.') + while (isdigit (*++fmt)) + prec = prec * 10 + (*fmt - '0'); + + size_t start_idx = bufcnt; + switch (*fmt++) + { + char mnebuf[16]; + const char *str; + + case 'm': + /* Mnemonic. */ + + if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID)) + { + switch (*data) + { +#ifdef X86_64 + case 0x90: + if (prefixes & has_rex_b) + goto not; + str = "nop"; + break; +#endif + + case 0x98: +#ifdef X86_64 + if (prefixes == (has_rex_w | has_rex)) + { + str = "cltq"; + break; + } +#endif + if (prefixes & ~has_data16) + goto print_prefix; + str = prefixes & has_data16 ? "cbtw" : "cwtl"; + break; + + case 0x99: +#ifdef X86_64 + if (prefixes == (has_rex_w | has_rex)) + { + str = "cqto"; + break; + } +#endif + if (prefixes & ~has_data16) + goto print_prefix; + str = prefixes & has_data16 ? "cwtd" : "cltd"; + break; + + case 0xe3: + if (prefixes & ~has_addr16) + goto print_prefix; +#ifdef X86_64 + str = prefixes & has_addr16 ? "jecxz" : "jrcxz"; +#else + str = prefixes & has_addr16 ? "jcxz" : "jecxz"; +#endif + break; + + case 0x0f: + if (data[1] == 0x0f) + { + /* AMD 3DNOW. We need one more byte. */ + if (param_start >= end) + goto not; + if (*param_start < AMD3DNOW_LOW_IDX + || *param_start > AMD3DNOW_HIGH_IDX) + goto not; + unsigned int idx + = amd3dnow[AMD3DNOW_IDX (*param_start)]; + if (idx == 0) + goto not; + str = amd3dnowstr + idx - 1; + /* Eat the immediate byte indicating the + operation. */ + ++param_start; + break; + } +#ifdef X86_64 + if (data[1] == 0xc7) + { + str = ((prefixes & has_rex_w) + ? "cmpxchg16b" : "cmpxchg8b"); + break; + } +#endif + if (data[1] == 0xc2) + { + if (param_start >= end) + goto not; + if (*param_start > 7) + goto not; + static const char cmpops[][9] = + { + [0] = "cmpeq", + [1] = "cmplt", + [2] = "cmple", + [3] = "cmpunord", + [4] = "cmpneq", + [5] = "cmpnlt", + [6] = "cmpnle", + [7] = "cmpord" + }; + char *cp = stpcpy (mnebuf, cmpops[*param_start]); + if (correct_prefix & (has_rep | has_repne)) + *cp++ = 's'; + else + *cp++ = 'p'; + if (correct_prefix & (has_data16 | has_repne)) + *cp++ = 'd'; + else + *cp++ = 's'; + *cp = '\0'; + str = mnebuf; + /* Eat the immediate byte indicating the + operation. */ + ++param_start; + break; + } + + default: + assert (! "INVALID not handled"); + } + } + else + str = mnestr.str + mneidx[instrtab[cnt].mnemonic]; + + ADD_STRING (str); + + switch (instrtab[cnt].suffix) + { + case suffix_none: + break; + + case suffix_w: + if ((codep[-1] & 0xc0) != 0xc0) + { + char ch; + + if (data[0] & 1) + { + if (prefixes & has_data16) + ch = 'w'; +#ifdef X86_64 + else if (prefixes & has_rex_w) + ch = 'q'; +#endif + else + ch = 'l'; + } + else + ch = 'b'; + + ADD_CHAR (ch); + } + break; + + case suffix_w0: + if ((codep[-1] & 0xc0) != 0xc0) + ADD_CHAR ('l'); + break; + + case suffix_w1: + if ((data[0] & 0x4) == 0) + ADD_CHAR ('l'); + break; + + case suffix_W: + if (prefixes & has_data16) + { + ADD_CHAR ('w'); + prefixes &= ~has_data16; + } +#ifdef X86_64 + else + ADD_CHAR ('q'); +#endif + break; + + case suffix_W1: + if (prefixes & has_data16) + { + ADD_CHAR ('w'); + prefixes &= ~has_data16; + } +#ifdef X86_64 + else if (prefixes & has_rex_w) + ADD_CHAR ('q'); +#endif + break; + + case suffix_tttn:; + static const char tttn[16][3] = + { + "o", "no", "b", "ae", "e", "ne", "be", "a", + "s", "ns", "p", "np", "l", "ge", "le", "g" + }; + ADD_STRING (tttn[codep[-1 - instrtab[cnt].modrm] & 0x0f]); + break; + + case suffix_D: + if ((codep[-1] & 0xc0) != 0xc0) + ADD_CHAR ((data[0] & 0x04) == 0 ? 's' : 'l'); + break; + + default: + printf("unknown suffix %d\n", instrtab[cnt].suffix); + abort (); + } + + string_end_idx = bufcnt; + break; + + case 'o': + if (prec == 1 && instrtab[cnt].fct1 != 0) + { + /* First parameter. */ + if (instrtab[cnt].str1 != 0) + ADD_STRING (op1_str + + op1_str_idx[instrtab[cnt].str1 - 1]); + + output_data.opoff1 = (instrtab[cnt].off1_1 + + OFF1_1_BIAS - opoff); + output_data.opoff2 = (instrtab[cnt].off1_2 + + OFF1_2_BIAS - opoff); + output_data.opoff3 = (instrtab[cnt].off1_3 + + OFF1_3_BIAS - opoff); + int r = op1_fct[instrtab[cnt].fct1] (&output_data); + if (r < 0) + goto not; + if (r > 0) + goto enomem; + + string_end_idx = bufcnt; + } + else if (prec == 2 && instrtab[cnt].fct2 != 0) + { + /* Second parameter. */ + if (instrtab[cnt].str2 != 0) + ADD_STRING (op2_str + + op2_str_idx[instrtab[cnt].str2 - 1]); + + output_data.opoff1 = (instrtab[cnt].off2_1 + + OFF2_1_BIAS - opoff); + output_data.opoff2 = (instrtab[cnt].off2_2 + + OFF2_2_BIAS - opoff); + output_data.opoff3 = (instrtab[cnt].off2_3 + + OFF2_3_BIAS - opoff); + int r = op2_fct[instrtab[cnt].fct2] (&output_data); + if (r < 0) + goto not; + if (r > 0) + goto enomem; + + string_end_idx = bufcnt; + } + else if (prec == 3 && instrtab[cnt].fct3 != 0) + { + /* Third parameter. */ + if (instrtab[cnt].str3 != 0) + ADD_STRING (op3_str + + op3_str_idx[instrtab[cnt].str3 - 1]); + + output_data.opoff1 = (instrtab[cnt].off3_1 + + OFF3_1_BIAS - opoff); + output_data.opoff2 = (instrtab[cnt].off3_2 + + OFF3_2_BIAS - opoff); +#ifdef OFF3_3_BITS + output_data.opoff3 = (instrtab[cnt].off3_3 + + OFF3_3_BIAS - opoff); +#else + output_data.opoff3 = 0; +#endif + int r = op3_fct[instrtab[cnt].fct3] (&output_data); + if (r < 0) + goto not; + if (r > 0) + goto enomem; + + string_end_idx = bufcnt; + } + else + bufcnt = string_end_idx; + break; + + case 'e': + string_end_idx = bufcnt; + break; + + case 'a': + /* Pad to requested column. */ + while (bufcnt < (size_t) width) + ADD_CHAR (' '); + width = 0; + break; + + case 'l': + if (output_data.labelbuf != NULL + && output_data.labelbuf[0] != '\0') + { + ADD_STRING (output_data.labelbuf); + output_data.labelbuf[0] = '\0'; + string_end_idx = bufcnt; + } + else if (output_data.symaddr_use != addr_none) + { + GElf_Addr symaddr = output_data.symaddr; + if (output_data.symaddr_use >= addr_rel_symbolic) + symaddr += addr + param_start - begin; + + // XXX Lookup symbol based on symaddr + const char *symstr = NULL; + if (symcb != NULL + && symcb (0 /* XXX */, 0 /* XXX */, symaddr, + &output_data.labelbuf, + &output_data.labelbufsize, symcbarg) == 0) + symstr = output_data.labelbuf; + + size_t bufavail = bufsize - bufcnt; + int r = 0; + if (symstr != NULL) + r = snprintf (&buf[bufcnt], bufavail, "# <%s>", + symstr); + else if (output_data.symaddr_use == addr_abs_always + || output_data.symaddr_use == addr_rel_always) + r = snprintf (&buf[bufcnt], bufavail, "# %#" PRIx64, + (uint64_t) symaddr); + + if (r < 0) + goto not; + if ((size_t) r >= bufavail) + goto enomem; + bufcnt += r; + string_end_idx = bufcnt; + + output_data.symaddr_use = addr_none; + } + break; + } + + /* Pad according to the specified width. */ + while (bufcnt + prefix_size < start_idx + width) + ADD_CHAR (' '); + prefix_size = 0; + } + + if ((prefixes & SEGMENT_PREFIXES) != 0) + goto print_prefix; + + assert (string_end_idx != ~0ul); + bufcnt = string_end_idx; + + addr += param_start - begin; + data = param_start; + + goto out; + } + + /* Invalid (or at least unhandled) opcode. */ + if (prefixes != 0) + goto print_prefix; + assert (*startp == data); + ++data; + ADD_STRING ("(bad)"); + addr += data - begin; + + out: + if (bufcnt == bufsize) + goto enomem; + buf[bufcnt] = '\0'; + + *startp = data; + retval = outcb (buf, bufcnt, outcbarg); + if (retval != 0) + goto do_ret; + } + + do_ret: + free (output_data.labelbuf); + if (buf != initbuf) + free (buf); + + return retval; +} diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c new file mode 100644 index 00000000..a8570f19 --- /dev/null +++ b/libcpu/i386_gendis.c @@ -0,0 +1,69 @@ +/* Generate tables for x86 disassembler. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <error.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +extern int i386_parse (void); + + +extern FILE *i386_in; +extern int i386_debug; +char *infname; + +FILE *outfile; + +int +main (int argc, char *argv[argc]) +{ + outfile = stdout; + + if (argc == 1) + error (EXIT_FAILURE, 0, "usage: %s <MNEDEFFILE>", argv[0]); + + //i386_debug = 1; + infname = argv[1]; + if (strcmp (infname, "-") == 0) + i386_in = stdin; + else + { + i386_in = fopen (infname, "r"); + if (i386_in == NULL) + error (EXIT_FAILURE, errno, "cannot open %s", argv[1]); + } + + i386_parse (); + + return error_message_count != 0; +} diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c new file mode 100644 index 00000000..6bd4a0de --- /dev/null +++ b/libcpu/i386_lex.c @@ -0,0 +1,2011 @@ + +#line 3 "i386_lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer i386__create_buffer +#define yy_delete_buffer i386__delete_buffer +#define yy_flex_debug i386__flex_debug +#define yy_init_buffer i386__init_buffer +#define yy_flush_buffer i386__flush_buffer +#define yy_load_buffer_state i386__load_buffer_state +#define yy_switch_to_buffer i386__switch_to_buffer +#define yyin i386_in +#define yyleng i386_leng +#define yylex i386_lex +#define yylineno i386_lineno +#define yyout i386_out +#define yyrestart i386_restart +#define yytext i386_text +#define yywrap i386_wrap +#define yyalloc i386_alloc +#define yyrealloc i386_realloc +#define yyfree i386_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE i386_restart(i386_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int i386_leng; + +extern FILE *i386_in, *i386_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE i386_lex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-i386_lineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < i386_leng; ++yyl )\ + if ( i386_text[yyl] == '\n' )\ + --i386_lineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up i386_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up i386_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via i386_restart()), so that the user can continue scanning by + * just pointing i386_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when i386_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int i386_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow i386_wrap()'s to do buffer switches + * instead of setting up a fresh i386_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void i386_restart (FILE *input_file ); +void i386__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE i386__create_buffer (FILE *file,int size ); +void i386__delete_buffer (YY_BUFFER_STATE b ); +void i386__flush_buffer (YY_BUFFER_STATE b ); +void i386_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void i386_pop_buffer_state (void ); + +static void i386_ensure_buffer_stack (void ); +static void i386__load_buffer_state (void ); +static void i386__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER i386__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE i386__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE i386__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE i386__scan_bytes (yyconst char *bytes,int len ); + +void *i386_alloc (yy_size_t ); +void *i386_realloc (void *,yy_size_t ); +void i386_free (void * ); + +#define yy_new_buffer i386__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + i386_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + i386__create_buffer(i386_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + i386_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + i386__create_buffer(i386_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define i386_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *i386_in = (FILE *) 0, *i386_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int i386_lineno; + +int i386_lineno = 1; + +extern char *i386_text; +#define yytext_ptr i386_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up i386_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + i386_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 21 +#define YY_END_OF_BUFFER 22 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[62] = + { 0, + 0, 0, 0, 0, 22, 20, 17, 15, 20, 5, + 20, 14, 16, 19, 18, 15, 12, 7, 8, 13, + 11, 11, 19, 14, 16, 17, 6, 0, 0, 0, + 5, 0, 9, 18, 11, 11, 0, 0, 0, 0, + 11, 0, 0, 0, 0, 11, 1, 0, 0, 0, + 11, 0, 0, 0, 11, 2, 3, 0, 10, 4, + 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 4, 1, 5, 1, 1, 1, + 1, 1, 1, 6, 1, 1, 7, 8, 9, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, + 1, 1, 1, 1, 12, 13, 13, 14, 13, 13, + 13, 13, 15, 13, 13, 16, 13, 17, 13, 13, + 13, 13, 13, 13, 13, 18, 13, 13, 13, 13, + 1, 1, 1, 1, 13, 1, 19, 13, 13, 13, + + 20, 21, 13, 13, 22, 13, 23, 13, 24, 25, + 26, 27, 13, 28, 29, 13, 30, 13, 13, 31, + 32, 13, 33, 1, 34, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[35] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 3 + } ; + +static yyconst flex_int16_t yy_base[65] = + { 0, + 0, 32, 65, 3, 113, 114, 9, 11, 19, 7, + 78, 16, 114, 114, 18, 20, 114, 114, 114, 114, + 0, 94, 76, 23, 114, 25, 114, 90, 80, 0, + 41, 73, 114, 36, 0, 88, 76, 44, 42, 37, + 49, 37, 38, 37, 31, 40, 114, 33, 32, 28, + 37, 16, 14, 12, 17, 114, 114, 5, 0, 114, + 114, 99, 101, 2 + } ; + +static yyconst flex_int16_t yy_def[65] = + { 0, + 62, 62, 61, 3, 61, 61, 61, 61, 61, 61, + 63, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 64, 64, 63, 61, 61, 61, 61, 61, 61, 61, + 61, 63, 61, 61, 64, 64, 61, 61, 61, 61, + 64, 61, 61, 61, 61, 64, 61, 61, 61, 61, + 64, 61, 61, 61, 64, 61, 61, 61, 64, 61, + 0, 61, 61, 61 + } ; + +static yyconst flex_int16_t yy_nxt[149] = + { 0, + 61, 7, 8, 35, 9, 24, 25, 10, 10, 10, + 26, 26, 26, 26, 31, 31, 31, 26, 26, 34, + 34, 34, 34, 27, 34, 34, 26, 26, 60, 39, + 59, 40, 11, 7, 12, 13, 9, 34, 34, 10, + 10, 10, 28, 58, 57, 29, 56, 30, 31, 31, + 31, 55, 54, 53, 52, 51, 50, 49, 48, 47, + 46, 45, 44, 43, 11, 14, 15, 16, 14, 14, + 17, 14, 18, 19, 14, 20, 21, 21, 21, 22, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 23, 14, 6, + + 6, 6, 32, 32, 42, 41, 33, 38, 37, 33, + 36, 33, 61, 5, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61 + } ; + +static yyconst flex_int16_t yy_chk[149] = + { 0, + 0, 1, 1, 64, 1, 4, 4, 1, 1, 1, + 7, 7, 8, 8, 10, 10, 10, 12, 12, 15, + 15, 16, 16, 9, 24, 24, 26, 26, 58, 30, + 55, 30, 1, 2, 2, 2, 2, 34, 34, 2, + 2, 2, 9, 54, 53, 9, 52, 9, 31, 31, + 31, 51, 50, 49, 48, 46, 45, 44, 43, 42, + 41, 40, 39, 38, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 62, + + 62, 62, 63, 63, 37, 36, 32, 29, 28, 23, + 22, 11, 5, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[22] = + { 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, + 0, 0, }; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int i386__flex_debug; +int i386__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *i386_text; +#line 1 "i386_lex.l" +#line 2 "i386_lex.l" +/* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <ctype.h> +#include <error.h> +#include <libintl.h> + +#include <system.h> +#include "i386_parse.h" + + +static void eat_to_eol (void); +static void invalid_char (int ch); + +#line 581 "i386_lex.c" + +#define INITIAL 0 +#define MAIN 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int i386_lex_destroy (void ); + +int i386_get_debug (void ); + +void i386_set_debug (int debug_flag ); + +YY_EXTRA_TYPE i386_get_extra (void ); + +void i386_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *i386_get_in (void ); + +void i386_set_in (FILE * in_str ); + +FILE *i386_get_out (void ); + +void i386_set_out (FILE * out_str ); + +int i386_get_leng (void ); + +char *i386_get_text (void ); + +int i386_get_lineno (void ); + +void i386_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int i386_wrap (void ); +#else +extern int i386_wrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( i386_text, i386_leng, 1, i386_out ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + unsigned n; \ + for ( n = 0; n < max_size && \ + (c = getc( i386_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( i386_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, i386_in))==0 && ferror(i386_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(i386_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int i386_lex (void); + +#define YY_DECL int i386_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after i386_text and i386_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( i386_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (i386_text[i386_leng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 54 "i386_lex.l" + + +#line 770 "i386_lex.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! i386_in ) + i386_in = stdin; + + if ( ! i386_out ) + i386_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + i386_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + i386__create_buffer(i386_in,YY_BUF_SIZE ); + } + + i386__load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of i386_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 62 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 61 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < i386_leng; ++yyl ) + if ( i386_text[yyl] == '\n' ) + + i386_lineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 56 "i386_lex.l" +{ return kMASK; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 58 "i386_lex.l" +{ return kPREFIX; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 59 "i386_lex.l" +{ return kSUFFIX; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 61 "i386_lex.l" +{ return kSYNONYM; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 63 "i386_lex.l" +{ i386_lval.num = strtoul (i386_text, NULL, 10); + return kNUMBER; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 66 "i386_lex.l" +{ BEGIN (MAIN); return kPERCPERC; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 69 "i386_lex.l" +{ return '0'; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 70 "i386_lex.l" +{ return '1'; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 72 "i386_lex.l" +{ i386_lval.str = xstrndup (i386_text + 1, + i386_leng - 2); + return kBITFIELD; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 76 "i386_lex.l" +{ i386_lval.str = (void *) -1l; + return kID; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 79 "i386_lex.l" +{ i386_lval.str = xstrndup (i386_text, i386_leng); + return kID; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 82 "i386_lex.l" +{ return ','; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 84 "i386_lex.l" +{ return ':'; } + YY_BREAK +case 14: +/* rule 14 can match eol */ +YY_RULE_SETUP +#line 86 "i386_lex.l" +{ /* IGNORE */ } + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 88 "i386_lex.l" +{ return '\n'; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 90 "i386_lex.l" +{ eat_to_eol (); } + YY_BREAK +case 17: +/* rule 17 can match eol */ +YY_RULE_SETUP +#line 92 "i386_lex.l" +{ /* IGNORE */ } + YY_BREAK +case 18: +/* rule 18 can match eol */ +YY_RULE_SETUP +#line 94 "i386_lex.l" +{ return kSPACE; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 96 "i386_lex.l" +{ i386_lval.ch = *i386_text; return kCHAR; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 98 "i386_lex.l" +{ invalid_char (*i386_text); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 101 "i386_lex.l" +ECHO; + YY_BREAK +#line 974 "i386_lex.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(MAIN): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed i386_in at a new source and called + * i386_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = i386_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( i386_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * i386_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of i386_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + i386_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + i386_restart(i386_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) i386_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 62 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 62 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 61); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up i386_text */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --i386_lineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + i386_restart(i386_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( i386_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve i386_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + i386_lineno++; +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void i386_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + i386_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + i386__create_buffer(i386_in,YY_BUF_SIZE ); + } + + i386__init_buffer(YY_CURRENT_BUFFER,input_file ); + i386__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void i386__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * i386_pop_buffer_state(); + * i386_push_buffer_state(new_buffer); + */ + i386_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + i386__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (i386_wrap()) processing, but the only time this flag + * is looked at is after i386_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void i386__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + i386_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE i386__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) i386_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in i386__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) i386_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in i386__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + i386__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with i386__create_buffer() + * + */ + void i386__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + i386_free((void *) b->yy_ch_buf ); + + i386_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a i386_restart() or at EOF. + */ + static void i386__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + i386__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then i386__init_buffer was _probably_ + * called from i386_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void i386__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + i386__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void i386_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + i386_ensure_buffer_stack(); + + /* This block is copied from i386__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from i386__switch_to_buffer. */ + i386__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void i386_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + i386__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + i386__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void i386_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)i386_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in i386_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)i386_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in i386_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE i386__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) i386_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in i386__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + i386__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to i386_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * i386__scan_bytes() instead. + */ +YY_BUFFER_STATE i386__scan_string (yyconst char * yystr ) +{ + + return i386__scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to i386_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE i386__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) i386_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in i386__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = i386__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in i386__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up i386_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + i386_text[i386_leng] = (yy_hold_char); \ + (yy_c_buf_p) = i386_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + i386_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int i386_get_lineno (void) +{ + + return i386_lineno; +} + +/** Get the input stream. + * + */ +FILE *i386_get_in (void) +{ + return i386_in; +} + +/** Get the output stream. + * + */ +FILE *i386_get_out (void) +{ + return i386_out; +} + +/** Get the length of the current token. + * + */ +int i386_get_leng (void) +{ + return i386_leng; +} + +/** Get the current token. + * + */ + +char *i386_get_text (void) +{ + return i386_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void i386_set_lineno (int line_number ) +{ + + i386_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see i386__switch_to_buffer + */ +void i386_set_in (FILE * in_str ) +{ + i386_in = in_str ; +} + +void i386_set_out (FILE * out_str ) +{ + i386_out = out_str ; +} + +int i386_get_debug (void) +{ + return i386__flex_debug; +} + +void i386_set_debug (int bdebug ) +{ + i386__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from i386_lex_destroy(), so don't allocate here. + */ + + /* We do not touch i386_lineno unless the option is enabled. */ + i386_lineno = 1; + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + i386_in = stdin; + i386_out = stdout; +#else + i386_in = (FILE *) 0; + i386_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * i386_lex_init() + */ + return 0; +} + +/* i386_lex_destroy is for both reentrant and non-reentrant scanners. */ +int i386_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + i386__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + i386_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + i386_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * i386_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *i386_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *i386_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void i386_free (void * ptr ) +{ + free( (char *) ptr ); /* see i386_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 101 "i386_lex.l" + + + +static void +eat_to_eol (void) +{ + while (1) + { + int c = input (); + + if (c == EOF || c == '\n') + break; + } +} + +static void +invalid_char (int ch) +{ + error (0, 0, (isascii (ch) + ? gettext ("invalid character '%c' at line %d; ignored") + : gettext ("invalid character '\\%o' at line %d; ignored")), + ch, i386_lineno); +} + +// Local Variables: +// mode: C +// End: + diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l new file mode 100644 index 00000000..828c5589 --- /dev/null +++ b/libcpu/i386_lex.l @@ -0,0 +1,126 @@ +%{ +/* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <ctype.h> +#include <error.h> +#include <libintl.h> + +#include <system.h> +#include "i386_parse.h" + + +static void eat_to_eol (void); +static void invalid_char (int ch); +%} + +ID [a-zA-Z_][a-zA-Z0-9_/]* +ID2 [a-zA-Z0-9_:/]* +NUMBER [0-9]+ +WHITE [[:space:]]+ + +%option yylineno +%option never-interactive +%option noyywrap + + +%x MAIN + +%% + +"%mask" { return kMASK; } + +"%prefix" { return kPREFIX; } +"%suffix" { return kSUFFIX; } + +"%synonym" { return kSYNONYM; } + +{NUMBER} { i386_lval.num = strtoul (yytext, NULL, 10); + return kNUMBER; } + +"%%" { BEGIN (MAIN); return kPERCPERC; } + + +<MAIN>"0" { return '0'; } +<MAIN>"1" { return '1'; } + +<INITIAL,MAIN>"{"{ID2}"}" { i386_lval.str = xstrndup (yytext + 1, + yyleng - 2); + return kBITFIELD; } + +<MAIN>"INVALID" { i386_lval.str = (void *) -1l; + return kID; } + +<MAIN>{ID} { i386_lval.str = xstrndup (yytext, yyleng); + return kID; } + +<MAIN>"," { return ','; } + +<MAIN>":" { return ':'; } + +<INITIAL,MAIN>^"\n" { /* IGNORE */ } + +<INITIAL,MAIN>"\n" { return '\n'; } + +<INITIAL,MAIN>^"#" { eat_to_eol (); } + +{WHITE} { /* IGNORE */ } + +<MAIN>{WHITE} { return kSPACE; } + +<MAIN>. { i386_lval.ch = *yytext; return kCHAR; } + +. { invalid_char (*yytext); } + + +%% + +static void +eat_to_eol (void) +{ + while (1) + { + int c = input (); + + if (c == EOF || c == '\n') + break; + } +} + +static void +invalid_char (int ch) +{ + error (0, 0, (isascii (ch) + ? gettext ("invalid character '%c' at line %d; ignored") + : gettext ("invalid character '\\%o' at line %d; ignored")), + ch, yylineno); +} + +// Local Variables: +// mode: C +// End: diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c new file mode 100644 index 00000000..01df9ba4 --- /dev/null +++ b/libcpu/i386_parse.c @@ -0,0 +1,3270 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* Substitute the variable and function names. */ +#define yyparse i386_parse +#define yylex i386_lex +#define yyerror i386_error +#define yylval i386_lval +#define yychar i386_char +#define yydebug i386_debug +#define yynerrs i386_nerrs + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + kMASK = 258, + kPREFIX = 259, + kSUFFIX = 260, + kSYNONYM = 261, + kID = 262, + kNUMBER = 263, + kPERCPERC = 264, + kBITFIELD = 265, + kCHAR = 266, + kSPACE = 267 + }; +#endif +/* Tokens. */ +#define kMASK 258 +#define kPREFIX 259 +#define kSUFFIX 260 +#define kSYNONYM 261 +#define kID 262 +#define kNUMBER 263 +#define kPERCPERC 264 +#define kBITFIELD 265 +#define kCHAR 266 +#define kSPACE 267 + + + + +/* Copy the first part of user declarations. */ +#line 1 "i386_parse.y" + +/* Parser for i386 CPU description. + Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <error.h> +#include <inttypes.h> +#include <libintl.h> +#include <math.h> +#include <obstack.h> +#include <search.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/param.h> + +#include <system.h> + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +/* The error handler. */ +static void yyerror (const char *s); + +extern int yylex (void); +extern int i386_lineno; +extern char *infname; + + +struct known_bitfield +{ + char *name; + unsigned long int bits; + int tmp; +}; + + +struct bitvalue +{ + enum bittype { zeroone, field, failure } type; + union + { + unsigned int value; + struct known_bitfield *field; + }; + struct bitvalue *next; +}; + + +struct argname +{ + enum nametype { string, nfield } type; + union + { + char *str; + struct known_bitfield *field; + }; + struct argname *next; +}; + + +struct argument +{ + struct argname *name; + struct argument *next; +}; + + +struct instruction +{ + /* The byte encoding. */ + struct bitvalue *bytes; + + /* Prefix possible. */ + int repe; + int rep; + + /* Mnemonic. */ + char *mnemonic; + + /* Suffix. */ + enum { suffix_none = 0, suffix_w, suffix_w0, suffix_W, suffix_tttn, + suffix_w1, suffix_W1, suffix_D } suffix; + + /* Flag set if modr/m is used. */ + int modrm; + + /* Operands. */ + struct operand + { + char *fct; + char *str; + int off1; + int off2; + int off3; + } operands[3]; + + struct instruction *next; +}; + + +struct synonym +{ + char *from; + char *to; +}; + + +struct suffix +{ + char *name; + int idx; +}; + + +struct argstring +{ + char *str; + int idx; + int off; +}; + + +static struct known_bitfield ax_reg = + { + .name = "ax", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield dx_reg = + { + .name = "dx", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield di_reg = + { + .name = "es_di", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield si_reg = + { + .name = "ds_si", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield bx_reg = + { + .name = "ds_bx", .bits = 0, .tmp = 0 + }; + + +static int bitfield_compare (const void *p1, const void *p2); +static void new_bitfield (char *name, unsigned long int num); +static void check_bits (struct bitvalue *value); +static int check_duplicates (struct bitvalue *val); +static int check_argsdef (struct bitvalue *bitval, struct argument *args); +static int check_bitsused (struct bitvalue *bitval, + struct known_bitfield *suffix, + struct argument *args); +static struct argname *combine (struct argname *name); +static void fillin_arg (struct bitvalue *bytes, struct argname *name, + struct instruction *instr, int n); +static void find_numbers (void); +static int compare_syn (const void *p1, const void *p2); +static int compare_suf (const void *p1, const void *p2); +static void instrtable_out (void); +#if 0 +static void create_mnemonic_table (void); +#endif + +static void *bitfields; +static struct instruction *instructions; +static size_t ninstructions; +static void *synonyms; +static void *suffixes; +static int nsuffixes; +static void *mnemonics; +size_t nmnemonics; +extern FILE *outfile; + +/* Number of bits used mnemonics. */ +#if 0 +static size_t best_mnemonic_bits; +#endif + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 213 "i386_parse.y" +{ + unsigned long int num; + char *str; + char ch; + struct known_bitfield *field; + struct bitvalue *bit; + struct argname *name; + struct argument *arg; +} +/* Line 187 of yacc.c. */ +#line 350 "i386_parse.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 216 of yacc.c. */ +#line 363 "i386_parse.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee 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 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 12 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 37 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 18 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 14 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 32 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 49 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 267 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 15, 2, 2, 2, 16, 17, + 2, 2, 2, 2, 2, 2, 2, 2, 14, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 8, 12, 14, 18, 21, 24, 28, + 29, 33, 35, 42, 43, 45, 46, 50, 52, 55, + 57, 59, 61, 63, 66, 67, 71, 73, 76, 78, + 80, 82, 84 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 19, 0, -1, 20, 9, 13, 22, -1, 20, 13, + 21, -1, 21, -1, 3, 10, 8, -1, 4, 10, + -1, 5, 10, -1, 6, 10, 10, -1, -1, 22, + 13, 23, -1, 23, -1, 25, 14, 24, 7, 24, + 28, -1, -1, 10, -1, -1, 25, 15, 26, -1, + 26, -1, 26, 27, -1, 27, -1, 16, -1, 17, + -1, 10, -1, 12, 29, -1, -1, 29, 15, 30, + -1, 30, -1, 30, 31, -1, 31, -1, 10, -1, + 11, -1, 7, -1, 14, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 243, 243, 253, 254, 257, 259, 261, 263, 275, + 278, 279, 282, 365, 368, 384, 387, 397, 404, 412, + 416, 423, 430, 452, 455, 458, 468, 476, 484, 487, + 519, 528, 535 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "kMASK", "kPREFIX", "kSUFFIX", + "kSYNONYM", "kID", "kNUMBER", "kPERCPERC", "kBITFIELD", "kCHAR", + "kSPACE", "'\\n'", "':'", "','", "'0'", "'1'", "$accept", "spec", + "masks", "mask", "instrs", "instr", "bitfieldopt", "bytes", "byte", + "bit", "optargs", "args", "arg", "argcomp", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 10, 58, 44, 48, 49 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 18, 19, 20, 20, 21, 21, 21, 21, 21, + 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, + 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, + 31, 31, 31 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 4, 3, 1, 3, 2, 2, 3, 0, + 3, 1, 6, 0, 1, 0, 3, 1, 2, 1, + 1, 1, 1, 2, 0, 3, 1, 2, 1, 1, + 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 9, 0, 0, 0, 0, 0, 0, 4, 0, 6, + 7, 0, 1, 0, 9, 5, 8, 13, 3, 22, + 20, 21, 2, 11, 0, 17, 19, 13, 15, 0, + 18, 10, 14, 0, 16, 15, 24, 0, 12, 31, + 29, 30, 32, 23, 26, 28, 0, 27, 25 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 5, 6, 7, 22, 23, 33, 24, 25, 26, + 38, 43, 44, 45 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -35 +static const yytype_int8 yypact[] = +{ + 12, 9, 10, 11, 13, 22, -2, -35, 16, -35, + -35, 15, -35, 14, 12, -35, -35, -4, -35, -35, + -35, -35, 17, -35, -12, -4, -35, -4, 18, -4, + -35, -35, -35, 19, -4, 18, 20, -6, -35, -35, + -35, -35, -35, 21, -6, -35, -6, -35, -6 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -35, -35, -35, 23, -35, 2, -1, -35, 4, -25, + -35, -35, -15, -34 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 30, 39, 28, 29, 40, 41, 19, 13, 42, 30, + 47, 14, 20, 21, 47, 1, 2, 3, 4, 8, + 9, 10, 12, 11, 15, 16, 35, 17, 32, 31, + 27, 48, 37, 34, 36, 0, 46, 18 +}; + +static const yytype_int8 yycheck[] = +{ + 25, 7, 14, 15, 10, 11, 10, 9, 14, 34, + 44, 13, 16, 17, 48, 3, 4, 5, 6, 10, + 10, 10, 0, 10, 8, 10, 7, 13, 10, 27, + 13, 46, 12, 29, 35, -1, 15, 14 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 19, 20, 21, 10, 10, + 10, 10, 0, 9, 13, 8, 10, 13, 21, 10, + 16, 17, 22, 23, 25, 26, 27, 13, 14, 15, + 27, 23, 10, 24, 26, 7, 24, 12, 28, 7, + 10, 11, 14, 29, 30, 31, 15, 31, 30 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 244 "i386_parse.y" + { + if (error_message_count != 0) + error (EXIT_FAILURE, 0, + "terminated due to previous error"); + + instrtable_out (); + } + break; + + case 5: +#line 258 "i386_parse.y" + { new_bitfield ((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].num)); } + break; + + case 6: +#line 260 "i386_parse.y" + { new_bitfield ((yyvsp[(2) - (2)].str), -1); } + break; + + case 7: +#line 262 "i386_parse.y" + { new_bitfield ((yyvsp[(2) - (2)].str), -2); } + break; + + case 8: +#line 264 "i386_parse.y" + { + struct synonym *newp = xmalloc (sizeof (*newp)); + newp->from = (yyvsp[(2) - (3)].str); + newp->to = (yyvsp[(3) - (3)].str); + if (tfind (newp, &synonyms, compare_syn) != NULL) + error (0, 0, + "%d: duplicate definition for synonym '%s'", + i386_lineno, (yyvsp[(2) - (3)].str)); + else if (tsearch ( newp, &synonyms, compare_syn) == NULL) + error (EXIT_FAILURE, 0, "tsearch"); + } + break; + + case 12: +#line 283 "i386_parse.y" + { + if ((yyvsp[(3) - (6)].field) != NULL && strcmp ((yyvsp[(3) - (6)].field)->name, "RE") != 0 + && strcmp ((yyvsp[(3) - (6)].field)->name, "R") != 0) + { + error (0, 0, "%d: only 'R' and 'RE' prefix allowed", + i386_lineno - 1); + } + if (check_duplicates ((yyvsp[(1) - (6)].bit)) == 0 + && check_argsdef ((yyvsp[(1) - (6)].bit), (yyvsp[(6) - (6)].arg)) == 0 + && check_bitsused ((yyvsp[(1) - (6)].bit), (yyvsp[(5) - (6)].field), (yyvsp[(6) - (6)].arg)) == 0) + { + struct instruction *newp = xcalloc (sizeof (*newp), + 1); + if ((yyvsp[(3) - (6)].field) != NULL) + { + if (strcmp ((yyvsp[(3) - (6)].field)->name, "RE") == 0) + newp->repe = 1; + else if (strcmp ((yyvsp[(3) - (6)].field)->name, "R") == 0) + newp->rep = 1; + } + + newp->bytes = (yyvsp[(1) - (6)].bit); + newp->mnemonic = (yyvsp[(4) - (6)].str); + if (newp->mnemonic != (void *) -1l + && tfind ((yyvsp[(4) - (6)].str), &mnemonics, + (comparison_fn_t) strcmp) == NULL) + { + if (tsearch ((yyvsp[(4) - (6)].str), &mnemonics, + (comparison_fn_t) strcmp) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nmnemonics; + } + + if ((yyvsp[(5) - (6)].field) != NULL) + { + if (strcmp ((yyvsp[(5) - (6)].field)->name, "w") == 0) + newp->suffix = suffix_w; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "w0") == 0) + newp->suffix = suffix_w0; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "tttn") == 0) + newp->suffix = suffix_tttn; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "w1") == 0) + newp->suffix = suffix_w1; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "W") == 0) + newp->suffix = suffix_W; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "W1") == 0) + newp->suffix = suffix_W1; + else if (strcmp ((yyvsp[(5) - (6)].field)->name, "D") == 0) + newp->suffix = suffix_D; + else + error (EXIT_FAILURE, 0, + "%s: %d: unknown suffix '%s'", + infname, i386_lineno - 1, (yyvsp[(5) - (6)].field)->name); + + struct suffix search = { .name = (yyvsp[(5) - (6)].field)->name }; + if (tfind (&search, &suffixes, compare_suf) + == NULL) + { + struct suffix *ns = xmalloc (sizeof (*ns)); + ns->name = (yyvsp[(5) - (6)].field)->name; + ns->idx = ++nsuffixes; + if (tsearch (ns, &suffixes, compare_suf) + == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + } + } + + struct argument *args = (yyvsp[(6) - (6)].arg); + int n = 0; + while (args != NULL) + { + fillin_arg ((yyvsp[(1) - (6)].bit), args->name, newp, n); + + args = args->next; + ++n; + } + + newp->next = instructions; + instructions = newp; + ++ninstructions; + } + } + break; + + case 14: +#line 369 "i386_parse.y" + { + struct known_bitfield search; + search.name = (yyvsp[(1) - (1)].str); + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + (yyval.field) = NULL; + } + else + (yyval.field) = *res; + } + break; + + case 15: +#line 384 "i386_parse.y" + { (yyval.field) = NULL; } + break; + + case 16: +#line 388 "i386_parse.y" + { + check_bits ((yyvsp[(3) - (3)].bit)); + + struct bitvalue *runp = (yyvsp[(1) - (3)].bit); + while (runp->next != NULL) + runp = runp->next; + runp->next = (yyvsp[(3) - (3)].bit); + (yyval.bit) = (yyvsp[(1) - (3)].bit); + } + break; + + case 17: +#line 398 "i386_parse.y" + { + check_bits ((yyvsp[(1) - (1)].bit)); + (yyval.bit) = (yyvsp[(1) - (1)].bit); + } + break; + + case 18: +#line 405 "i386_parse.y" + { + struct bitvalue *runp = (yyvsp[(1) - (2)].bit); + while (runp->next != NULL) + runp = runp->next; + runp->next = (yyvsp[(2) - (2)].bit); + (yyval.bit) = (yyvsp[(1) - (2)].bit); + } + break; + + case 19: +#line 413 "i386_parse.y" + { (yyval.bit) = (yyvsp[(1) - (1)].bit); } + break; + + case 20: +#line 417 "i386_parse.y" + { + (yyval.bit) = xmalloc (sizeof (struct bitvalue)); + (yyval.bit)->type = zeroone; + (yyval.bit)->value = 0; + (yyval.bit)->next = NULL; + } + break; + + case 21: +#line 424 "i386_parse.y" + { + (yyval.bit) = xmalloc (sizeof (struct bitvalue)); + (yyval.bit)->type = zeroone; + (yyval.bit)->value = 1; + (yyval.bit)->next = NULL; + } + break; + + case 22: +#line 431 "i386_parse.y" + { + (yyval.bit) = xmalloc (sizeof (struct bitvalue)); + struct known_bitfield search; + search.name = (yyvsp[(1) - (1)].str); + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + (yyval.bit)->type = failure; + } + else + { + (yyval.bit)->type = field; + (yyval.bit)->field = *res; + } + (yyval.bit)->next = NULL; + } + break; + + case 23: +#line 453 "i386_parse.y" + { (yyval.arg) = (yyvsp[(2) - (2)].arg); } + break; + + case 24: +#line 455 "i386_parse.y" + { (yyval.arg) = NULL; } + break; + + case 25: +#line 459 "i386_parse.y" + { + struct argument *runp = (yyvsp[(1) - (3)].arg); + while (runp->next != NULL) + runp = runp->next; + runp->next = xmalloc (sizeof (struct argument)); + runp->next->name = combine ((yyvsp[(3) - (3)].name)); + runp->next->next = NULL; + (yyval.arg) = (yyvsp[(1) - (3)].arg); + } + break; + + case 26: +#line 469 "i386_parse.y" + { + (yyval.arg) = xmalloc (sizeof (struct argument)); + (yyval.arg)->name = combine ((yyvsp[(1) - (1)].name)); + (yyval.arg)->next = NULL; + } + break; + + case 27: +#line 477 "i386_parse.y" + { + struct argname *runp = (yyvsp[(1) - (2)].name); + while (runp->next != NULL) + runp = runp->next; + runp->next = (yyvsp[(2) - (2)].name); + (yyval.name) = (yyvsp[(1) - (2)].name); + } + break; + + case 28: +#line 485 "i386_parse.y" + { (yyval.name) = (yyvsp[(1) - (1)].name); } + break; + + case 29: +#line 488 "i386_parse.y" + { + (yyval.name) = xmalloc (sizeof (struct argname)); + (yyval.name)->type = nfield; + (yyval.name)->next = NULL; + + struct known_bitfield search; + search.name = (yyvsp[(1) - (1)].str); + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + if (strcmp ((yyvsp[(1) - (1)].str), "ax") == 0) + (yyval.name)->field = &ax_reg; + else if (strcmp ((yyvsp[(1) - (1)].str), "dx") == 0) + (yyval.name)->field = &dx_reg; + else if (strcmp ((yyvsp[(1) - (1)].str), "es_di") == 0) + (yyval.name)->field = &di_reg; + else if (strcmp ((yyvsp[(1) - (1)].str), "ds_si") == 0) + (yyval.name)->field = &si_reg; + else if (strcmp ((yyvsp[(1) - (1)].str), "ds_bx") == 0) + (yyval.name)->field = &bx_reg; + else + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + (yyval.name)->field = NULL; + } + } + else + (yyval.name)->field = *res; + } + break; + + case 30: +#line 520 "i386_parse.y" + { + (yyval.name) = xmalloc (sizeof (struct argname)); + (yyval.name)->type = string; + (yyval.name)->next = NULL; + (yyval.name)->str = xmalloc (2); + (yyval.name)->str[0] = (yyvsp[(1) - (1)].ch); + (yyval.name)->str[1] = '\0'; + } + break; + + case 31: +#line 529 "i386_parse.y" + { + (yyval.name) = xmalloc (sizeof (struct argname)); + (yyval.name)->type = string; + (yyval.name)->next = NULL; + (yyval.name)->str = (yyvsp[(1) - (1)].str); + } + break; + + case 32: +#line 536 "i386_parse.y" + { + (yyval.name) = xmalloc (sizeof (struct argname)); + (yyval.name)->type = string; + (yyval.name)->next = NULL; + (yyval.name)->str = xmalloc (2); + (yyval.name)->str[0] = ':'; + (yyval.name)->str[1] = '\0'; + } + break; + + +/* Line 1267 of yacc.c. */ +#line 1934 "i386_parse.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + +#line 546 "i386_parse.y" + + +static void +yyerror (const char *s) +{ + error (0, 0, gettext ("while reading i386 CPU description: %s at line %d"), + gettext (s), i386_lineno); +} + + +static int +bitfield_compare (const void *p1, const void *p2) +{ + struct known_bitfield *f1 = (struct known_bitfield *) p1; + struct known_bitfield *f2 = (struct known_bitfield *) p2; + + return strcmp (f1->name, f2->name); +} + + +static void +new_bitfield (char *name, unsigned long int num) +{ + struct known_bitfield *newp = xmalloc (sizeof (struct known_bitfield)); + newp->name = name; + newp->bits = num; + newp->tmp = 0; + + if (tfind (newp, &bitfields, bitfield_compare) != NULL) + { + error (0, 0, "%d: duplicated definition of bitfield '%s'", + i386_lineno, name); + free (name); + return; + } + + if (tsearch (newp, &bitfields, bitfield_compare) == NULL) + error (EXIT_FAILURE, errno, "%d: cannot insert new bitfield '%s'", + i386_lineno, name); +} + + +/* Check that the number of bits is a multiple of 8. */ +static void +check_bits (struct bitvalue *val) +{ + struct bitvalue *runp = val; + unsigned int total = 0; + + while (runp != NULL) + { + if (runp->type == zeroone) + ++total; + else if (runp->field == NULL) + /* No sense doing anything, the field is not known. */ + return; + else + total += runp->field->bits; + + runp = runp->next; + } + + if (total % 8 != 0) + { + struct obstack os; + obstack_init (&os); + + while (val != NULL) + { + if (val->type == zeroone) + obstack_printf (&os, "%u", val->value); + else + obstack_printf (&os, "{%s}", val->field->name); + val = val->next; + } + obstack_1grow (&os, '\0'); + + error (0, 0, "%d: field '%s' not a multiple of 8 bits in size", + i386_lineno, (char *) obstack_finish (&os)); + + obstack_free (&os, NULL); + } +} + + +static int +check_duplicates (struct bitvalue *val) +{ + static int testcnt; + ++testcnt; + + int result = 0; + while (val != NULL) + { + if (val->type == field && val->field != NULL) + { + if (val->field->tmp == testcnt) + { + error (0, 0, "%d: bitfield '%s' used more than once", + i386_lineno - 1, val->field->name); + result = 1; + } + val->field->tmp = testcnt; + } + + val = val->next; + } + + return result; +} + + +static int +check_argsdef (struct bitvalue *bitval, struct argument *args) +{ + int result = 0; + + while (args != NULL) + { + for (struct argname *name = args->name; name != NULL; name = name->next) + if (name->type == nfield && name->field != NULL + && name->field != &ax_reg && name->field != &dx_reg + && name->field != &di_reg && name->field != &si_reg + && name->field != &bx_reg) + { + struct bitvalue *runp = bitval; + + while (runp != NULL) + if (runp->type == field && runp->field == name->field) + break; + else + runp = runp->next; + + if (runp == NULL) + { + error (0, 0, "%d: unknown bitfield '%s' used in output format", + i386_lineno - 1, name->field->name); + result = 1; + } + } + + args = args->next; + } + + return result; +} + + +static int +check_bitsused (struct bitvalue *bitval, struct known_bitfield *suffix, + struct argument *args) +{ + int result = 0; + + while (bitval != NULL) + { + if (bitval->type == field && bitval->field != NULL + && bitval->field != suffix + /* {w} is handled special. */ + && strcmp (bitval->field->name, "w") != 0) + { + struct argument *runp; + for (runp = args; runp != NULL; runp = runp->next) + { + struct argname *name = runp->name; + + while (name != NULL) + if (name->type == nfield && name->field == bitval->field) + break; + else + name = name->next; + + if (name != NULL) + break; + } + +#if 0 + if (runp == NULL) + { + error (0, 0, "%d: bitfield '%s' not used", + i386_lineno - 1, bitval->field->name); + result = 1; + } +#endif + } + + bitval = bitval->next; + } + + return result; +} + + +static struct argname * +combine (struct argname *name) +{ + struct argname *last_str = NULL; + for (struct argname *runp = name; runp != NULL; runp = runp->next) + { + if (runp->type == string) + { + if (last_str == NULL) + last_str = runp; + else + { + last_str->str = xrealloc (last_str->str, + strlen (last_str->str) + + strlen (runp->str) + 1); + strcat (last_str->str, runp->str); + last_str->next = runp->next; + } + } + else + last_str = NULL; + } + return name; +} + + +#define obstack_grow_str(ob, str) obstack_grow (ob, str, strlen (str)) + + +static void +fillin_arg (struct bitvalue *bytes, struct argname *name, + struct instruction *instr, int n) +{ + static struct obstack ob; + static int initialized; + if (! initialized) + { + initialized = 1; + obstack_init (&ob); + } + + struct argname *runp = name; + int cnt = 0; + while (runp != NULL) + { + /* We ignore strings in the function name. */ + if (runp->type == string) + { + if (instr->operands[n].str != NULL) + error (EXIT_FAILURE, 0, + "%d: cannot have more than one string parameter", + i386_lineno - 1); + + instr->operands[n].str = runp->str; + } + else + { + assert (runp->type == nfield); + + /* Construct the function name. */ + if (cnt++ > 0) + obstack_1grow (&ob, '$'); + + if (runp->field == NULL) + /* Add some string which contains invalid characters. */ + obstack_grow_str (&ob, "!!!INVALID!!!"); + else + { + char *fieldname = runp->field->name; + + struct synonym search = { .from = fieldname }; + + struct synonym **res = tfind (&search, &synonyms, compare_syn); + if (res != NULL) + fieldname = (*res)->to; + + obstack_grow_str (&ob, fieldname); + } + + /* Now compute the bit offset of the field. */ + struct bitvalue *b = bytes; + int bitoff = 0; + if (runp->field != NULL) + while (b != NULL) + { + if (b->type == field && b->field != NULL) + { + if (strcmp (b->field->name, runp->field->name) == 0) + break; + bitoff += b->field->bits; + } + else + ++bitoff; + + b = b->next; + } + if (instr->operands[n].off1 == 0) + instr->operands[n].off1 = bitoff; + else if (instr->operands[n].off2 == 0) + instr->operands[n].off2 = bitoff; + else if (instr->operands[n].off3 == 0) + instr->operands[n].off3 = bitoff; + else + error (EXIT_FAILURE, 0, + "%d: cannot have more than three fields in parameter", + i386_lineno - 1); + + if (runp->field != NULL + && strncasecmp (runp->field->name, "mod", 3) == 0) + instr->modrm = 1; + } + + runp = runp->next; + } + if (obstack_object_size (&ob) == 0) + obstack_grow_str (&ob, "string"); + obstack_1grow (&ob, '\0'); + char *fct = obstack_finish (&ob); + + instr->operands[n].fct = fct; +} + + +#if 0 +static void +nameout (const void *nodep, VISIT value, int level) +{ + if (value == leaf || value == postorder) + printf (" %s\n", *(const char **) nodep); +} +#endif + + +static int +compare_argstring (const void *p1, const void *p2) +{ + const struct argstring *a1 = (const struct argstring *) p1; + const struct argstring *a2 = (const struct argstring *) p2; + + return strcmp (a1->str, a2->str); +} + + +static int maxoff[3][3]; +static int minoff[3][3] = { { 1000, 1000, 1000 }, + { 1000, 1000, 1000 }, + { 1000, 1000, 1000 } }; +static int nbitoff[3][3]; +static void *fct_names[3]; +static int nbitfct[3]; +static int nbitsuf; +static void *strs[3]; +static int nbitstr[3]; +static int total_bits = 2; // Already counted the rep/repe bits. + +static void +find_numbers (void) +{ + int nfct_names[3] = { 0, 0, 0 }; + int nstrs[3] = { 0, 0, 0 }; + + /* We reverse the order of the instruction list while processing it. + Later phases need it in the order in which the input file has + them. */ + struct instruction *reversed = NULL; + + struct instruction *runp = instructions; + while (runp != NULL) + { + for (int i = 0; i < 3; ++i) + if (runp->operands[i].fct != NULL) + { + struct argstring search = { .str = runp->operands[i].fct }; + if (tfind (&search, &fct_names[i], compare_argstring) == NULL) + { + struct argstring *newp = xmalloc (sizeof (*newp)); + newp->str = runp->operands[i].fct; + newp->idx = 0; + if (tsearch (newp, &fct_names[i], compare_argstring) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nfct_names[i]; + } + + if (runp->operands[i].str != NULL) + { + search.str = runp->operands[i].str; + if (tfind (&search, &strs[i], compare_argstring) == NULL) + { + struct argstring *newp = xmalloc (sizeof (*newp)); + newp->str = runp->operands[i].str; + newp->idx = 0; + if (tsearch (newp, &strs[i], compare_argstring) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nstrs[i]; + } + } + + maxoff[i][0] = MAX (maxoff[i][0], runp->operands[i].off1); + maxoff[i][1] = MAX (maxoff[i][1], runp->operands[i].off2); + maxoff[i][2] = MAX (maxoff[i][2], runp->operands[i].off3); + + if (runp->operands[i].off1 > 0) + minoff[i][0] = MIN (minoff[i][0], runp->operands[i].off1); + if (runp->operands[i].off2 > 0) + minoff[i][1] = MIN (minoff[i][1], runp->operands[i].off2); + if (runp->operands[i].off3 > 0) + minoff[i][2] = MIN (minoff[i][2], runp->operands[i].off3); + } + + struct instruction *old = runp; + runp = runp->next; + + old->next = reversed; + reversed = old; + } + instructions = reversed; + + int d; + int c; + for (int i = 0; i < 3; ++i) + { + // printf ("min1 = %d, min2 = %d, min3 = %d\n", minoff[i][0], minoff[i][1], minoff[i][2]); + // printf ("max1 = %d, max2 = %d, max3 = %d\n", maxoff[i][0], maxoff[i][1], maxoff[i][2]); + + if (minoff[i][0] == 1000) + nbitoff[i][0] = 0; + else + { + nbitoff[i][0] = 1; + d = maxoff[i][0] - minoff[i][0]; + c = 1; + while (c < d) + { + ++nbitoff[i][0]; + c *= 2; + } + total_bits += nbitoff[i][0]; + } + + if (minoff[i][1] == 1000) + nbitoff[i][1] = 0; + else + { + nbitoff[i][1] = 1; + d = maxoff[i][1] - minoff[i][1]; + c = 1; + while (c < d) + { + ++nbitoff[i][1]; + c *= 2; + } + total_bits += nbitoff[i][1]; + } + + if (minoff[i][2] == 1000) + nbitoff[i][2] = 0; + else + { + nbitoff[i][2] = 1; + d = maxoff[i][2] - minoff[i][2]; + c = 1; + while (c < d) + { + ++nbitoff[i][2]; + c *= 2; + } + total_bits += nbitoff[i][2]; + } + // printf ("off1 = %d, off2 = %d, off3 = %d\n", nbitoff[i][0], nbitoff[i][1], nbitoff[i][2]); + + nbitfct[i] = 1; + d = nfct_names[i]; + c = 1; + while (c < d) + { + ++nbitfct[i]; + c *= 2; + } + total_bits += nbitfct[i]; + // printf ("%d fct[%d], %d bits\n", nfct_names[i], i, nbitfct[i]); + + if (nstrs[i] != 0) + { + nbitstr[i] = 1; + d = nstrs[i]; + c = 1; + while (c < d) + { + ++nbitstr[i]; + c *= 2; + } + total_bits += nbitstr[i]; + } + + // twalk (fct_names[i], nameout); + } + + nbitsuf = 0; + d = nsuffixes; + c = 1; + while (c < d) + { + ++nbitsuf; + c *= 2; + } + total_bits += nbitsuf; + // printf ("%d suffixes, %d bits\n", nsuffixes, nbitsuf); +} + + +static int +compare_syn (const void *p1, const void *p2) +{ + const struct synonym *s1 = (const struct synonym *) p1; + const struct synonym *s2 = (const struct synonym *) p2; + + return strcmp (s1->from, s2->from); +} + + +static int +compare_suf (const void *p1, const void *p2) +{ + const struct suffix *s1 = (const struct suffix *) p1; + const struct suffix *s2 = (const struct suffix *) p2; + + return strcmp (s1->name, s2->name); +} + + +static int count_op_str; +static int off_op_str; +static void +print_op_str (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + { + const char *str = (*(struct argstring **) nodep)->str; + fprintf (outfile, "%s\n \"%s", + count_op_str == 0 ? "" : "\\0\"", str); + (*(struct argstring **) nodep)->idx = ++count_op_str; + (*(struct argstring **) nodep)->off = off_op_str; + off_op_str += strlen (str) + 1; + } +} + + +static void +print_op_str_idx (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + printf (" %d,\n", (*(struct argstring **) nodep)->off); +} + + +static void +print_op_fct (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + { + fprintf (outfile, " FCT_%s,\n", (*(struct argstring **) nodep)->str); + (*(struct argstring **) nodep)->idx = ++count_op_str; + } +} + + +#if NMNES < 2 +# error "bogus NMNES value" +#endif + +static void +instrtable_out (void) +{ + find_numbers (); + +#if 0 + create_mnemonic_table (); + + fprintf (outfile, "#define MNEMONIC_BITS %zu\n", best_mnemonic_bits); +#else + fprintf (outfile, "#define MNEMONIC_BITS %ld\n", + lrint (ceil (log2 (NMNES)))); +#endif + fprintf (outfile, "#define SUFFIX_BITS %d\n", nbitsuf); + for (int i = 0; i < 3; ++i) + { + fprintf (outfile, "#define FCT%d_BITS %d\n", i + 1, nbitfct[i]); + if (nbitstr[i] != 0) + fprintf (outfile, "#define STR%d_BITS %d\n", i + 1, nbitstr[i]); + fprintf (outfile, "#define OFF%d_1_BITS %d\n", i + 1, nbitoff[i][0]); + fprintf (outfile, "#define OFF%d_1_BIAS %d\n", i + 1, minoff[i][0]); + if (nbitoff[i][1] != 0) + { + fprintf (outfile, "#define OFF%d_2_BITS %d\n", i + 1, nbitoff[i][1]); + fprintf (outfile, "#define OFF%d_2_BIAS %d\n", i + 1, minoff[i][1]); + } + if (nbitoff[i][2] != 0) + { + fprintf (outfile, "#define OFF%d_3_BITS %d\n", i + 1, nbitoff[i][2]); + fprintf (outfile, "#define OFF%d_3_BIAS %d\n", i + 1, minoff[i][2]); + } + } + + fputs ("\n#include <i386_data.h>\n\n", outfile); + + +#define APPEND(a, b) APPEND_ (a, b) +#define APPEND_(a, b) a##b +#define EMIT_SUFFIX(suf) \ + fprintf (outfile, "#define suffix_%s %d\n", #suf, APPEND (suffix_, suf)) + EMIT_SUFFIX (none); + EMIT_SUFFIX (w); + EMIT_SUFFIX (w0); + EMIT_SUFFIX (W); + EMIT_SUFFIX (tttn); + EMIT_SUFFIX (D); + EMIT_SUFFIX (w1); + EMIT_SUFFIX (W1); + + fputc_unlocked ('\n', outfile); + + for (int i = 0; i < 3; ++i) + { + /* Functions. */ + count_op_str = 0; + fprintf (outfile, "static const opfct_t op%d_fct[] =\n{\n NULL,\n", + i + 1); + twalk (fct_names[i], print_op_fct); + fputs ("};\n", outfile); + + /* The operand strings. */ + if (nbitstr[i] != 0) + { + count_op_str = 0; + off_op_str = 0; + fprintf (outfile, "static const char op%d_str[] =", i + 1); + twalk (strs[i], print_op_str); + fputs ("\";\n", outfile); + + fprintf (outfile, "static const uint8_t op%d_str_idx[] = {\n", + i + 1); + twalk (strs[i], print_op_str_idx); + fputs ("};\n", outfile); + } + } + + + fputs ("static const struct instr_enc instrtab[] =\n{\n", outfile); + struct instruction *instr; + for (instr = instructions; instr != NULL; instr = instr->next) + { + fputs (" {", outfile); + if (instr->mnemonic == (void *) -1l) + fputs (" .mnemonic = MNE_INVALID,", outfile); + else + fprintf (outfile, " .mnemonic = MNE_%s,", instr->mnemonic); + fprintf (outfile, " .rep = %d,", instr->rep); + fprintf (outfile, " .repe = %d,", instr->repe); + fprintf (outfile, " .suffix = %d,", instr->suffix); + fprintf (outfile, " .modrm = %d,", instr->modrm); + + for (int i = 0; i < 3; ++i) + { + int idx = 0; + if (instr->operands[i].fct != NULL) + { + struct argstring search = { .str = instr->operands[i].fct }; + struct argstring **res = tfind (&search, &fct_names[i], + compare_argstring); + assert (res != NULL); + idx = (*res)->idx; + } + fprintf (outfile, " .fct%d = %d,", i + 1, idx); + + idx = 0; + if (instr->operands[i].str != NULL) + { + struct argstring search = { .str = instr->operands[i].str }; + struct argstring **res = tfind (&search, &strs[i], + compare_argstring); + assert (res != NULL); + idx = (*res)->idx; + } + if (nbitstr[i] != 0) + fprintf (outfile, " .str%d = %d,", i + 1, idx); + + fprintf (outfile, " .off%d_1 = %d,", i + 1, + MAX (0, instr->operands[i].off1 - minoff[i][0])); + + if (nbitoff[i][1] != 0) + fprintf (outfile, " .off%d_2 = %d,", i + 1, + MAX (0, instr->operands[i].off2 - minoff[i][1])); + + if (nbitoff[i][2] != 0) + fprintf (outfile, " .off%d_3 = %d,", i + 1, + MAX (0, instr->operands[i].off3 - minoff[i][2])); + } + + fputs (" },\n", outfile); + } + fputs ("};\n", outfile); + + fputs ("static const uint8_t match_data[] =\n{\n", outfile); + size_t cnt = 0; + for (instr = instructions; instr != NULL; instr = instr->next, ++cnt) + { + /* First count the number of bytes. */ + size_t totalbits = 0; + size_t zerobits = 0; + struct bitvalue *b = instr->bytes; + while (b != NULL) + { + if (b->type == zeroone) + { + ++totalbits; + zerobits = 0; + } + else + { + totalbits += b->field->bits; + /* We must always count the mod/rm byte. */ + if (strncasecmp (b->field->name, "mod", 3) == 0) + zerobits = 0; + else + zerobits += b->field->bits; + } + b = b->next; + } + size_t nbytes = (totalbits - zerobits + 7) / 8; + assert (nbytes > 0); + + fprintf (outfile, " %#zx,", nbytes); + + /* Now create the mask and byte values. */ + uint8_t byte = 0; + uint8_t mask = 0; + int nbits = 0; + b = instr->bytes; + while (b != NULL) + { + if (b->type == zeroone) + { + byte = (byte << 1) | b->value; + mask = (mask << 1) | 1; + if (++nbits == 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + } + else + { + unsigned long int remaining = b->field->bits; + while (nbits + remaining > 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", + mask << (8 - nbits), byte << (8 - nbits)); + remaining = nbits + remaining - 8; + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + byte <<= remaining; + mask <<= remaining; + nbits += remaining; + if (nbits == 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + } + b = b->next; + } + + fputc_unlocked ('\n', outfile); + } + fputs ("};\n", outfile); +} + + +#if 0 +static size_t mnemonic_maxlen; +static size_t mnemonic_minlen; +static size_t +which_chars (const char *str[], size_t nstr) +{ + char used_char[256]; + memset (used_char, '\0', sizeof (used_char)); + mnemonic_maxlen = 0; + mnemonic_minlen = 10000; + for (size_t cnt = 0; cnt < nstr; ++cnt) + { + const unsigned char *cp = (const unsigned char *) str[cnt]; + mnemonic_maxlen = MAX (mnemonic_maxlen, strlen ((char *) cp)); + mnemonic_minlen = MIN (mnemonic_minlen, strlen ((char *) cp)); + do + used_char[*cp++] = 1; + while (*cp != '\0'); + } + size_t nused_char = 0; + for (size_t cnt = 0; cnt < 256; ++cnt) + if (used_char[cnt] != 0) + ++nused_char; + return nused_char; +} + + +static const char **mnemonic_strs; +static size_t nmnemonic_strs; +static void +add_mnemonics (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + mnemonic_strs[nmnemonic_strs++] = *(const char **) nodep; +} + + +struct charfreq +{ + char ch; + int freq; +}; +static struct charfreq pfxfreq[256]; +static struct charfreq sfxfreq[256]; + + +static int +compare_freq (const void *p1, const void *p2) +{ + const struct charfreq *c1 = (const struct charfreq *) p1; + const struct charfreq *c2 = (const struct charfreq *) p2; + + if (c1->freq > c2->freq) + return -1; + if (c1->freq < c2->freq) + return 1; + return 0; +} + + +static size_t +compute_pfxfreq (const char *str[], size_t nstr) +{ + memset (pfxfreq, '\0', sizeof (pfxfreq)); + + for (size_t i = 0; i < nstr; ++i) + pfxfreq[i].ch = i; + + for (size_t i = 0; i < nstr; ++i) + ++pfxfreq[*((const unsigned char *) str[i])].freq; + + qsort (pfxfreq, 256, sizeof (struct charfreq), compare_freq); + + size_t n = 0; + while (n < 256 && pfxfreq[n].freq != 0) + ++n; + return n; +} + + +struct strsnlen +{ + const char *str; + size_t len; +}; + +static size_t +compute_sfxfreq (size_t nstr, struct strsnlen *strsnlen) +{ + memset (sfxfreq, '\0', sizeof (sfxfreq)); + + for (size_t i = 0; i < nstr; ++i) + sfxfreq[i].ch = i; + + for (size_t i = 0; i < nstr; ++i) + ++sfxfreq[((const unsigned char *) strchrnul (strsnlen[i].str, '\0'))[-1]].freq; + + qsort (sfxfreq, 256, sizeof (struct charfreq), compare_freq); + + size_t n = 0; + while (n < 256 && sfxfreq[n].freq != 0) + ++n; + return n; +} + + +static void +create_mnemonic_table (void) +{ + mnemonic_strs = xmalloc (nmnemonics * sizeof (char *)); + + twalk (mnemonics, add_mnemonics); + + (void) which_chars (mnemonic_strs, nmnemonic_strs); + + size_t best_so_far = 100000000; + char *best_prefix = NULL; + char *best_suffix = NULL; + char *best_table = NULL; + size_t best_table_size = 0; + size_t best_table_bits = 0; + size_t best_prefix_bits = 0; + + /* We can precompute the prefix characters. */ + size_t npfx_char = compute_pfxfreq (mnemonic_strs, nmnemonic_strs); + + /* Compute best size for string representation including explicit NUL. */ + for (size_t pfxbits = 0; (1u << pfxbits) < 2 * npfx_char; ++pfxbits) + { + char prefix[1 << pfxbits]; + size_t i; + for (i = 0; i < (1u << pfxbits) - 1; ++i) + prefix[i] = pfxfreq[i].ch; + prefix[i] = '\0'; + + struct strsnlen strsnlen[nmnemonic_strs]; + + for (i = 0; i < nmnemonic_strs; ++i) + { + if (strchr (prefix, *mnemonic_strs[i]) != NULL) + strsnlen[i].str = mnemonic_strs[i] + 1; + else + strsnlen[i].str = mnemonic_strs[i]; + strsnlen[i].len = strlen (strsnlen[i].str); + } + + /* With the prefixes gone, try to combine strings. */ + size_t nstrsnlen = 1; + for (i = 1; i < nmnemonic_strs; ++i) + { + size_t j; + for (j = 0; j < nstrsnlen; ++j) + if (strsnlen[i].len > strsnlen[j].len + && strcmp (strsnlen[j].str, + strsnlen[i].str + (strsnlen[i].len + - strsnlen[j].len)) == 0) + { + strsnlen[j] = strsnlen[i]; + break; + } + else if (strsnlen[i].len < strsnlen[j].len + && strcmp (strsnlen[i].str, + strsnlen[j].str + (strsnlen[j].len + - strsnlen[i].len)) == 0) + break; +; + if (j == nstrsnlen) + strsnlen[nstrsnlen++] = strsnlen[i]; + } + + size_t nsfx_char = compute_sfxfreq (nstrsnlen, strsnlen); + + for (size_t sfxbits = 0; (1u << sfxbits) < 2 * nsfx_char; ++sfxbits) + { + char suffix[1 << sfxbits]; + + for (i = 0; i < (1u << sfxbits) - 1; ++i) + suffix[i] = sfxfreq[i].ch; + suffix[i] = '\0'; + + size_t newlen[nstrsnlen]; + + for (i = 0; i < nstrsnlen; ++i) + if (strchr (suffix, strsnlen[i].str[strsnlen[i].len - 1]) != NULL) + newlen[i] = strsnlen[i].len - 1; + else + newlen[i] = strsnlen[i].len; + + char charused[256]; + memset (charused, '\0', sizeof (charused)); + size_t ncharused = 0; + + const char *tablestr[nstrsnlen]; + size_t ntablestr = 1; + tablestr[0] = strsnlen[0].str; + size_t table = newlen[0] + 1; + for (i = 1; i < nstrsnlen; ++i) + { + size_t j; + for (j = 0; j < ntablestr; ++j) + if (newlen[i] > newlen[j] + && memcmp (tablestr[j], + strsnlen[i].str + (newlen[i] - newlen[j]), + newlen[j]) == 0) + { + table += newlen[i] - newlen[j]; + tablestr[j] = strsnlen[i].str; + newlen[j] = newlen[i]; + break; + } + else if (newlen[i] < newlen[j] + && memcmp (strsnlen[i].str, + tablestr[j] + (newlen[j] - newlen[i]), + newlen[i]) == 0) + break; + + if (j == ntablestr) + { + table += newlen[i] + 1; + tablestr[ntablestr] = strsnlen[i].str; + newlen[ntablestr] = newlen[i]; + + ++ntablestr; + } + + for (size_t x = 0; x < newlen[j]; ++x) + if (charused[((const unsigned char *) tablestr[j])[x]]++ == 0) + ++ncharused; + } + + size_t ncharused_bits = 0; + i = 1; + while (i < ncharused) + { + i *= 2; + ++ncharused_bits; + } + + size_t table_bits = 0; + i = 1; + while (i < table) + { + i *= 2; + ++table_bits; + } + + size_t mnemonic_bits = table_bits + pfxbits + sfxbits; + size_t new_total = (((table + 7) / 8) * ncharused_bits + ncharused + + (pfxbits == 0 ? 0 : (1 << pfxbits) - 1) + + (sfxbits == 0 ? 0 : (1 << sfxbits) - 1) + + (((total_bits + mnemonic_bits + 7) / 8) + * ninstructions)); + + if (new_total < best_so_far) + { + best_so_far = new_total; + best_mnemonic_bits = mnemonic_bits; + + free (best_suffix); + best_suffix = xstrdup (suffix); + + free (best_prefix); + best_prefix = xstrdup (prefix); + best_prefix_bits = pfxbits; + + best_table_size = table; + best_table_bits = table_bits; + char *cp = best_table = xrealloc (best_table, table); + for (i = 0; i < ntablestr; ++i) + { + assert (cp + newlen[i] + 1 <= best_table + table); + cp = mempcpy (cp, tablestr[i], newlen[i]); + *cp++ = '\0'; + } + assert (cp == best_table + table); + } + } + } + + fputs ("static const char mnemonic_table[] =\n\"", outfile); + for (size_t i = 0; i < best_table_size; ++i) + { + if (((i + 1) % 60) == 0) + fputs ("\"\n\"", outfile); + if (!isascii (best_table[i]) || !isprint (best_table[i])) + fprintf (outfile, "\\%03o", best_table[i]); + else + fputc (best_table[i], outfile); + } + fputs ("\";\n", outfile); + + if (best_prefix[0] != '\0') + fprintf (outfile, + "static const char prefix[%zu] = \"%s\";\n" + "#define PREFIXCHAR_BITS %zu\n", + strlen (best_prefix), best_prefix, best_prefix_bits); + else + fputs ("#define NO_PREFIX\n", outfile); + + if (best_suffix[0] != '\0') + fprintf (outfile, "static const char suffix[%zu] = \"%s\";\n", + strlen (best_suffix), best_suffix); + else + fputs ("#define NO_SUFFIX\n", outfile); + + for (size_t i = 0; i < nmnemonic_strs; ++i) + { + const char *mne = mnemonic_strs[i]; + + size_t pfxval = 0; + char *cp = strchr (best_prefix, *mne); + if (cp != NULL) + { + pfxval = 1 + (cp - best_prefix); + ++mne; + } + + size_t l = strlen (mne); + + size_t sfxval = 0; + cp = strchr (best_suffix, mne[l - 1]); + if (cp != NULL) + { + sfxval = 1 + (cp - best_suffix); + --l; + } + + char *off = memmem (best_table, best_table_size, mne, l); + while (off[l] != '\0') + { + off = memmem (off + 1, best_table_size, mne, l); + assert (off != NULL); + } + + fprintf (outfile, "#define MNE_%s %#zx\n", + mnemonic_strs[i], + (off - best_table) + + ((pfxval + (sfxval << best_prefix_bits)) << best_table_bits)); + } +} +#endif + diff --git a/libcpu/i386_parse.h b/libcpu/i386_parse.h new file mode 100644 index 00000000..3a9219fb --- /dev/null +++ b/libcpu/i386_parse.h @@ -0,0 +1,90 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + kMASK = 258, + kPREFIX = 259, + kSUFFIX = 260, + kSYNONYM = 261, + kID = 262, + kNUMBER = 263, + kPERCPERC = 264, + kBITFIELD = 265, + kCHAR = 266, + kSPACE = 267 + }; +#endif +/* Tokens. */ +#define kMASK 258 +#define kPREFIX 259 +#define kSUFFIX 260 +#define kSYNONYM 261 +#define kID 262 +#define kNUMBER 263 +#define kPERCPERC 264 +#define kBITFIELD 265 +#define kCHAR 266 +#define kSPACE 267 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 213 "i386_parse.y" +{ + unsigned long int num; + char *str; + char ch; + struct known_bitfield *field; + struct bitvalue *bit; + struct argname *name; + struct argument *arg; +} +/* Line 1489 of yacc.c. */ +#line 83 "i386_parse.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE i386_lval; + diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y new file mode 100644 index 00000000..b3a684d6 --- /dev/null +++ b/libcpu/i386_parse.y @@ -0,0 +1,1667 @@ +%{ +/* Parser for i386 CPU description. + Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2004. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <error.h> +#include <inttypes.h> +#include <libintl.h> +#include <math.h> +#include <obstack.h> +#include <search.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/param.h> + +#include <system.h> + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +/* The error handler. */ +static void yyerror (const char *s); + +extern int yylex (void); +extern int i386_lineno; +extern char *infname; + + +struct known_bitfield +{ + char *name; + unsigned long int bits; + int tmp; +}; + + +struct bitvalue +{ + enum bittype { zeroone, field, failure } type; + union + { + unsigned int value; + struct known_bitfield *field; + }; + struct bitvalue *next; +}; + + +struct argname +{ + enum nametype { string, nfield } type; + union + { + char *str; + struct known_bitfield *field; + }; + struct argname *next; +}; + + +struct argument +{ + struct argname *name; + struct argument *next; +}; + + +struct instruction +{ + /* The byte encoding. */ + struct bitvalue *bytes; + + /* Prefix possible. */ + int repe; + int rep; + + /* Mnemonic. */ + char *mnemonic; + + /* Suffix. */ + enum { suffix_none = 0, suffix_w, suffix_w0, suffix_W, suffix_tttn, + suffix_w1, suffix_W1, suffix_D } suffix; + + /* Flag set if modr/m is used. */ + int modrm; + + /* Operands. */ + struct operand + { + char *fct; + char *str; + int off1; + int off2; + int off3; + } operands[3]; + + struct instruction *next; +}; + + +struct synonym +{ + char *from; + char *to; +}; + + +struct suffix +{ + char *name; + int idx; +}; + + +struct argstring +{ + char *str; + int idx; + int off; +}; + + +static struct known_bitfield ax_reg = + { + .name = "ax", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield dx_reg = + { + .name = "dx", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield di_reg = + { + .name = "es_di", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield si_reg = + { + .name = "ds_si", .bits = 0, .tmp = 0 + }; + +static struct known_bitfield bx_reg = + { + .name = "ds_bx", .bits = 0, .tmp = 0 + }; + + +static int bitfield_compare (const void *p1, const void *p2); +static void new_bitfield (char *name, unsigned long int num); +static void check_bits (struct bitvalue *value); +static int check_duplicates (struct bitvalue *val); +static int check_argsdef (struct bitvalue *bitval, struct argument *args); +static int check_bitsused (struct bitvalue *bitval, + struct known_bitfield *suffix, + struct argument *args); +static struct argname *combine (struct argname *name); +static void fillin_arg (struct bitvalue *bytes, struct argname *name, + struct instruction *instr, int n); +static void find_numbers (void); +static int compare_syn (const void *p1, const void *p2); +static int compare_suf (const void *p1, const void *p2); +static void instrtable_out (void); +#if 0 +static void create_mnemonic_table (void); +#endif + +static void *bitfields; +static struct instruction *instructions; +static size_t ninstructions; +static void *synonyms; +static void *suffixes; +static int nsuffixes; +static void *mnemonics; +size_t nmnemonics; +extern FILE *outfile; + +/* Number of bits used mnemonics. */ +#if 0 +static size_t best_mnemonic_bits; +#endif +%} + +%union { + unsigned long int num; + char *str; + char ch; + struct known_bitfield *field; + struct bitvalue *bit; + struct argname *name; + struct argument *arg; +} + +%token kMASK +%token kPREFIX +%token kSUFFIX +%token kSYNONYM +%token <str> kID +%token <num> kNUMBER +%token kPERCPERC +%token <str> kBITFIELD +%token <ch> kCHAR +%token kSPACE + +%type <bit> bit byte bytes +%type <field> bitfieldopt +%type <name> argcomp arg +%type <arg> args optargs + +%defines + +%% + +spec: masks kPERCPERC '\n' instrs + { + if (error_message_count != 0) + error (EXIT_FAILURE, 0, + "terminated due to previous error"); + + instrtable_out (); + } + ; + +masks: masks '\n' mask + | mask + ; + +mask: kMASK kBITFIELD kNUMBER + { new_bitfield ($2, $3); } + | kPREFIX kBITFIELD + { new_bitfield ($2, -1); } + | kSUFFIX kBITFIELD + { new_bitfield ($2, -2); } + | kSYNONYM kBITFIELD kBITFIELD + { + struct synonym *newp = xmalloc (sizeof (*newp)); + newp->from = $2; + newp->to = $3; + if (tfind (newp, &synonyms, compare_syn) != NULL) + error (0, 0, + "%d: duplicate definition for synonym '%s'", + i386_lineno, $2); + else if (tsearch ( newp, &synonyms, compare_syn) == NULL) + error (EXIT_FAILURE, 0, "tsearch"); + } + | + ; + +instrs: instrs '\n' instr + | instr + ; + +instr: bytes ':' bitfieldopt kID bitfieldopt optargs + { + if ($3 != NULL && strcmp ($3->name, "RE") != 0 + && strcmp ($3->name, "R") != 0) + { + error (0, 0, "%d: only 'R' and 'RE' prefix allowed", + i386_lineno - 1); + } + if (check_duplicates ($1) == 0 + && check_argsdef ($1, $6) == 0 + && check_bitsused ($1, $5, $6) == 0) + { + struct instruction *newp = xcalloc (sizeof (*newp), + 1); + if ($3 != NULL) + { + if (strcmp ($3->name, "RE") == 0) + newp->repe = 1; + else if (strcmp ($3->name, "R") == 0) + newp->rep = 1; + } + + newp->bytes = $1; + newp->mnemonic = $4; + if (newp->mnemonic != (void *) -1l + && tfind ($4, &mnemonics, + (comparison_fn_t) strcmp) == NULL) + { + if (tsearch ($4, &mnemonics, + (comparison_fn_t) strcmp) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nmnemonics; + } + + if ($5 != NULL) + { + if (strcmp ($5->name, "w") == 0) + newp->suffix = suffix_w; + else if (strcmp ($5->name, "w0") == 0) + newp->suffix = suffix_w0; + else if (strcmp ($5->name, "tttn") == 0) + newp->suffix = suffix_tttn; + else if (strcmp ($5->name, "w1") == 0) + newp->suffix = suffix_w1; + else if (strcmp ($5->name, "W") == 0) + newp->suffix = suffix_W; + else if (strcmp ($5->name, "W1") == 0) + newp->suffix = suffix_W1; + else if (strcmp ($5->name, "D") == 0) + newp->suffix = suffix_D; + else + error (EXIT_FAILURE, 0, + "%s: %d: unknown suffix '%s'", + infname, i386_lineno - 1, $5->name); + + struct suffix search = { .name = $5->name }; + if (tfind (&search, &suffixes, compare_suf) + == NULL) + { + struct suffix *ns = xmalloc (sizeof (*ns)); + ns->name = $5->name; + ns->idx = ++nsuffixes; + if (tsearch (ns, &suffixes, compare_suf) + == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + } + } + + struct argument *args = $6; + int n = 0; + while (args != NULL) + { + fillin_arg ($1, args->name, newp, n); + + args = args->next; + ++n; + } + + newp->next = instructions; + instructions = newp; + ++ninstructions; + } + } + | + ; + +bitfieldopt: kBITFIELD + { + struct known_bitfield search; + search.name = $1; + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + $$ = NULL; + } + else + $$ = *res; + } + | + { $$ = NULL; } + ; + +bytes: bytes ',' byte + { + check_bits ($3); + + struct bitvalue *runp = $1; + while (runp->next != NULL) + runp = runp->next; + runp->next = $3; + $$ = $1; + } + | byte + { + check_bits ($1); + $$ = $1; + } + ; + +byte: byte bit + { + struct bitvalue *runp = $1; + while (runp->next != NULL) + runp = runp->next; + runp->next = $2; + $$ = $1; + } + | bit + { $$ = $1; } + ; + +bit: '0' + { + $$ = xmalloc (sizeof (struct bitvalue)); + $$->type = zeroone; + $$->value = 0; + $$->next = NULL; + } + | '1' + { + $$ = xmalloc (sizeof (struct bitvalue)); + $$->type = zeroone; + $$->value = 1; + $$->next = NULL; + } + | kBITFIELD + { + $$ = xmalloc (sizeof (struct bitvalue)); + struct known_bitfield search; + search.name = $1; + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + $$->type = failure; + } + else + { + $$->type = field; + $$->field = *res; + } + $$->next = NULL; + } + ; + +optargs: kSPACE args + { $$ = $2; } + | + { $$ = NULL; } + ; + +args: args ',' arg + { + struct argument *runp = $1; + while (runp->next != NULL) + runp = runp->next; + runp->next = xmalloc (sizeof (struct argument)); + runp->next->name = combine ($3); + runp->next->next = NULL; + $$ = $1; + } + | arg + { + $$ = xmalloc (sizeof (struct argument)); + $$->name = combine ($1); + $$->next = NULL; + } + ; + +arg: arg argcomp + { + struct argname *runp = $1; + while (runp->next != NULL) + runp = runp->next; + runp->next = $2; + $$ = $1; + } + | argcomp + { $$ = $1; } + ; +argcomp: kBITFIELD + { + $$ = xmalloc (sizeof (struct argname)); + $$->type = nfield; + $$->next = NULL; + + struct known_bitfield search; + search.name = $1; + struct known_bitfield **res; + res = tfind (&search, &bitfields, bitfield_compare); + if (res == NULL) + { + if (strcmp ($1, "ax") == 0) + $$->field = &ax_reg; + else if (strcmp ($1, "dx") == 0) + $$->field = &dx_reg; + else if (strcmp ($1, "es_di") == 0) + $$->field = &di_reg; + else if (strcmp ($1, "ds_si") == 0) + $$->field = &si_reg; + else if (strcmp ($1, "ds_bx") == 0) + $$->field = &bx_reg; + else + { + error (0, 0, "%d: unknown bitfield '%s'", + i386_lineno, search.name); + $$->field = NULL; + } + } + else + $$->field = *res; + } + | kCHAR + { + $$ = xmalloc (sizeof (struct argname)); + $$->type = string; + $$->next = NULL; + $$->str = xmalloc (2); + $$->str[0] = $1; + $$->str[1] = '\0'; + } + | kID + { + $$ = xmalloc (sizeof (struct argname)); + $$->type = string; + $$->next = NULL; + $$->str = $1; + } + | ':' + { + $$ = xmalloc (sizeof (struct argname)); + $$->type = string; + $$->next = NULL; + $$->str = xmalloc (2); + $$->str[0] = ':'; + $$->str[1] = '\0'; + } + ; + +%% + +static void +yyerror (const char *s) +{ + error (0, 0, gettext ("while reading i386 CPU description: %s at line %d"), + gettext (s), i386_lineno); +} + + +static int +bitfield_compare (const void *p1, const void *p2) +{ + struct known_bitfield *f1 = (struct known_bitfield *) p1; + struct known_bitfield *f2 = (struct known_bitfield *) p2; + + return strcmp (f1->name, f2->name); +} + + +static void +new_bitfield (char *name, unsigned long int num) +{ + struct known_bitfield *newp = xmalloc (sizeof (struct known_bitfield)); + newp->name = name; + newp->bits = num; + newp->tmp = 0; + + if (tfind (newp, &bitfields, bitfield_compare) != NULL) + { + error (0, 0, "%d: duplicated definition of bitfield '%s'", + i386_lineno, name); + free (name); + return; + } + + if (tsearch (newp, &bitfields, bitfield_compare) == NULL) + error (EXIT_FAILURE, errno, "%d: cannot insert new bitfield '%s'", + i386_lineno, name); +} + + +/* Check that the number of bits is a multiple of 8. */ +static void +check_bits (struct bitvalue *val) +{ + struct bitvalue *runp = val; + unsigned int total = 0; + + while (runp != NULL) + { + if (runp->type == zeroone) + ++total; + else if (runp->field == NULL) + /* No sense doing anything, the field is not known. */ + return; + else + total += runp->field->bits; + + runp = runp->next; + } + + if (total % 8 != 0) + { + struct obstack os; + obstack_init (&os); + + while (val != NULL) + { + if (val->type == zeroone) + obstack_printf (&os, "%u", val->value); + else + obstack_printf (&os, "{%s}", val->field->name); + val = val->next; + } + obstack_1grow (&os, '\0'); + + error (0, 0, "%d: field '%s' not a multiple of 8 bits in size", + i386_lineno, (char *) obstack_finish (&os)); + + obstack_free (&os, NULL); + } +} + + +static int +check_duplicates (struct bitvalue *val) +{ + static int testcnt; + ++testcnt; + + int result = 0; + while (val != NULL) + { + if (val->type == field && val->field != NULL) + { + if (val->field->tmp == testcnt) + { + error (0, 0, "%d: bitfield '%s' used more than once", + i386_lineno - 1, val->field->name); + result = 1; + } + val->field->tmp = testcnt; + } + + val = val->next; + } + + return result; +} + + +static int +check_argsdef (struct bitvalue *bitval, struct argument *args) +{ + int result = 0; + + while (args != NULL) + { + for (struct argname *name = args->name; name != NULL; name = name->next) + if (name->type == nfield && name->field != NULL + && name->field != &ax_reg && name->field != &dx_reg + && name->field != &di_reg && name->field != &si_reg + && name->field != &bx_reg) + { + struct bitvalue *runp = bitval; + + while (runp != NULL) + if (runp->type == field && runp->field == name->field) + break; + else + runp = runp->next; + + if (runp == NULL) + { + error (0, 0, "%d: unknown bitfield '%s' used in output format", + i386_lineno - 1, name->field->name); + result = 1; + } + } + + args = args->next; + } + + return result; +} + + +static int +check_bitsused (struct bitvalue *bitval, struct known_bitfield *suffix, + struct argument *args) +{ + int result = 0; + + while (bitval != NULL) + { + if (bitval->type == field && bitval->field != NULL + && bitval->field != suffix + /* {w} is handled special. */ + && strcmp (bitval->field->name, "w") != 0) + { + struct argument *runp; + for (runp = args; runp != NULL; runp = runp->next) + { + struct argname *name = runp->name; + + while (name != NULL) + if (name->type == nfield && name->field == bitval->field) + break; + else + name = name->next; + + if (name != NULL) + break; + } + +#if 0 + if (runp == NULL) + { + error (0, 0, "%d: bitfield '%s' not used", + i386_lineno - 1, bitval->field->name); + result = 1; + } +#endif + } + + bitval = bitval->next; + } + + return result; +} + + +static struct argname * +combine (struct argname *name) +{ + struct argname *last_str = NULL; + for (struct argname *runp = name; runp != NULL; runp = runp->next) + { + if (runp->type == string) + { + if (last_str == NULL) + last_str = runp; + else + { + last_str->str = xrealloc (last_str->str, + strlen (last_str->str) + + strlen (runp->str) + 1); + strcat (last_str->str, runp->str); + last_str->next = runp->next; + } + } + else + last_str = NULL; + } + return name; +} + + +#define obstack_grow_str(ob, str) obstack_grow (ob, str, strlen (str)) + + +static void +fillin_arg (struct bitvalue *bytes, struct argname *name, + struct instruction *instr, int n) +{ + static struct obstack ob; + static int initialized; + if (! initialized) + { + initialized = 1; + obstack_init (&ob); + } + + struct argname *runp = name; + int cnt = 0; + while (runp != NULL) + { + /* We ignore strings in the function name. */ + if (runp->type == string) + { + if (instr->operands[n].str != NULL) + error (EXIT_FAILURE, 0, + "%d: cannot have more than one string parameter", + i386_lineno - 1); + + instr->operands[n].str = runp->str; + } + else + { + assert (runp->type == nfield); + + /* Construct the function name. */ + if (cnt++ > 0) + obstack_1grow (&ob, '$'); + + if (runp->field == NULL) + /* Add some string which contains invalid characters. */ + obstack_grow_str (&ob, "!!!INVALID!!!"); + else + { + char *fieldname = runp->field->name; + + struct synonym search = { .from = fieldname }; + + struct synonym **res = tfind (&search, &synonyms, compare_syn); + if (res != NULL) + fieldname = (*res)->to; + + obstack_grow_str (&ob, fieldname); + } + + /* Now compute the bit offset of the field. */ + struct bitvalue *b = bytes; + int bitoff = 0; + if (runp->field != NULL) + while (b != NULL) + { + if (b->type == field && b->field != NULL) + { + if (strcmp (b->field->name, runp->field->name) == 0) + break; + bitoff += b->field->bits; + } + else + ++bitoff; + + b = b->next; + } + if (instr->operands[n].off1 == 0) + instr->operands[n].off1 = bitoff; + else if (instr->operands[n].off2 == 0) + instr->operands[n].off2 = bitoff; + else if (instr->operands[n].off3 == 0) + instr->operands[n].off3 = bitoff; + else + error (EXIT_FAILURE, 0, + "%d: cannot have more than three fields in parameter", + i386_lineno - 1); + + if (runp->field != NULL + && strncasecmp (runp->field->name, "mod", 3) == 0) + instr->modrm = 1; + } + + runp = runp->next; + } + if (obstack_object_size (&ob) == 0) + obstack_grow_str (&ob, "string"); + obstack_1grow (&ob, '\0'); + char *fct = obstack_finish (&ob); + + instr->operands[n].fct = fct; +} + + +#if 0 +static void +nameout (const void *nodep, VISIT value, int level) +{ + if (value == leaf || value == postorder) + printf (" %s\n", *(const char **) nodep); +} +#endif + + +static int +compare_argstring (const void *p1, const void *p2) +{ + const struct argstring *a1 = (const struct argstring *) p1; + const struct argstring *a2 = (const struct argstring *) p2; + + return strcmp (a1->str, a2->str); +} + + +static int maxoff[3][3]; +static int minoff[3][3] = { { 1000, 1000, 1000 }, + { 1000, 1000, 1000 }, + { 1000, 1000, 1000 } }; +static int nbitoff[3][3]; +static void *fct_names[3]; +static int nbitfct[3]; +static int nbitsuf; +static void *strs[3]; +static int nbitstr[3]; +static int total_bits = 2; // Already counted the rep/repe bits. + +static void +find_numbers (void) +{ + int nfct_names[3] = { 0, 0, 0 }; + int nstrs[3] = { 0, 0, 0 }; + + /* We reverse the order of the instruction list while processing it. + Later phases need it in the order in which the input file has + them. */ + struct instruction *reversed = NULL; + + struct instruction *runp = instructions; + while (runp != NULL) + { + for (int i = 0; i < 3; ++i) + if (runp->operands[i].fct != NULL) + { + struct argstring search = { .str = runp->operands[i].fct }; + if (tfind (&search, &fct_names[i], compare_argstring) == NULL) + { + struct argstring *newp = xmalloc (sizeof (*newp)); + newp->str = runp->operands[i].fct; + newp->idx = 0; + if (tsearch (newp, &fct_names[i], compare_argstring) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nfct_names[i]; + } + + if (runp->operands[i].str != NULL) + { + search.str = runp->operands[i].str; + if (tfind (&search, &strs[i], compare_argstring) == NULL) + { + struct argstring *newp = xmalloc (sizeof (*newp)); + newp->str = runp->operands[i].str; + newp->idx = 0; + if (tsearch (newp, &strs[i], compare_argstring) == NULL) + error (EXIT_FAILURE, errno, "tsearch"); + ++nstrs[i]; + } + } + + maxoff[i][0] = MAX (maxoff[i][0], runp->operands[i].off1); + maxoff[i][1] = MAX (maxoff[i][1], runp->operands[i].off2); + maxoff[i][2] = MAX (maxoff[i][2], runp->operands[i].off3); + + if (runp->operands[i].off1 > 0) + minoff[i][0] = MIN (minoff[i][0], runp->operands[i].off1); + if (runp->operands[i].off2 > 0) + minoff[i][1] = MIN (minoff[i][1], runp->operands[i].off2); + if (runp->operands[i].off3 > 0) + minoff[i][2] = MIN (minoff[i][2], runp->operands[i].off3); + } + + struct instruction *old = runp; + runp = runp->next; + + old->next = reversed; + reversed = old; + } + instructions = reversed; + + int d; + int c; + for (int i = 0; i < 3; ++i) + { + // printf ("min1 = %d, min2 = %d, min3 = %d\n", minoff[i][0], minoff[i][1], minoff[i][2]); + // printf ("max1 = %d, max2 = %d, max3 = %d\n", maxoff[i][0], maxoff[i][1], maxoff[i][2]); + + if (minoff[i][0] == 1000) + nbitoff[i][0] = 0; + else + { + nbitoff[i][0] = 1; + d = maxoff[i][0] - minoff[i][0]; + c = 1; + while (c < d) + { + ++nbitoff[i][0]; + c *= 2; + } + total_bits += nbitoff[i][0]; + } + + if (minoff[i][1] == 1000) + nbitoff[i][1] = 0; + else + { + nbitoff[i][1] = 1; + d = maxoff[i][1] - minoff[i][1]; + c = 1; + while (c < d) + { + ++nbitoff[i][1]; + c *= 2; + } + total_bits += nbitoff[i][1]; + } + + if (minoff[i][2] == 1000) + nbitoff[i][2] = 0; + else + { + nbitoff[i][2] = 1; + d = maxoff[i][2] - minoff[i][2]; + c = 1; + while (c < d) + { + ++nbitoff[i][2]; + c *= 2; + } + total_bits += nbitoff[i][2]; + } + // printf ("off1 = %d, off2 = %d, off3 = %d\n", nbitoff[i][0], nbitoff[i][1], nbitoff[i][2]); + + nbitfct[i] = 1; + d = nfct_names[i]; + c = 1; + while (c < d) + { + ++nbitfct[i]; + c *= 2; + } + total_bits += nbitfct[i]; + // printf ("%d fct[%d], %d bits\n", nfct_names[i], i, nbitfct[i]); + + if (nstrs[i] != 0) + { + nbitstr[i] = 1; + d = nstrs[i]; + c = 1; + while (c < d) + { + ++nbitstr[i]; + c *= 2; + } + total_bits += nbitstr[i]; + } + + // twalk (fct_names[i], nameout); + } + + nbitsuf = 0; + d = nsuffixes; + c = 1; + while (c < d) + { + ++nbitsuf; + c *= 2; + } + total_bits += nbitsuf; + // printf ("%d suffixes, %d bits\n", nsuffixes, nbitsuf); +} + + +static int +compare_syn (const void *p1, const void *p2) +{ + const struct synonym *s1 = (const struct synonym *) p1; + const struct synonym *s2 = (const struct synonym *) p2; + + return strcmp (s1->from, s2->from); +} + + +static int +compare_suf (const void *p1, const void *p2) +{ + const struct suffix *s1 = (const struct suffix *) p1; + const struct suffix *s2 = (const struct suffix *) p2; + + return strcmp (s1->name, s2->name); +} + + +static int count_op_str; +static int off_op_str; +static void +print_op_str (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + { + const char *str = (*(struct argstring **) nodep)->str; + fprintf (outfile, "%s\n \"%s", + count_op_str == 0 ? "" : "\\0\"", str); + (*(struct argstring **) nodep)->idx = ++count_op_str; + (*(struct argstring **) nodep)->off = off_op_str; + off_op_str += strlen (str) + 1; + } +} + + +static void +print_op_str_idx (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + printf (" %d,\n", (*(struct argstring **) nodep)->off); +} + + +static void +print_op_fct (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + { + fprintf (outfile, " FCT_%s,\n", (*(struct argstring **) nodep)->str); + (*(struct argstring **) nodep)->idx = ++count_op_str; + } +} + + +#if NMNES < 2 +# error "bogus NMNES value" +#endif + +static void +instrtable_out (void) +{ + find_numbers (); + +#if 0 + create_mnemonic_table (); + + fprintf (outfile, "#define MNEMONIC_BITS %zu\n", best_mnemonic_bits); +#else + fprintf (outfile, "#define MNEMONIC_BITS %ld\n", + lrint (ceil (log2 (NMNES)))); +#endif + fprintf (outfile, "#define SUFFIX_BITS %d\n", nbitsuf); + for (int i = 0; i < 3; ++i) + { + fprintf (outfile, "#define FCT%d_BITS %d\n", i + 1, nbitfct[i]); + if (nbitstr[i] != 0) + fprintf (outfile, "#define STR%d_BITS %d\n", i + 1, nbitstr[i]); + fprintf (outfile, "#define OFF%d_1_BITS %d\n", i + 1, nbitoff[i][0]); + fprintf (outfile, "#define OFF%d_1_BIAS %d\n", i + 1, minoff[i][0]); + if (nbitoff[i][1] != 0) + { + fprintf (outfile, "#define OFF%d_2_BITS %d\n", i + 1, nbitoff[i][1]); + fprintf (outfile, "#define OFF%d_2_BIAS %d\n", i + 1, minoff[i][1]); + } + if (nbitoff[i][2] != 0) + { + fprintf (outfile, "#define OFF%d_3_BITS %d\n", i + 1, nbitoff[i][2]); + fprintf (outfile, "#define OFF%d_3_BIAS %d\n", i + 1, minoff[i][2]); + } + } + + fputs ("\n#include <i386_data.h>\n\n", outfile); + + +#define APPEND(a, b) APPEND_ (a, b) +#define APPEND_(a, b) a##b +#define EMIT_SUFFIX(suf) \ + fprintf (outfile, "#define suffix_%s %d\n", #suf, APPEND (suffix_, suf)) + EMIT_SUFFIX (none); + EMIT_SUFFIX (w); + EMIT_SUFFIX (w0); + EMIT_SUFFIX (W); + EMIT_SUFFIX (tttn); + EMIT_SUFFIX (D); + EMIT_SUFFIX (w1); + EMIT_SUFFIX (W1); + + fputc_unlocked ('\n', outfile); + + for (int i = 0; i < 3; ++i) + { + /* Functions. */ + count_op_str = 0; + fprintf (outfile, "static const opfct_t op%d_fct[] =\n{\n NULL,\n", + i + 1); + twalk (fct_names[i], print_op_fct); + fputs ("};\n", outfile); + + /* The operand strings. */ + if (nbitstr[i] != 0) + { + count_op_str = 0; + off_op_str = 0; + fprintf (outfile, "static const char op%d_str[] =", i + 1); + twalk (strs[i], print_op_str); + fputs ("\";\n", outfile); + + fprintf (outfile, "static const uint8_t op%d_str_idx[] = {\n", + i + 1); + twalk (strs[i], print_op_str_idx); + fputs ("};\n", outfile); + } + } + + + fputs ("static const struct instr_enc instrtab[] =\n{\n", outfile); + struct instruction *instr; + for (instr = instructions; instr != NULL; instr = instr->next) + { + fputs (" {", outfile); + if (instr->mnemonic == (void *) -1l) + fputs (" .mnemonic = MNE_INVALID,", outfile); + else + fprintf (outfile, " .mnemonic = MNE_%s,", instr->mnemonic); + fprintf (outfile, " .rep = %d,", instr->rep); + fprintf (outfile, " .repe = %d,", instr->repe); + fprintf (outfile, " .suffix = %d,", instr->suffix); + fprintf (outfile, " .modrm = %d,", instr->modrm); + + for (int i = 0; i < 3; ++i) + { + int idx = 0; + if (instr->operands[i].fct != NULL) + { + struct argstring search = { .str = instr->operands[i].fct }; + struct argstring **res = tfind (&search, &fct_names[i], + compare_argstring); + assert (res != NULL); + idx = (*res)->idx; + } + fprintf (outfile, " .fct%d = %d,", i + 1, idx); + + idx = 0; + if (instr->operands[i].str != NULL) + { + struct argstring search = { .str = instr->operands[i].str }; + struct argstring **res = tfind (&search, &strs[i], + compare_argstring); + assert (res != NULL); + idx = (*res)->idx; + } + if (nbitstr[i] != 0) + fprintf (outfile, " .str%d = %d,", i + 1, idx); + + fprintf (outfile, " .off%d_1 = %d,", i + 1, + MAX (0, instr->operands[i].off1 - minoff[i][0])); + + if (nbitoff[i][1] != 0) + fprintf (outfile, " .off%d_2 = %d,", i + 1, + MAX (0, instr->operands[i].off2 - minoff[i][1])); + + if (nbitoff[i][2] != 0) + fprintf (outfile, " .off%d_3 = %d,", i + 1, + MAX (0, instr->operands[i].off3 - minoff[i][2])); + } + + fputs (" },\n", outfile); + } + fputs ("};\n", outfile); + + fputs ("static const uint8_t match_data[] =\n{\n", outfile); + size_t cnt = 0; + for (instr = instructions; instr != NULL; instr = instr->next, ++cnt) + { + /* First count the number of bytes. */ + size_t totalbits = 0; + size_t zerobits = 0; + struct bitvalue *b = instr->bytes; + while (b != NULL) + { + if (b->type == zeroone) + { + ++totalbits; + zerobits = 0; + } + else + { + totalbits += b->field->bits; + /* We must always count the mod/rm byte. */ + if (strncasecmp (b->field->name, "mod", 3) == 0) + zerobits = 0; + else + zerobits += b->field->bits; + } + b = b->next; + } + size_t nbytes = (totalbits - zerobits + 7) / 8; + assert (nbytes > 0); + + fprintf (outfile, " %#zx,", nbytes); + + /* Now create the mask and byte values. */ + uint8_t byte = 0; + uint8_t mask = 0; + int nbits = 0; + b = instr->bytes; + while (b != NULL) + { + if (b->type == zeroone) + { + byte = (byte << 1) | b->value; + mask = (mask << 1) | 1; + if (++nbits == 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + } + else + { + unsigned long int remaining = b->field->bits; + while (nbits + remaining > 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", + mask << (8 - nbits), byte << (8 - nbits)); + remaining = nbits + remaining - 8; + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + byte <<= remaining; + mask <<= remaining; + nbits += remaining; + if (nbits == 8) + { + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + byte = mask = nbits = 0; + if (--nbytes == 0) + break; + } + } + b = b->next; + } + + fputc_unlocked ('\n', outfile); + } + fputs ("};\n", outfile); +} + + +#if 0 +static size_t mnemonic_maxlen; +static size_t mnemonic_minlen; +static size_t +which_chars (const char *str[], size_t nstr) +{ + char used_char[256]; + memset (used_char, '\0', sizeof (used_char)); + mnemonic_maxlen = 0; + mnemonic_minlen = 10000; + for (size_t cnt = 0; cnt < nstr; ++cnt) + { + const unsigned char *cp = (const unsigned char *) str[cnt]; + mnemonic_maxlen = MAX (mnemonic_maxlen, strlen ((char *) cp)); + mnemonic_minlen = MIN (mnemonic_minlen, strlen ((char *) cp)); + do + used_char[*cp++] = 1; + while (*cp != '\0'); + } + size_t nused_char = 0; + for (size_t cnt = 0; cnt < 256; ++cnt) + if (used_char[cnt] != 0) + ++nused_char; + return nused_char; +} + + +static const char **mnemonic_strs; +static size_t nmnemonic_strs; +static void +add_mnemonics (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + mnemonic_strs[nmnemonic_strs++] = *(const char **) nodep; +} + + +struct charfreq +{ + char ch; + int freq; +}; +static struct charfreq pfxfreq[256]; +static struct charfreq sfxfreq[256]; + + +static int +compare_freq (const void *p1, const void *p2) +{ + const struct charfreq *c1 = (const struct charfreq *) p1; + const struct charfreq *c2 = (const struct charfreq *) p2; + + if (c1->freq > c2->freq) + return -1; + if (c1->freq < c2->freq) + return 1; + return 0; +} + + +static size_t +compute_pfxfreq (const char *str[], size_t nstr) +{ + memset (pfxfreq, '\0', sizeof (pfxfreq)); + + for (size_t i = 0; i < nstr; ++i) + pfxfreq[i].ch = i; + + for (size_t i = 0; i < nstr; ++i) + ++pfxfreq[*((const unsigned char *) str[i])].freq; + + qsort (pfxfreq, 256, sizeof (struct charfreq), compare_freq); + + size_t n = 0; + while (n < 256 && pfxfreq[n].freq != 0) + ++n; + return n; +} + + +struct strsnlen +{ + const char *str; + size_t len; +}; + +static size_t +compute_sfxfreq (size_t nstr, struct strsnlen *strsnlen) +{ + memset (sfxfreq, '\0', sizeof (sfxfreq)); + + for (size_t i = 0; i < nstr; ++i) + sfxfreq[i].ch = i; + + for (size_t i = 0; i < nstr; ++i) + ++sfxfreq[((const unsigned char *) strchrnul (strsnlen[i].str, '\0'))[-1]].freq; + + qsort (sfxfreq, 256, sizeof (struct charfreq), compare_freq); + + size_t n = 0; + while (n < 256 && sfxfreq[n].freq != 0) + ++n; + return n; +} + + +static void +create_mnemonic_table (void) +{ + mnemonic_strs = xmalloc (nmnemonics * sizeof (char *)); + + twalk (mnemonics, add_mnemonics); + + (void) which_chars (mnemonic_strs, nmnemonic_strs); + + size_t best_so_far = 100000000; + char *best_prefix = NULL; + char *best_suffix = NULL; + char *best_table = NULL; + size_t best_table_size = 0; + size_t best_table_bits = 0; + size_t best_prefix_bits = 0; + + /* We can precompute the prefix characters. */ + size_t npfx_char = compute_pfxfreq (mnemonic_strs, nmnemonic_strs); + + /* Compute best size for string representation including explicit NUL. */ + for (size_t pfxbits = 0; (1u << pfxbits) < 2 * npfx_char; ++pfxbits) + { + char prefix[1 << pfxbits]; + size_t i; + for (i = 0; i < (1u << pfxbits) - 1; ++i) + prefix[i] = pfxfreq[i].ch; + prefix[i] = '\0'; + + struct strsnlen strsnlen[nmnemonic_strs]; + + for (i = 0; i < nmnemonic_strs; ++i) + { + if (strchr (prefix, *mnemonic_strs[i]) != NULL) + strsnlen[i].str = mnemonic_strs[i] + 1; + else + strsnlen[i].str = mnemonic_strs[i]; + strsnlen[i].len = strlen (strsnlen[i].str); + } + + /* With the prefixes gone, try to combine strings. */ + size_t nstrsnlen = 1; + for (i = 1; i < nmnemonic_strs; ++i) + { + size_t j; + for (j = 0; j < nstrsnlen; ++j) + if (strsnlen[i].len > strsnlen[j].len + && strcmp (strsnlen[j].str, + strsnlen[i].str + (strsnlen[i].len + - strsnlen[j].len)) == 0) + { + strsnlen[j] = strsnlen[i]; + break; + } + else if (strsnlen[i].len < strsnlen[j].len + && strcmp (strsnlen[i].str, + strsnlen[j].str + (strsnlen[j].len + - strsnlen[i].len)) == 0) + break; +; + if (j == nstrsnlen) + strsnlen[nstrsnlen++] = strsnlen[i]; + } + + size_t nsfx_char = compute_sfxfreq (nstrsnlen, strsnlen); + + for (size_t sfxbits = 0; (1u << sfxbits) < 2 * nsfx_char; ++sfxbits) + { + char suffix[1 << sfxbits]; + + for (i = 0; i < (1u << sfxbits) - 1; ++i) + suffix[i] = sfxfreq[i].ch; + suffix[i] = '\0'; + + size_t newlen[nstrsnlen]; + + for (i = 0; i < nstrsnlen; ++i) + if (strchr (suffix, strsnlen[i].str[strsnlen[i].len - 1]) != NULL) + newlen[i] = strsnlen[i].len - 1; + else + newlen[i] = strsnlen[i].len; + + char charused[256]; + memset (charused, '\0', sizeof (charused)); + size_t ncharused = 0; + + const char *tablestr[nstrsnlen]; + size_t ntablestr = 1; + tablestr[0] = strsnlen[0].str; + size_t table = newlen[0] + 1; + for (i = 1; i < nstrsnlen; ++i) + { + size_t j; + for (j = 0; j < ntablestr; ++j) + if (newlen[i] > newlen[j] + && memcmp (tablestr[j], + strsnlen[i].str + (newlen[i] - newlen[j]), + newlen[j]) == 0) + { + table += newlen[i] - newlen[j]; + tablestr[j] = strsnlen[i].str; + newlen[j] = newlen[i]; + break; + } + else if (newlen[i] < newlen[j] + && memcmp (strsnlen[i].str, + tablestr[j] + (newlen[j] - newlen[i]), + newlen[i]) == 0) + break; + + if (j == ntablestr) + { + table += newlen[i] + 1; + tablestr[ntablestr] = strsnlen[i].str; + newlen[ntablestr] = newlen[i]; + + ++ntablestr; + } + + for (size_t x = 0; x < newlen[j]; ++x) + if (charused[((const unsigned char *) tablestr[j])[x]]++ == 0) + ++ncharused; + } + + size_t ncharused_bits = 0; + i = 1; + while (i < ncharused) + { + i *= 2; + ++ncharused_bits; + } + + size_t table_bits = 0; + i = 1; + while (i < table) + { + i *= 2; + ++table_bits; + } + + size_t mnemonic_bits = table_bits + pfxbits + sfxbits; + size_t new_total = (((table + 7) / 8) * ncharused_bits + ncharused + + (pfxbits == 0 ? 0 : (1 << pfxbits) - 1) + + (sfxbits == 0 ? 0 : (1 << sfxbits) - 1) + + (((total_bits + mnemonic_bits + 7) / 8) + * ninstructions)); + + if (new_total < best_so_far) + { + best_so_far = new_total; + best_mnemonic_bits = mnemonic_bits; + + free (best_suffix); + best_suffix = xstrdup (suffix); + + free (best_prefix); + best_prefix = xstrdup (prefix); + best_prefix_bits = pfxbits; + + best_table_size = table; + best_table_bits = table_bits; + char *cp = best_table = xrealloc (best_table, table); + for (i = 0; i < ntablestr; ++i) + { + assert (cp + newlen[i] + 1 <= best_table + table); + cp = mempcpy (cp, tablestr[i], newlen[i]); + *cp++ = '\0'; + } + assert (cp == best_table + table); + } + } + } + + fputs ("static const char mnemonic_table[] =\n\"", outfile); + for (size_t i = 0; i < best_table_size; ++i) + { + if (((i + 1) % 60) == 0) + fputs ("\"\n\"", outfile); + if (!isascii (best_table[i]) || !isprint (best_table[i])) + fprintf (outfile, "\\%03o", best_table[i]); + else + fputc (best_table[i], outfile); + } + fputs ("\";\n", outfile); + + if (best_prefix[0] != '\0') + fprintf (outfile, + "static const char prefix[%zu] = \"%s\";\n" + "#define PREFIXCHAR_BITS %zu\n", + strlen (best_prefix), best_prefix, best_prefix_bits); + else + fputs ("#define NO_PREFIX\n", outfile); + + if (best_suffix[0] != '\0') + fprintf (outfile, "static const char suffix[%zu] = \"%s\";\n", + strlen (best_suffix), best_suffix); + else + fputs ("#define NO_SUFFIX\n", outfile); + + for (size_t i = 0; i < nmnemonic_strs; ++i) + { + const char *mne = mnemonic_strs[i]; + + size_t pfxval = 0; + char *cp = strchr (best_prefix, *mne); + if (cp != NULL) + { + pfxval = 1 + (cp - best_prefix); + ++mne; + } + + size_t l = strlen (mne); + + size_t sfxval = 0; + cp = strchr (best_suffix, mne[l - 1]); + if (cp != NULL) + { + sfxval = 1 + (cp - best_suffix); + --l; + } + + char *off = memmem (best_table, best_table_size, mne, l); + while (off[l] != '\0') + { + off = memmem (off + 1, best_table_size, mne, l); + assert (off != NULL); + } + + fprintf (outfile, "#define MNE_%s %#zx\n", + mnemonic_strs[i], + (off - best_table) + + ((pfxval + (sfxval << best_prefix_bits)) << best_table_bits)); + } +} +#endif diff --git a/libcpu/memory-access.h b/libcpu/memory-access.h new file mode 100644 index 00000000..c68eb4a0 --- /dev/null +++ b/libcpu/memory-access.h @@ -0,0 +1,179 @@ +/* Unaligned memory access functionality. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2001. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _MEMORY_ACCESS_H +#define _MEMORY_ACCESS_H 1 + +#include <byteswap.h> +#include <endian.h> +#include <limits.h> +#include <stdint.h> + + +/* When loading this file we require the macro MACHINE_ENCODING to be + defined to signal the endianness of the architecture which is + defined. */ +#ifndef MACHINE_ENCODING +# error "MACHINE_ENCODING needs to be defined" +#endif +#if MACHINE_ENCODING != __BIG_ENDIAN && MACHINE_ENCODING != __LITTLE_ENDIAN +# error "MACHINE_ENCODING must signal either big or little endian" +#endif + + +/* We use simple memory access functions in case the hardware allows it. + The caller has to make sure we don't have alias problems. */ +#if ALLOW_UNALIGNED + +# define read_2ubyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? bswap_16 (*((const uint16_t *) (Addr))) \ + : *((const uint16_t *) (Addr))) +# define read_2sbyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? (int16_t) bswap_16 (*((const int16_t *) (Addr))) \ + : *((const int16_t *) (Addr))) + +# define read_4ubyte_unaligned_noncvt(Addr) \ + *((const uint32_t *) (Addr)) +# define read_4ubyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? bswap_32 (*((const uint32_t *) (Addr))) \ + : *((const uint32_t *) (Addr))) +# define read_4sbyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? (int32_t) bswap_32 (*((const int32_t *) (Addr))) \ + : *((const int32_t *) (Addr))) + +# define read_8ubyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? bswap_64 (*((const uint64_t *) (Addr))) \ + : *((const uint64_t *) (Addr))) +# define read_8sbyte_unaligned(Addr) \ + (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + ? (int64_t) bswap_64 (*((const int64_t *) (Addr))) \ + : *((const int64_t *) (Addr))) + +#else + +union unaligned + { + void *p; + uint16_t u2; + uint32_t u4; + uint64_t u8; + int16_t s2; + int32_t s4; + int64_t s8; + } __attribute__ ((packed)); + +static inline uint16_t +read_2ubyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return bswap_16 (up->u2); + return up->u2; +} +static inline int16_t +read_2sbyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return (int16_t) bswap_16 (up->u2); + return up->s2; +} + +static inline uint32_t +read_4ubyte_unaligned_noncvt (const void *p) +{ + const union unaligned *up = p; + return up->u4; +} +static inline uint32_t +read_4ubyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return bswap_32 (up->u4); + return up->u4; +} +static inline int32_t +read_4sbyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return (int32_t) bswap_32 (up->u4); + return up->s4; +} + +static inline uint64_t +read_8ubyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return bswap_64 (up->u8); + return up->u8; +} +static inline int64_t +read_8sbyte_unaligned (const void *p) +{ + const union unaligned *up = p; + if (MACHINE_ENCODING != __BYTE_ORDER) + return (int64_t) bswap_64 (up->u8); + return up->s8; +} + +#endif /* allow unaligned */ + + +#define read_2ubyte_unaligned_inc(Addr) \ + ({ uint16_t t_ = read_2ubyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 2); \ + t_; }) +#define read_2sbyte_unaligned_inc(Addr) \ + ({ int16_t t_ = read_2sbyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 2); \ + t_; }) + +#define read_4ubyte_unaligned_inc(Addr) \ + ({ uint32_t t_ = read_4ubyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 4); \ + t_; }) +#define read_4sbyte_unaligned_inc(Addr) \ + ({ int32_t t_ = read_4sbyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 4); \ + t_; }) + +#define read_8ubyte_unaligned_inc(Addr) \ + ({ uint64_t t_ = read_8ubyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 8); \ + t_; }) +#define read_8sbyte_unaligned_inc(Addr) \ + ({ int64_t t_ = read_8sbyte_unaligned (Addr); \ + Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 8); \ + t_; }) + +#endif /* memory-access.h */ diff --git a/libcpu/x86_64_disasm.c b/libcpu/x86_64_disasm.c new file mode 100644 index 00000000..b793b78d --- /dev/null +++ b/libcpu/x86_64_disasm.c @@ -0,0 +1,31 @@ +/* Disassembler for x86-64. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#define i386_disasm x86_64_disasm +#define DISFILE "x86_64_dis.h" +#define MNEFILE "x86_64.mnemonics" +#define X86_64 +#include "i386_disasm.c" diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f0c4b6b6..235fac01 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,737 @@ +2008-08-15 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.136): New version set, inherits from + ELFUTILS_0.130. Add dwfl_addrsegment, dwfl_report_segment. + +2008-01-21 Ulrich Drepper <drepper@redhat.com> + + * dwarf_child.c: Minor optimizations. + * dwarf_getattrs.c: Likewise. + * dwarf_getpubnames.c: Likewise. + * dwarf_siblingof.c: Likewise. + * dwarf_tag.c: Likewise. + +2008-01-18 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getsrclines.c (dwarf_getsrclines): Don't require exact match + of DWARF_VERSION comparison, just fail if the file's version is newer. + +2008-01-17 Nick Clifton <nickc@redhat.com> + + * dwarf.h (DWARF3_LENGTH_MIN_ESCAPE_CODE): New define. + (DWARF3_LENGTH_MAX_ESCAPE_CODE): New define. + (DWARF3_LENGTH_64_BIT): New define. + * dwarf_getaranges (dwarf_getaranges): Use the new definitions. + * dwarf_getpubnames: Include dwarf.h. + (get_offsets): Use the new definitions. + * dwarf_getsrclines.c (dwarf_getsrclines): Use the new defintions. + * dwarf_nextcu.c: Include dwarf.h. Correct comment. + (dwarf_nextcu): Use the new definitions. + + * libdwP.h (DIE_OFFSET_FROM_CU_OFFSET): New macro. + * dwarf_diecu.c (dwarf_diecu): Use the new macro. + * dwarf_getaranges (dwarf_getaranges): Use the new macro. + * dwarf_nextcu.c (dwarf_nextcu): Use the new macro. + + * dwarf_getpubnames (get_offsets): Replace assertion with test and + error return. + + * dwarf_entry_breakpoints.c (dwarf_entry_breakpoints): Use CUDIE. + + * dwarf_siblingof (dwarf_siblingof): Detect a NULL return pointer. + Set the address in the return structure to the address of the next + non-sibling die, if there is no sibling and the return pointer is + not the same as the die pointer. + * libdw.h: Expand the description of the dwarf_siblingof prototype. + + * dwarf_child.c: Fix typo in comment. + + * libdwP.h (DWARF_VERSION): Change to 3. + + * dwarf_formref.c (__libdw_formref.c): Handle attributes which do + not have a initialised valp pointer. + + * dwarf_getattrs.c (dwarf_getattrs): Return 1 rather than 0 when + the end of the attributes is reached. When the callback fails, + return the address of the failing attribute, not the address of + its successor. + * libdw.h: Expand the description of the dwarf_getattrs prototype. + + * dwarf_child.c (__libdw_find_attr): Use the new definition. + (dwarf_child): Likewise. + * dwarf_tag.c (__libdw_findabbrev): Likewise. + (dwarf_tag): Likewise. + +2008-01-08 Roland McGrath <roland@redhat.com> + + * Makefile.am (euinclude): Variable removed. + (pkginclude_HEADERS): Set this instead of euinclude_HEADERS. + (libdw.so): Pass -Wl,--enable-new-dtags,-rpath,$(pkglibdir). + +2007-10-17 Roland McGrath <roland@redhat.com> + + * libdw.h (__deprecated_attribute__): New macro. + (dwarf_formref): Mark it deprecated. + * dwarf_formref.c (__libdw_formref): New function, broken out of ... + (dwarf_formref): ... here. Call it. Remove INTDEF. + * libdwP.h: Remove INTDECL. + Declare __libdw_formref. + * dwarf_siblingof.c (dwarf_siblingof): Call __libdw_formref instead. + * dwarf_formref_die.c: Likewise. Handle DW_FORM_ref_addr here. + + * libdw_form.c (__libdw_form_val_len): Fix DW_FORM_ref_addr result, + needs to check CU->version. + + * libdwP.h (struct Dwarf_CU): New member `version'. + * libdw_findcu.c (__libdw_findcu): Initialize it. + + * dwarf_child.c: Return 1 for null entry as first child. + +2007-10-05 Roland McGrath <roland@redhat.com> + + * dwarf_begin_elf.c (check_section): Punt on SHT_NOBITS sections. + + * libdw.h (__extern_inline): Rename to __libdw_extern_inline. + [__OPTIMIZE__] (dwarf_whatattr, dwarf_whatform): Update uses. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.130: Add dwfl_build_id_find_elf + and dwfl_build_id_find_debuginfo. + + * libdw.map (ELFUTILS_0.130): New version set, inherits from + ELFUTILS_0.127. Add dwfl_module_build_id, dwfl_module_report_build_id. + +2007-10-02 Roland McGrath <roland@redhat.com> + + * libdw_visit_scopes.c (classify_die): Return walk for class_type and + structure_type. + +2007-08-07 Roland McGrath <roland@redhat.com> + + * dwarf_getscopes.c (pc_match): Swallow dwarf_haspc error return when + error code is DWARF_E_NOERROR (0). + + * dwarf_getscopes.c (pc_record): Always bail early if DIE->prune. + Fix typo in __libdw_visit_scopes argument. + + * dwarf_getscopes.c (pc_match): Check dwarf_haspc error return, + swallow DWARF_E_NO_DEBUG_RANGES but not other errors. + +2007-07-03 Roland McGrath <roland@redhat.com> + + * libdw.h (__extern_inline): New macro. + [__OPTIMIZE__] (dwarf_whatattr, dwarf_whatform): Use it. + +2007-04-16 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): Add dwfl_module_address_section. + +2007-04-05 Roland McGrath <roland@redhat.com> + + * dwarf_getsrcdirs.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_getsrcdirs. + * libdw.map (ELFUTILS_0.127): Add it. + + * libdwP.h (struct Dwarf_Files_s): New member ndirs. + * dwarf_getsrclines.c (dwarf_getsrclines): Don't clobber NDIRLIST to + zero before we use it to check for DWARF_E_INVALID_DIR_IDX. + Save DIRARRAY in the Dwarf_Files. + + * dwarf_ranges.c (dwarf_ranges): Don't sign-extend 32-bit BEGIN + address to check for all-ones base address entry. Check directly. + Reported by Sébastien Dugué <sebastien.dugue@bull.net>. + +2007-03-25 Roland McGrath <roland@redhat.com> + + * dwarf_begin_elf.c (check_section): Return Dwarf * instead of void. + Return NULL when freeing RESULT on error. + (global_read, scngrp_read): Check return value from check_section, + break out of loop after it has freed RESULT. + (valid_p): Handle null argument. + +2007-03-12 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): Add dwfl_report_begin_add. + +2007-03-04 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): New version set, inherits from + ELFUTILS_0.126. Add dwfl_module_addrsym. + +2007-02-10 Roland McGrath <roland@redhat.com> + + * dwarf.h (DW_OP_fbreg): Comment fix. + +2007-02-03 Roland McGrath <roland@redhat.com> + + * dwarf_getelf.c (dwarf_getelf): Renamed from dwarf_get_elf. + * libdw.map (ELFUTILS_0.126): New version set, inherits from + ELFUTILS_0.122. Move dwarf_getelf there; it was never truly + exported in the past. + +2006-12-17 Roland McGrath <roland@redhat.com> + + * dwarf_getlocation.c (dwarf_getlocation_addr): Use zero as base + address when the CU is missing attributes due to buggy GCC. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * Makefile.am (CLEANFILES): Add libdw.so.$(VERSION). + + * libdw.h (dwarf_diecu): Add __nonnull_attribute__. + (dwarf_child): Don't list arg 1 in __nonnull_attribute__. + + * libdw_alloc.c (__libdw_allocate): Take new ALIGN argument, make sure + result is aligned. Adjust NEWP->remaining here for this allocation. + * libdwP.h: Update decl. + (libdw_alloc): Update caller. + +2006-07-12 Ulrich Drepper <drepper@redhat.com> + + * dwarf_child.c: Adjust for internal_function_def removal. + * dwarf_getabbrev.c: Likewise. + * dwarf_tag.c: Likewise. + * libdw_form.c: Likewise. + * memory-access.c: Likewise. + +2006-06-28 Roland McGrath <roland@redhat.com> + + * libdw.map: Export dwfl_linecu, dwfl_line_comp_dir. + + * libdw.map: Bump to 0.122; export dwfl_module_getsymtab and + dwfl_module_getsym. + +2006-05-27 Ulrich Drepper <drepper@redhat.com> + + * libdw.h: Add extern "C". + +2006-05-22 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getaranges.c (dwarf_getaranges): Handle files without + aranges information. + +2006-05-21 Ulrich Drepper <drepper@redhat.com> + + * libdw.h: Add nonnull attributes to dwarf_tag, dwarf_getattrs, + dwarf_haschildren. + +2006-02-28 Roland McGrath <roland@redhat.com> + + * dwarf.h: Add missing DW_ATE_*, DW_TAG_*, DW_LANG_*, DW_CFA_*, + DW_OP_* values, to match DWARF 3.0. Add new DW_DS_*, DW_END_* + values from DWARF 3.0. + +2006-02-22 Roland McGrath <roland@redhat.com> + + * libdw.map: Bump to 0.120; export dwfl_version. + +2005-12-22 Roland McGrath <roland@redhat.com> + + * libdw.map: Bump to 0.119; export dwfl_linux_proc_maps_report. + +2005-12-12 Roland McGrath <roland@redhat.com> + + * dwarf_ranges.c: Copy CU base address-finding code from + dwarf_getlocation. + +2005-12-09 Roland McGrath <roland@redhat.com> + + * dwarf_getlocation.c (dwarf_getlocation_addr): Add some unlikelys. + Delay CU base lookup until it's needed. + If CU base lookup fails with no error, flag invalid DWARF. + +2005-11-25 Roland McGrath <roland@redhat.com> + + * libdw.map: Bump to 0.118; export dwfl_module_register_names. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * Makefile.am [BUILD_STATIC] (AM_CFLAGS): Add -fpic. + +2005-11-13 Roland McGrath <roland@redhat.com> + + * libdw.map: Bump to 0.117; export dwfl_module_return_value_location. + +2005-10-27 Roland McGrath <roland@redhat.com> + + * dwarf_entry_breakpoints.c (search_range): Fix binary search code; + don't match end_sequence markers. + + * dwarf_getsrclines.c (compare_lines): Sort end_sequence markers + before normal records at the same address. + * dwarf_getsrc_die.c (dwarf_getsrc_die): Don't match an end_sequence + marker. + +2005-10-26 Roland McGrath <roland@redhat.com> + + * dwarf_getfuncs.c (dwarf_getfuncs): Use Dwarf_Die, not Dwarf_Func. + * dwarf_func_file.c: Renamed to ... + * dwarf_decl_file.c: ... here. + * dwarf_func_col.c: Renamed to ... + * dwarf_decl_column.c: ... here. + * dwarf_func_line.c: Renamed to ... + * dwarf_decl_line.c: ... here. + (dwarf_func_line): Renamed to ... + (dwarf_decl_line): ... this. Take a Dwarf_Die * argument. + (__libdw_func_intval): Renamed __libdw_attr_intval. + * dwarf_func_name.c: File removed. + * dwarf_func_lowpc.c: File removed. + * dwarf_func_highpc.c: File removed. + * dwarf_func_entrypc.c: File removed. + * dwarf_func_die.c: File removed. + * Makefile.am (libdw_a_SOURCES): Updated. + * libdw.h: Update decls. + (Dwarf_Func): Type removed. + * libdwP.h: Update decls. + (struct Dwarf_Func_s): Type removed. + * libdw.map: Updated. + + * libdwP.h (CUDIE): New macro. + * dwarf_getlocation.c (dwarf_getlocation_addr): Use it. + * dwarf_getscopes_die.c (dwarf_getscopes_die): Likewise. + * dwarf_ranges.c (dwarf_ranges): Likewise. + + * dwarf_getloclist.c: Renamed to ... + * dwarf_getlocation.c: ... here. + (getloclist): Renamed to getlocation. + (dwarf_getloclist): Renamed to dwarf_getlocation. + (dwarf_addrloclists): Renamed to dwarf_getlocation_addr. + * Makefile.am (libdw_a_SOURCES): Updated. + * libdw.h (dwarf_getloclist): Renamed to dwarf_getlocation. + (dwarf_addrloclists): Renamed dwarf_getlocation_addr. + (Dwarf_Loc): Renamed Dwarf_Op. + * libdwP.h (struct loc_s): Update use. + * libdw.map: Update map. + + * dwarf_entry_breakpoints.c: Use the second line record within the + function, regardless of its source location data. + +2005-10-25 Roland McGrath <roland@redhat.com> + + * dwarf_entry_breakpoints.c: Fall back to entrypc for contiguous too. + + * libdw.map: Add dwarf_entrypc, dwarf_entry_breakpoints. + +2005-10-14 Roland McGrath <roland@redhat.com> + + * dwarf_diecu.c (dwarf_diecu): New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_diecu. + * libdw.map: Export it. + + * libdw.map: Bump to 0.116; export dwarf_ranges. + +2005-09-20 Roland McGrath <roland@redhat.com> + + * dwarf_haspc.c: Use dwarf_ranges. + * dwarf_entry_breakpoints.c: Likewise. + + * dwarf_ranges.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_ranges. + * libdwP.h: Add INTDECL. + +2005-09-14 Roland McGrath <roland@redhat.com> + + * dwarf_entry_breakpoints.c (dwarf_entry_breakpoints): Fix braino in + prologue_end marker scanning loop. + +2005-09-11 Roland McGrath <roland@redhat.com> + + * dwarf.h: Comment typo fix. + +2005-09-07 Roland McGrath <roland@redhat.com> + + * dwarf_entry_breakpoints.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_entry_breakpoints. + + * dwarf_entrypc.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_entrypc. + * libdwP.h: Add INTDECL. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Use $(LINK) not $(CC) when creating DSO. + (%.os): Use COMPILE.os. + (COMPILE.os): Filter out gconv options. + +2005-08-27 Roland McGrath <roland@redhat.com> + + * dwarf_getscopes.c (dwarf_getscopes): Rewritten using + __libdw_visit_scopes. + + * dwarf_getscopes_die.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_getscopes_die. + * libdw.map: Bump to 0.115 and add it. + + * libdw_visit_scopes.c (__libdw_visit_scopes): Pass a struct + containing a DIE and its parent pointer, instead of just Dwarf_Die. + Take two functions for both preorder and postorder visitors. + * libdwP.h: Update decl. + (struct Dwarf_Die_Chain): New type. + * dwarf_func_inline.c: Update uses. + + * dwarf_diename.c (dwarf_diename): Use dwarf_attr_integrate. + Add INTDEF. + * libdwP.h: Add INTDECL. + * dwarf_func_name.c (dwarf_func_name): Use dwarf_diename. + +2005-08-23 Roland McGrath <roland@redhat.com> + + * dwarf_attr_integrate.c (dwarf_attr_integrate): Treat + DW_AT_specification the same as DW_AT_abstract_origin. + +2005-08-20 Roland McGrath <roland@redhat.com> + + * libdw.map: Add dwfl_cumodule, remove dwfl_linecu. + Add dwfl_linux_kernel_report_offline, dwfl_offline_section_address, + and dwfl_report_offline. + +2005-08-19 Roland McGrath <roland@redhat.com> + + * libdw.map: Bump version to ELFUTILS_0.114 for libdwfl changes. + Add dwfl_module_relocate_address, dwfl_module_relocations, + dwfl_module_relocation_info. + +2005-08-18 Roland McGrath <roland@redhat.com> + + * dwarf_getscopes.c (dwarf_getscopes): Include the CU itself as + outermost scope in the results. + +2005-08-15 Roland McGrath <roland@redhat.com> + + * dwarf_func_inline.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_func_inline, dwarf_func_inline_instances. + * libdw.map: Add them. + + * dwarf_func_die.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_func_die. + * libdw.map: Add it. Bump version to ELFUTILS_0.114. + +2005-08-10 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getsrclines.c (dwarf_getsrclines): Correct fallout of renaming + of DW_LNS_set_epilog_begin. + +2005-08-09 Roland McGrath <roland@redhat.com> + + * dwarf.h (DW_LNS_set_epilog_begin): Renamed DW_LNS_set_epilogue_begin. + + * dwarf_end.c: Add INTDEF. + * dwarf_error.c (dwarf_errmsg): Likewise. + * libdwP.h (dwarf_end, dwarf_errmsg): Add INTDECLs. + +2005-08-01 Roland McGrath <roland@redhat.com> + + * dwarf_getaranges.c (dwarf_getaranges): Check for bogus offset. + * dwarf_getabbrev.c (__libdw_getabbrev): Likewise. + +2005-07-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libdw.so): No need to link with libeu.a anymore. + (libdw_a_LIBADD): Add all files from libdwfl.a. + +2005-07-27 Roland McGrath <roland@redhat.com> + + * Makefile.am (libdw.so): Link ../libdwfl/libdwfl_pic.a in, + along with ../libebl/libebl.a and ../lib/libeu.a; + depend on ../libelf/libelf.so. + (libdw_so_LDADD): New variable. + * libdw.map: Add dwfl_* symbols formerly in ../libdwfl/libdwfl.map. + + * libdw.map: Define an empty base version and move all symbols to + version ELFUTILS_0.111; don't define ELFUTILS_1.0 at all yet. + +2005-07-23 Ulrich Drepper <drepper@redhat.com> + + * dwarf_error.c: Add internal alias for dwarf_errno. + * libdwP.h: Declare __dwarf_errno_internal. + * dwarf_getloclist.c: Use INTDEF for dwarf_errno. + + * dwarf_error.c [USE_TLS]: Actually use __thread in definition of + global_error. + +2005-06-01 Roland McGrath <roland@redhat.com> + + * dwarf_getaranges.c (dwarf_getaranges): Sort result array. + * dwarf_getarange_addr.c (dwarf_getarange_addr): Use binary search. + +2005-06-08 Roland McGrath <roland@redhat.com> + + * memory-access.h (get_uleb128_step, get_uleb128): Remove casts. + (get_sleb128_step, get_sleb128): Likewise. + * dwarf_getattrs.c (dwarf_getattrs): Add consts. + * dwarf_getloclist.c (getloclist): Likewise. + * dwarf_formblock.c (dwarf_formblock): Likewise. + * dwarf_getsrclines.c (dwarf_getsrclines): Likewise. + * dwarf_getabbrevattr.c (dwarf_getabbrevattr): Likewise. + * dwarf_formref.c (dwarf_formref): Likewise. + * dwarf_formsdata.c (dwarf_formsdata): Likewise. + * dwarf_formudata.c (dwarf_formudata): Likewise. + * dwarf_haschildren.c (dwarf_haschildren): Likewise. + * dwarf_child.c (__libdw_find_attr, __libdw_find_attr): Likewise. + * dwarf_tag.c (dwarf_tag): Likewise. + * dwarf_getabbrev.c (__libdw_getabbrev): Likewise. + * memory-access.c (__libdw_get_uleb128, __libdw_get_sleb128): Likewise. + * libdw_form.c (__libdw_form_val_len): Likewise. + * libdwP.h: Update decl. + +2005-06-04 Roland McGrath <roland@redhat.com> + + * memory-access.h (get_uleb128_rest_return): New macro. + [! IS_LIBDW] (__libdw_get_uleb128): New static, defined using it. + (get_sleb128_rest_return): New macro. + [! IS_LIBDW] (__libdw_get_sleb128): New static, defined using it. + * memory-access.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + (DEFS): Add -DIS_LIBDW. + +2005-05-31 Roland McGrath <roland@redhat.com> + + * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to + formref offset. + +2005-05-30 Roland McGrath <roland@redhat.com> + + * dwarf_getloclist.c (dwarf_addrloclists): Use DW_AT_entry_pc for base + address if DW_AT_low_pc is missing. Not to spec, but GCC generates it. + + * dwarf_getloclist.c (dwarf_addrloclists): Don't sign-extend 4-byte + BEGIN value. Instead, match base address entries separately for + 32/64 size cases. + +2005-05-28 Roland McGrath <roland@redhat.com> + + * dwarf_getloclist.c (dwarf_addrloclists): Fix decoding to advance + past location expression contents. + +2005-05-23 Roland McGrath <roland@redhat.com> + + * dwarf_getsrclines.c: Comment typo fix. + + * dwarf_haspc.c (dwarf_haspc): Fix CU DIE address calculation. + * dwarf_getloclist.c (dwarf_addrloclists): Likewise. + +2005-05-22 Ulrich Drepper <drepper@redhat.com> + + * libdwP.h: Only use INTDECL for alias prototypes. + +2005-05-19 Roland McGrath <roland@redhat.com> + + * dwarf_getloclist.c (attr_ok): Permit DW_AT_static_link too. + + * dwarf_getscopevar.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_getscopevar. + + * dwarf_getsrcfiles.c: Add INTDEF. + * dwarf_haschildren.c: Likewise. + * libdwP.h (dwarf_getsrcfiles, dwarf_haschildren): Add INTDECL. + + * dwarf_getscopes.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_getscopes. + * libdw.map: Add it. + +2005-05-18 Roland McGrath <roland@redhat.com> + + * libdwP.h (IDX_debug_ranges): New enum constant. + * dwarf_begin_elf.c (dwarf_scnnames): Add it for ".debug_ranges". + * libdwP.h (DWARF_E_NO_DEBUG_RANGES): New enum constant. + * dwarf_error.c (errmsgs): Add it. + * dwarf_haspc.c: New file. + * libdw.h: Declare dwarf_haspc. + * libdw.map: Add it. + * libdwP.h: Add INTDECL. + + * dwarf_attr_integrate.c: New file. + * dwarf_hasattr_integrate.c: New file. + * Makefile.am (libdw_a_SOURCES): Add them. + * libdw.h: Declare dwarf_attr_integrate, dwarf_hasattr_integrate. + * libdw.map: Add them. + + * dwarf_hasattr.c: Add INTDEF. + * libdwP.h: Add INTDECL for it. + + * dwarf_formref_die.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h (dwarf_formref_die): Declare it. + * libdwP.h (dwarf_formref_die): Add INTDECL. + * libdw.map: Add it. + + * dwarf_getloclist.c (attr_ok, getloclist): New functions, broken out + of ... + (dwarf_getloclist): ... here. Call them. + (dwarf_addrloclists): New function. + * libdw.h: Declare it. + * libdw.map: Add it. + + * dwarf_getmacros.c (dwarf_getmacros): Don't bail at + DW_MACINFO_end_file. Recognize type 0 as terminator. + +2005-05-05 Roland McGrath <roland@redhat.com> + + * dwarf_getsrc_die.c (dwarf_getsrc_die): Use binary search. + + * dwarf_getsrclines.c (dwarf_getsrclines): Sort result array, since + the line program does not produce all entries in ascending order. + +2005-04-25 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getsrc_file.c (dwarf_getsrc_file): Handle multiple + occurences (e.g., inlines) better. + +2005-04-24 Ulrich Drepper <drepper@redhat.com> + + * libdw.h (DWARF_END_ABBREV): Define. + * dwarf_getabbrev.c (__libdw_getabbrev): Return DWARF_END_ABBREV if + end is reached. + * dwarf_offabbrev.c (dwarf_offabbrev): Return -1 on error, 1 if end + of records reached. + * dwarf_tag.c (__libdw_findabbrev): Also recognize DWARF_END_ABBREV + as error of __libdw_getabbrev. + +2005-04-04 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getsrc_file.c (dwarf_getsrc_file): Minor optimization. + + * dwarf_getsrc_file.c (dwarf_getsrc_file): Always pass number of + results back to caller. + +2005-04-04 Roland McGrath <roland@redhat.com> + + * dwarf_getsrc_file.c (dwarf_getsrc_file): Use size_t for CUHL. + + * dwarf_func_line.c (__libdw_func_intval): Use internal_function in + defn. + +2005-04-04 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getsrc_file.c (dwarf_getsrc_file): Use INTUSE. + + * dwarf_getsrc_file.c: New file. + * Makefile.am (libdw_a_SOURCES): Add dwarf_getsrc_file.c. + * libdw.h: Declare dwarf_getsrc_file. + * libdw.map: Add dwarf_getsrc_file. + +2005-04-02 Ulrich Drepper <drepper@redhat.com> + + * dwarf_func_entrypc.c: New file. + * dwarf_func_col.c: New file. + * dwarf_func_line.c: New file. + * dwarf_func_file.c: New file. + * libdw.h: Add prototypes for new functions. + * libdw.map: Add dwarf_func_entrypc, dwarf_func_col, dwarf_func_line, + dwarf_func_file. + * Makefile.am (libdw_a_SOURCES): Add dwarf_func_entrypc.c, + dwarf_func_col.c, dwarf_func_line.c, dwarf_func_file.c. + * libdwP.h (struct Dwarf_Func_s): Add cudie element. + Declare __libdw_func_intval and __dwarf_formsdata_internal. + * dwarf_getfuncs.c: Also fill in cudie in Dwarf_Func object. + * dwarf_formsdata.c: Use INTUSE and INTDEF to avoid PLTs. + + * dwarf.h: Add some DWARF3 definitions. + +2005-04-01 Ulrich Drepper <drepper@redhat.com> + + * dwarf_getfuncs.c: New file. + * dwarf_func_highpc.c: New file. + * dwarf_func_lowpc.c: New file. + * dwarf_func_name.c: New file. + * Makefile.am (libdw_a_SOURCES): Add dwarf_getfuncs.c, + dwarf_func_highpc.c, dwarf_func_lowpc.c, and dwarf_func_name.c. + * libdw.map: Add dwarf_getfuncs, dwarf_func_highpc, dwarf_func_lowpc, + and dwarf_func_name. + * libdw.h: Add prototypes for new functions. + * dwarf_child.c: Use INTUSE and INTDEF to avoid PLTs. + * dwarf_siblingof.c: Likewise. + * dwarf_dieoffset.c: Likewise. + * dwarf_highpc.c: Likewise. + * dwarf_lowpc.c: Likewise. + * libdwP.h: Add prototypes for internal functions. + Define Dwarf_Func_s structure. + +2005-03-29 Ulrich Drepper <drepper@redhat.com> + + * libdw.h: Add padding in Dwarf_die. + + * dwarf_arrayorder.c: Use INTUSE and INTDEF to avoid PLTs. + * dwarf_attr.c: Likewise. + * dwarf_begin.c: Likewise. + * dwarf_begin_elf.c: Likewise. + * dwarf_bitoffset.c: Likewise. + * dwarf_bitsize.c: Likewise. + * dwarf_bytesize.c: Likewise. + * dwarf_diename.c: Likewise. + * dwarf_formaddr.c: Likewise. + * dwarf_formblock.c: Likewise. + * dwarf_formref.c: Likewise. + * dwarf_formstring.c: Likewise. + * dwarf_formudata.c: Likewise. + * dwarf_getarange_addr.c: Likewise. + * dwarf_getarangeinfo.c: Likewise. + * dwarf_getaranges.c: Likewise. + * dwarf_getloclist.c: Likewise. + * dwarf_getmacros.c: Likewise. + * dwarf_getsrc_die.c: Likewise. + * dwarf_getsrcfiles.c: Likewise. + * dwarf_getsrclines.c: Likewise. + * dwarf_highpc.c: Likewise. + * dwarf_lowpc.c: Likewise. + * dwarf_nextcu.c: Likewise. + * dwarf_offdie.c: Likewise. + * dwarf_siblingof.c: Likewise. + * dwarf_srclang.c: Likewise. + * dwarf_tag.c: Likewise. + * libdw_findcu.c: Likewise. + * libdwP.h: Add prototypes for internal functions. + + * dwarf_addrdie.c: New file. + * dwarf_macro_opcode.c: New file. + * dwarf_macro_param1.c: New file. + * dwarf_macro_param2.c: New file. + * libdw.h: Add declarations. Move Dwarf_Macro definition to libdwP.h. + * libdwP.h: Remove Dwarf_Macro definition. + * Makefile.am (libdw_a_SOURCES): Add dwarf_addrdie.c, + dwarf_macro_opcode.c, dwarf_macro_param1.c, and dwarf_macro_param2.c. + * libdw.map: Add entries for new functions. + +2005-03-21 Ulrich Drepper <drepper@redhat.com> + + * libdw.h: Handle broken gcc < 4. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. + + * dwarf_begin_elf.c: Fix warnings. + * dwarf_dieoffset.c: Likewise. + * dwarf_end.c: Likewise. + * dwarf_error.c: Likewise. + * dwarf_getpubnames.c: Likewise. + + * libdwP.h: Add new error values. + * dwarf_error.c: Support new error values. + * dwarf_getpubnames.c: Check parameter value. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Check for text relocations in constructed DSO. + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap. + +2005-02-04 Ulrich Drepper <drepper@redhat.com> + + * dwarf_siblingof.c (dwarf_siblingof): Add some buffer boundary + checks to not read over buffer boundaries for ill-formed DWARF data. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * dwarf_child.c: Make compile with gcc 4.0. diff --git a/libdw/Makefile b/libdw/Makefile deleted file mode 100644 index ba960d4c..00000000 --- a/libdw/Makefile +++ /dev/null @@ -1,681 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# libdw/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - - -SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) $(libdw_so_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -noinst_PROGRAMS = $(am__EXEEXT_1) -#am_libdw_pic_a_OBJECTS = -subdir = libdw -DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) \ - $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" \ - "$(DESTDIR)$(includedir)" -libLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libdw_a_AR = $(AR) $(ARFLAGS) -libdw_a_LIBADD = -am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ - dwarf_end.$(OBJEXT) dwarf_getelf.$(OBJEXT) \ - dwarf_getpubnames.$(OBJEXT) dwarf_getabbrev.$(OBJEXT) \ - dwarf_tag.$(OBJEXT) dwarf_error.$(OBJEXT) \ - dwarf_nextcu.$(OBJEXT) dwarf_diename.$(OBJEXT) \ - dwarf_offdie.$(OBJEXT) dwarf_attr.$(OBJEXT) \ - dwarf_formstring.$(OBJEXT) dwarf_abbrev_hash.$(OBJEXT) \ - dwarf_child.$(OBJEXT) dwarf_haschildren.$(OBJEXT) \ - dwarf_formaddr.$(OBJEXT) dwarf_formudata.$(OBJEXT) \ - dwarf_formsdata.$(OBJEXT) dwarf_lowpc.$(OBJEXT) \ - dwarf_highpc.$(OBJEXT) dwarf_formref.$(OBJEXT) \ - dwarf_siblingof.$(OBJEXT) dwarf_dieoffset.$(OBJEXT) \ - dwarf_cuoffset.$(OBJEXT) dwarf_hasattr.$(OBJEXT) \ - dwarf_hasform.$(OBJEXT) dwarf_whatform.$(OBJEXT) \ - dwarf_whatattr.$(OBJEXT) dwarf_bytesize.$(OBJEXT) \ - dwarf_arrayorder.$(OBJEXT) dwarf_bitsize.$(OBJEXT) \ - dwarf_bitoffset.$(OBJEXT) dwarf_srclang.$(OBJEXT) \ - dwarf_getabbrevtag.$(OBJEXT) dwarf_getabbrevcode.$(OBJEXT) \ - dwarf_abbrevhaschildren.$(OBJEXT) dwarf_getattrcnt.$(OBJEXT) \ - dwarf_getabbrevattr.$(OBJEXT) dwarf_getsrclines.$(OBJEXT) \ - dwarf_getsrc_die.$(OBJEXT) dwarf_linesrc.$(OBJEXT) \ - dwarf_lineno.$(OBJEXT) dwarf_lineaddr.$(OBJEXT) \ - dwarf_linecol.$(OBJEXT) dwarf_linebeginstatement.$(OBJEXT) \ - dwarf_lineendsequence.$(OBJEXT) dwarf_lineblock.$(OBJEXT) \ - dwarf_lineprologueend.$(OBJEXT) \ - dwarf_lineepiloguebegin.$(OBJEXT) dwarf_onesrcline.$(OBJEXT) \ - dwarf_formblock.$(OBJEXT) dwarf_getsrcfiles.$(OBJEXT) \ - dwarf_filesrc.$(OBJEXT) dwarf_getloclist.$(OBJEXT) \ - dwarf_getstring.$(OBJEXT) dwarf_offabbrev.$(OBJEXT) \ - dwarf_getaranges.$(OBJEXT) dwarf_onearange.$(OBJEXT) \ - dwarf_getarangeinfo.$(OBJEXT) dwarf_getarange_addr.$(OBJEXT) \ - dwarf_getattrs.$(OBJEXT) dwarf_formflag.$(OBJEXT) \ - dwarf_getmacros.$(OBJEXT) libdw_findcu.$(OBJEXT) \ - libdw_form.$(OBJEXT) libdw_alloc.$(OBJEXT) -libdw_a_OBJECTS = $(am_libdw_a_OBJECTS) -libdw_pic_a_AR = $(AR) $(ARFLAGS) -libdw_pic_a_LIBADD = -libdw_pic_a_OBJECTS = $(am_libdw_pic_a_OBJECTS) -am__EXEEXT_1 = libdw.so$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am_libdw_so_OBJECTS = -libdw_so_OBJECTS = $(am_libdw_so_OBJECTS) -libdw_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \ - $(libdw_so_SOURCES) -DIST_SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \ - $(libdw_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -includeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 1 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Werror -Wshadow -std=gnu99 -#AM_CFLAGS = -Wall -Wshadow -std=gnu99 -INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib -lib_LIBRARIES = libdw.a -noinst_LIBRARIES = libdw_pic.a -include_HEADERS = dwarf.h -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libdw.h -libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ - dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \ - dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \ - dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \ - dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \ - dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \ - dwarf_highpc.c dwarf_formref.c dwarf_siblingof.c \ - dwarf_dieoffset.c dwarf_cuoffset.c dwarf_hasattr.c \ - dwarf_hasform.c dwarf_whatform.c dwarf_whatattr.c \ - dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \ - dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \ - dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \ - dwarf_getattrcnt.c dwarf_getabbrevattr.c \ - dwarf_getsrclines.c dwarf_getsrc_die.c \ - dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \ - dwarf_linecol.c dwarf_linebeginstatement.c \ - dwarf_lineendsequence.c dwarf_lineblock.c \ - dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \ - dwarf_onesrcline.c dwarf_formblock.c \ - dwarf_getsrcfiles.c dwarf_filesrc.c \ - dwarf_getloclist.c dwarf_getstring.c dwarf_offabbrev.c \ - dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \ - dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \ - dwarf_getmacros.c \ - libdw_findcu.c libdw_form.c libdw_alloc.c - -libdw_pic_a_SOURCES = -am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) -libdw_so_SOURCES = -noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h -EXTRA_DIST = libdw.map -CLEANFILES = $(am_libdw_pic_a_OBJECTS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libdw/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits libdw/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - p=$(am__strip_dir) \ - echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ - $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ - else :; fi; \ - done - -uninstall-libLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libdw.a: $(libdw_a_OBJECTS) $(libdw_a_DEPENDENCIES) - -rm -f libdw.a - $(libdw_a_AR) libdw.a $(libdw_a_OBJECTS) $(libdw_a_LIBADD) - $(RANLIB) libdw.a -libdw_pic.a: $(libdw_pic_a_OBJECTS) $(libdw_pic_a_DEPENDENCIES) - -rm -f libdw_pic.a - $(libdw_pic_a_AR) libdw_pic.a $(libdw_pic_a_OBJECTS) $(libdw_pic_a_LIBADD) - $(RANLIB) libdw_pic.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -#libdw.so$(EXEEXT): $(libdw_so_OBJECTS) $(libdw_so_DEPENDENCIES) -# @rm -f libdw.so$(EXEEXT) -# $(LINK) $(libdw_so_LDFLAGS) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/dwarf_abbrev_hash.Po -include ./$(DEPDIR)/dwarf_abbrevhaschildren.Po -include ./$(DEPDIR)/dwarf_arrayorder.Po -include ./$(DEPDIR)/dwarf_attr.Po -include ./$(DEPDIR)/dwarf_begin.Po -include ./$(DEPDIR)/dwarf_begin_elf.Po -include ./$(DEPDIR)/dwarf_bitoffset.Po -include ./$(DEPDIR)/dwarf_bitsize.Po -include ./$(DEPDIR)/dwarf_bytesize.Po -include ./$(DEPDIR)/dwarf_child.Po -include ./$(DEPDIR)/dwarf_cuoffset.Po -include ./$(DEPDIR)/dwarf_diename.Po -include ./$(DEPDIR)/dwarf_dieoffset.Po -include ./$(DEPDIR)/dwarf_end.Po -include ./$(DEPDIR)/dwarf_error.Po -include ./$(DEPDIR)/dwarf_filesrc.Po -include ./$(DEPDIR)/dwarf_formaddr.Po -include ./$(DEPDIR)/dwarf_formblock.Po -include ./$(DEPDIR)/dwarf_formflag.Po -include ./$(DEPDIR)/dwarf_formref.Po -include ./$(DEPDIR)/dwarf_formsdata.Po -include ./$(DEPDIR)/dwarf_formstring.Po -include ./$(DEPDIR)/dwarf_formudata.Po -include ./$(DEPDIR)/dwarf_getabbrev.Po -include ./$(DEPDIR)/dwarf_getabbrevattr.Po -include ./$(DEPDIR)/dwarf_getabbrevcode.Po -include ./$(DEPDIR)/dwarf_getabbrevtag.Po -include ./$(DEPDIR)/dwarf_getarange_addr.Po -include ./$(DEPDIR)/dwarf_getarangeinfo.Po -include ./$(DEPDIR)/dwarf_getaranges.Po -include ./$(DEPDIR)/dwarf_getattrcnt.Po -include ./$(DEPDIR)/dwarf_getattrs.Po -include ./$(DEPDIR)/dwarf_getelf.Po -include ./$(DEPDIR)/dwarf_getloclist.Po -include ./$(DEPDIR)/dwarf_getmacros.Po -include ./$(DEPDIR)/dwarf_getpubnames.Po -include ./$(DEPDIR)/dwarf_getsrc_die.Po -include ./$(DEPDIR)/dwarf_getsrcfiles.Po -include ./$(DEPDIR)/dwarf_getsrclines.Po -include ./$(DEPDIR)/dwarf_getstring.Po -include ./$(DEPDIR)/dwarf_hasattr.Po -include ./$(DEPDIR)/dwarf_haschildren.Po -include ./$(DEPDIR)/dwarf_hasform.Po -include ./$(DEPDIR)/dwarf_highpc.Po -include ./$(DEPDIR)/dwarf_lineaddr.Po -include ./$(DEPDIR)/dwarf_linebeginstatement.Po -include ./$(DEPDIR)/dwarf_lineblock.Po -include ./$(DEPDIR)/dwarf_linecol.Po -include ./$(DEPDIR)/dwarf_lineendsequence.Po -include ./$(DEPDIR)/dwarf_lineepiloguebegin.Po -include ./$(DEPDIR)/dwarf_lineno.Po -include ./$(DEPDIR)/dwarf_lineprologueend.Po -include ./$(DEPDIR)/dwarf_linesrc.Po -include ./$(DEPDIR)/dwarf_lowpc.Po -include ./$(DEPDIR)/dwarf_nextcu.Po -include ./$(DEPDIR)/dwarf_offabbrev.Po -include ./$(DEPDIR)/dwarf_offdie.Po -include ./$(DEPDIR)/dwarf_onearange.Po -include ./$(DEPDIR)/dwarf_onesrcline.Po -include ./$(DEPDIR)/dwarf_siblingof.Po -include ./$(DEPDIR)/dwarf_srclang.Po -include ./$(DEPDIR)/dwarf_tag.Po -include ./$(DEPDIR)/dwarf_whatattr.Po -include ./$(DEPDIR)/dwarf_whatform.Po -include ./$(DEPDIR)/libdw_alloc.Po -include ./$(DEPDIR)/libdw_findcu.Po -include ./$(DEPDIR)/libdw_form.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ - $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(includedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -#install: install-am -install-exec: install-exec-am -install-data: install-data-am -#uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-euincludeHEADERS install-includeHEADERS - -install-exec-am: install-libLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ - ctags distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-includeHEADERS install-info install-info-am \ - install-libLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-euincludeHEADERS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES - -libdw.so: libdw_pic.a $(srcdir)/libdw.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION),-z,defs \ - ../libelf/libelf.so - ln -fs $@ $@.$(VERSION) - -%.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ - -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ - then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ - rm -f "$(DEPDIR)/$*.Tpo"; \ - else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ - fi - -install: install-am libdw.so - $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so - ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION) - ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so - -uninstall: uninstall-am - rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so - rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION) - rm -f $(DESTDIR)$(libdir)/libdw.so - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils -# 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/libdw/Makefile.am b/libdw/Makefile.am index e452b43e..69ce526c 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -1,27 +1,45 @@ ## Process this file with automake to create Makefile.in -## Makefile for libdw. ## -## Copyright (C) 2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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. ## -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW if MUDFLAP -AM_CFLAGS = -Wall -Wshadow -std=gnu99 +AM_CFLAGS = -fmudflap else -AM_CFLAGS = -Wall -Werror -Wshadow -std=gnu99 +AM_CFLAGS = endif +if BUILD_STATIC +AM_CFLAGS += -fpic +endif +AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib VERSION = 1 +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + lib_LIBRARIES = libdw.a if !MUDFLAP noinst_LIBRARIES = libdw_pic.a @@ -29,51 +47,64 @@ noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) endif include_HEADERS = dwarf.h -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libdw.h +pkginclude_HEADERS = libdw.h libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \ dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \ dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \ + dwarf_attr_integrate.c dwarf_hasattr_integrate.c \ dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \ dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \ - dwarf_highpc.c dwarf_formref.c dwarf_siblingof.c \ - dwarf_dieoffset.c dwarf_cuoffset.c dwarf_hasattr.c \ - dwarf_hasform.c dwarf_whatform.c dwarf_whatattr.c \ + dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c dwarf_ranges.c \ + dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \ + dwarf_dieoffset.c dwarf_cuoffset.c dwarf_diecu.c \ + dwarf_hasattr.c dwarf_hasform.c \ + dwarf_whatform.c dwarf_whatattr.c \ dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \ dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \ dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \ dwarf_getattrcnt.c dwarf_getabbrevattr.c \ dwarf_getsrclines.c dwarf_getsrc_die.c \ + dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \ dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \ dwarf_linecol.c dwarf_linebeginstatement.c \ dwarf_lineendsequence.c dwarf_lineblock.c \ dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \ dwarf_onesrcline.c dwarf_formblock.c \ - dwarf_getsrcfiles.c dwarf_filesrc.c \ - dwarf_getloclist.c dwarf_getstring.c dwarf_offabbrev.c \ + dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \ + dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \ dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \ dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \ - dwarf_getmacros.c \ - libdw_findcu.c libdw_form.c libdw_alloc.c - + dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \ + dwarf_macro_param2.c dwarf_addrdie.c \ + dwarf_getfuncs.c \ + dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \ + dwarf_func_inline.c dwarf_getsrc_file.c \ + libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \ + libdw_visit_scopes.c \ + dwarf_entry_breakpoints.c if !MUDFLAP libdw_pic_a_SOURCES = am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) libdw_so_SOURCES = -libdw.so: libdw_pic.a $(srcdir)/libdw.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION),-z,defs \ - ../libelf/libelf.so +libdw.so: $(srcdir)/libdw.map libdw_pic.a \ + ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \ + ../libelf/libelf.so +# The rpath is necessary for libebl because its $ORIGIN use will +# not fly in a setuid executable that links in libdw. + $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \ + -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ + -Wl,--version-script,$<,--no-undefined \ + -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ + -ldl + if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ln -fs $@ $@.$(VERSION) - %.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ rm -f "$(DEPDIR)/$*.Tpo"; \ @@ -93,8 +124,10 @@ uninstall: uninstall-am rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils endif +libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a)) + noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h EXTRA_DIST = libdw.map -CLEANFILES = $(am_libdw_pic_a_OBJECTS) +CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) diff --git a/libdw/Makefile.in b/libdw/Makefile.in index 9ceb5d51..abf9f7cd 100644 --- a/libdw/Makefile.in +++ b/libdw/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -16,17 +16,11 @@ -SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) $(libdw_so_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -40,20 +34,19 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@BUILD_STATIC_TRUE@am__append_1 = -fpic @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) @MUDFLAP_TRUE@am_libdw_pic_a_OBJECTS = subdir = libdw -DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) \ - $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - ChangeLog +DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ + $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -62,14 +55,15 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" \ - "$(DESTDIR)$(includedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(pkgincludedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libdw_a_AR = $(AR) $(ARFLAGS) -libdw_a_LIBADD = +libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(shell $(AR) t \ + ../libdwfl/libdwfl.a)) am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ dwarf_end.$(OBJEXT) dwarf_getelf.$(OBJEXT) \ dwarf_getpubnames.$(OBJEXT) dwarf_getabbrev.$(OBJEXT) \ @@ -77,12 +71,16 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ dwarf_nextcu.$(OBJEXT) dwarf_diename.$(OBJEXT) \ dwarf_offdie.$(OBJEXT) dwarf_attr.$(OBJEXT) \ dwarf_formstring.$(OBJEXT) dwarf_abbrev_hash.$(OBJEXT) \ - dwarf_child.$(OBJEXT) dwarf_haschildren.$(OBJEXT) \ - dwarf_formaddr.$(OBJEXT) dwarf_formudata.$(OBJEXT) \ - dwarf_formsdata.$(OBJEXT) dwarf_lowpc.$(OBJEXT) \ - dwarf_highpc.$(OBJEXT) dwarf_formref.$(OBJEXT) \ - dwarf_siblingof.$(OBJEXT) dwarf_dieoffset.$(OBJEXT) \ - dwarf_cuoffset.$(OBJEXT) dwarf_hasattr.$(OBJEXT) \ + dwarf_attr_integrate.$(OBJEXT) \ + dwarf_hasattr_integrate.$(OBJEXT) dwarf_child.$(OBJEXT) \ + dwarf_haschildren.$(OBJEXT) dwarf_formaddr.$(OBJEXT) \ + dwarf_formudata.$(OBJEXT) dwarf_formsdata.$(OBJEXT) \ + dwarf_lowpc.$(OBJEXT) dwarf_entrypc.$(OBJEXT) \ + dwarf_haspc.$(OBJEXT) dwarf_highpc.$(OBJEXT) \ + dwarf_ranges.$(OBJEXT) dwarf_formref.$(OBJEXT) \ + dwarf_formref_die.$(OBJEXT) dwarf_siblingof.$(OBJEXT) \ + dwarf_dieoffset.$(OBJEXT) dwarf_cuoffset.$(OBJEXT) \ + dwarf_diecu.$(OBJEXT) dwarf_hasattr.$(OBJEXT) \ dwarf_hasform.$(OBJEXT) dwarf_whatform.$(OBJEXT) \ dwarf_whatattr.$(OBJEXT) dwarf_bytesize.$(OBJEXT) \ dwarf_arrayorder.$(OBJEXT) dwarf_bitsize.$(OBJEXT) \ @@ -90,20 +88,29 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ dwarf_getabbrevtag.$(OBJEXT) dwarf_getabbrevcode.$(OBJEXT) \ dwarf_abbrevhaschildren.$(OBJEXT) dwarf_getattrcnt.$(OBJEXT) \ dwarf_getabbrevattr.$(OBJEXT) dwarf_getsrclines.$(OBJEXT) \ - dwarf_getsrc_die.$(OBJEXT) dwarf_linesrc.$(OBJEXT) \ - dwarf_lineno.$(OBJEXT) dwarf_lineaddr.$(OBJEXT) \ - dwarf_linecol.$(OBJEXT) dwarf_linebeginstatement.$(OBJEXT) \ + dwarf_getsrc_die.$(OBJEXT) dwarf_getscopes.$(OBJEXT) \ + dwarf_getscopes_die.$(OBJEXT) dwarf_getscopevar.$(OBJEXT) \ + dwarf_linesrc.$(OBJEXT) dwarf_lineno.$(OBJEXT) \ + dwarf_lineaddr.$(OBJEXT) dwarf_linecol.$(OBJEXT) \ + dwarf_linebeginstatement.$(OBJEXT) \ dwarf_lineendsequence.$(OBJEXT) dwarf_lineblock.$(OBJEXT) \ dwarf_lineprologueend.$(OBJEXT) \ dwarf_lineepiloguebegin.$(OBJEXT) dwarf_onesrcline.$(OBJEXT) \ dwarf_formblock.$(OBJEXT) dwarf_getsrcfiles.$(OBJEXT) \ - dwarf_filesrc.$(OBJEXT) dwarf_getloclist.$(OBJEXT) \ - dwarf_getstring.$(OBJEXT) dwarf_offabbrev.$(OBJEXT) \ - dwarf_getaranges.$(OBJEXT) dwarf_onearange.$(OBJEXT) \ - dwarf_getarangeinfo.$(OBJEXT) dwarf_getarange_addr.$(OBJEXT) \ - dwarf_getattrs.$(OBJEXT) dwarf_formflag.$(OBJEXT) \ - dwarf_getmacros.$(OBJEXT) libdw_findcu.$(OBJEXT) \ - libdw_form.$(OBJEXT) libdw_alloc.$(OBJEXT) + dwarf_filesrc.$(OBJEXT) dwarf_getsrcdirs.$(OBJEXT) \ + dwarf_getlocation.$(OBJEXT) dwarf_getstring.$(OBJEXT) \ + dwarf_offabbrev.$(OBJEXT) dwarf_getaranges.$(OBJEXT) \ + dwarf_onearange.$(OBJEXT) dwarf_getarangeinfo.$(OBJEXT) \ + dwarf_getarange_addr.$(OBJEXT) dwarf_getattrs.$(OBJEXT) \ + dwarf_formflag.$(OBJEXT) dwarf_getmacros.$(OBJEXT) \ + dwarf_macro_opcode.$(OBJEXT) dwarf_macro_param1.$(OBJEXT) \ + dwarf_macro_param2.$(OBJEXT) dwarf_addrdie.$(OBJEXT) \ + dwarf_getfuncs.$(OBJEXT) dwarf_decl_file.$(OBJEXT) \ + dwarf_decl_line.$(OBJEXT) dwarf_decl_column.$(OBJEXT) \ + dwarf_func_inline.$(OBJEXT) dwarf_getsrc_file.$(OBJEXT) \ + libdw_findcu.$(OBJEXT) libdw_form.$(OBJEXT) \ + libdw_alloc.$(OBJEXT) memory-access.$(OBJEXT) \ + libdw_visit_scopes.$(OBJEXT) dwarf_entry_breakpoints.$(OBJEXT) libdw_a_OBJECTS = $(am_libdw_a_OBJECTS) libdw_pic_a_AR = $(AR) $(ARFLAGS) libdw_pic_a_LIBADD = @@ -113,7 +120,7 @@ PROGRAMS = $(noinst_PROGRAMS) am_libdw_so_OBJECTS = libdw_so_OBJECTS = $(am_libdw_so_OBJECTS) libdw_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -124,15 +131,13 @@ SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \ $(libdw_so_SOURCES) DIST_SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \ $(libdw_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) includeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -141,43 +146,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -186,7 +187,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -194,12 +194,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -212,73 +214,101 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -std=gnu99 -@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ +@MUDFLAP_FALSE@ -Wunused -Wformat=2 -Wextra -std=gnu99 +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Werror \ +@MUDFLAP_TRUE@ -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + lib_LIBRARIES = libdw.a @MUDFLAP_FALSE@noinst_LIBRARIES = libdw_pic.a include_HEADERS = dwarf.h -euincludedir = ${includedir}/elfutils -euinclude_HEADERS = libdw.h +pkginclude_HEADERS = libdw.h libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \ dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \ dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \ + dwarf_attr_integrate.c dwarf_hasattr_integrate.c \ dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \ dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \ - dwarf_highpc.c dwarf_formref.c dwarf_siblingof.c \ - dwarf_dieoffset.c dwarf_cuoffset.c dwarf_hasattr.c \ - dwarf_hasform.c dwarf_whatform.c dwarf_whatattr.c \ + dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c dwarf_ranges.c \ + dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \ + dwarf_dieoffset.c dwarf_cuoffset.c dwarf_diecu.c \ + dwarf_hasattr.c dwarf_hasform.c \ + dwarf_whatform.c dwarf_whatattr.c \ dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \ dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \ dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \ dwarf_getattrcnt.c dwarf_getabbrevattr.c \ dwarf_getsrclines.c dwarf_getsrc_die.c \ + dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \ dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \ dwarf_linecol.c dwarf_linebeginstatement.c \ dwarf_lineendsequence.c dwarf_lineblock.c \ dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \ dwarf_onesrcline.c dwarf_formblock.c \ - dwarf_getsrcfiles.c dwarf_filesrc.c \ - dwarf_getloclist.c dwarf_getstring.c dwarf_offabbrev.c \ + dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \ + dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \ dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \ dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \ - dwarf_getmacros.c \ - libdw_findcu.c libdw_form.c libdw_alloc.c + dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \ + dwarf_macro_param2.c dwarf_addrdie.c \ + dwarf_getfuncs.c \ + dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \ + dwarf_func_inline.c dwarf_getsrc_file.c \ + libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \ + libdw_visit_scopes.c \ + dwarf_entry_breakpoints.c @MUDFLAP_FALSE@libdw_pic_a_SOURCES = @MUDFLAP_FALSE@am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) @MUDFLAP_FALSE@libdw_so_SOURCES = +libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a)) noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h EXTRA_DIST = libdw.map -CLEANFILES = $(am_libdw_pic_a_OBJECTS) +CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -303,13 +333,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -352,7 +382,7 @@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) @MUDFLAP_TRUE@libdw.so$(EXEEXT): $(libdw_so_OBJECTS) $(libdw_so_DEPENDENCIES) @MUDFLAP_TRUE@ @rm -f libdw.so$(EXEEXT) -@MUDFLAP_TRUE@ $(LINK) $(libdw_so_LDFLAGS) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS) +@MUDFLAP_TRUE@ $(LINK) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -362,8 +392,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_abbrev_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_abbrevhaschildren.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_addrdie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_arrayorder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_attr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_attr_integrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_begin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_begin_elf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_bitoffset.Po@am__quote@ @@ -371,18 +403,26 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_bytesize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_child.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cuoffset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_decl_column.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_decl_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_decl_line.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_diecu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_diename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_dieoffset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_end.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_entry_breakpoints.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_entrypc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_filesrc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formaddr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formblock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formflag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formref.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formref_die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formsdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formstring.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_formudata.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_func_inline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrevattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrevcode.Po@am__quote@ @@ -393,16 +433,24 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getattrcnt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getattrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getelf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getloclist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getfuncs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getlocation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getmacros.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getpubnames.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopes_die.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopevar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_die.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrcdirs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrcfiles.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrclines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getstring.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_hasattr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_hasattr_integrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_haschildren.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_hasform.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_haspc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_highpc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_lineaddr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_linebeginstatement.Po@am__quote@ @@ -414,11 +462,15 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_lineprologueend.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_linesrc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_lowpc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_opcode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_param1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_param2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_nextcu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_offabbrev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_offdie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_onearange.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_onesrcline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_ranges.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_siblingof.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_srclang.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_tag.Po@am__quote@ @@ -427,41 +479,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_findcu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_form.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_visit_scopes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory-access.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ @@ -476,14 +512,31 @@ uninstall-includeHEADERS: echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -495,8 +548,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -506,13 +559,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -526,22 +578,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -556,8 +607,8 @@ check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done @MUDFLAP_TRUE@install: install-am install-exec: install-exec-am @@ -605,14 +656,22 @@ info: info-am info-am: -install-data-am: install-euincludeHEADERS install-includeHEADERS +install-data-am: install-includeHEADERS install-pkgincludeHEADERS + +install-dvi: install-dvi-am install-exec-am: install-libLIBRARIES +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -632,33 +691,41 @@ ps: ps-am ps-am: -uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES +uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \ + uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ ctags distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-includeHEADERS install-info install-info-am \ - install-libLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-euincludeHEADERS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES - -@MUDFLAP_FALSE@libdw.so: libdw_pic.a $(srcdir)/libdw.map -@MUDFLAP_FALSE@ $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ -@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \ -@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z,defs \ -@MUDFLAP_FALSE@ ../libelf/libelf.so + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgincludeHEADERS install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLIBRARIES uninstall-pkgincludeHEADERS + +@MUDFLAP_FALSE@libdw.so: $(srcdir)/libdw.map libdw_pic.a \ +@MUDFLAP_FALSE@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \ +@MUDFLAP_FALSE@ ../libelf/libelf.so +# The rpath is necessary for libebl because its $ORIGIN use will +# not fly in a setuid executable that links in libdw. +@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \ +@MUDFLAP_FALSE@ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ +@MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \ +@MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ +@MUDFLAP_FALSE@ -ldl +@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi @MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION) @MUDFLAP_FALSE@%.os: %.c %.o -@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ +@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ @MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ @MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \ diff --git a/libdw/dwarf.h b/libdw/dwarf.h index 69be35a7..f1261c36 100644 --- a/libdw/dwarf.h +++ b/libdw/dwarf.h @@ -1,15 +1,51 @@ /* This file defines standard DWARF types, structures, and macros. - Copyright (C) 2000, 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _DWARF_H #define _DWARF_H 1 @@ -57,13 +93,24 @@ enum DW_TAG_namelist_item = 0x2c, DW_TAG_packed_type = 0x2d, DW_TAG_subprogram = 0x2e, - DW_TAG_template_type_param = 0x2f, - DW_TAG_template_value_param = 0x30, + DW_TAG_template_type_parameter = 0x2f, + DW_TAG_template_value_parameter = 0x30, DW_TAG_thrown_type = 0x31, DW_TAG_try_block = 0x32, DW_TAG_variant_part = 0x33, DW_TAG_variable = 0x34, DW_TAG_volatile_type = 0x35, + DW_TAG_dwarf_procedure = 0x36, + DW_TAG_restrict_type = 0x37, + DW_TAG_interface_type = 0x38, + DW_TAG_namespace = 0x39, + DW_TAG_imported_module = 0x3a, + DW_TAG_unspecified_type = 0x3b, + DW_TAG_partial_unit = 0x3c, + DW_TAG_imported_unit = 0x3d, + DW_TAG_mutable_type = 0x3e, + DW_TAG_condition = 0x3f, + DW_TAG_shared_type = 0x40, DW_TAG_lo_user = 0x4080, DW_TAG_MIPS_loop = 0x4081, DW_TAG_format_label = 0x4101, @@ -115,7 +162,7 @@ enum DW_AT_prototyped = 0x27, DW_AT_return_addr = 0x2a, DW_AT_start_scope = 0x2c, - DW_AT_stride_size = 0x2e, + DW_AT_bit_stride = 0x2e, DW_AT_upper_bound = 0x2f, DW_AT_abstract_origin = 0x31, DW_AT_accessibility = 0x32, @@ -136,7 +183,7 @@ enum DW_AT_friend = 0x41, DW_AT_identifier_case = 0x42, DW_AT_macro_info = 0x43, - DW_AT_namelist_items = 0x44, + DW_AT_namelist_item = 0x44, DW_AT_priority = 0x45, DW_AT_segment = 0x46, DW_AT_specification = 0x47, @@ -146,6 +193,34 @@ enum DW_AT_variable_parameter = 0x4b, DW_AT_virtuality = 0x4c, DW_AT_vtable_elem_location = 0x4d, + DW_AT_allocated = 0x4e, + DW_AT_associated = 0x4f, + DW_AT_data_location = 0x50, + DW_AT_byte_stride = 0x51, + DW_AT_entry_pc = 0x52, + DW_AT_use_UTF8 = 0x53, + DW_AT_extension = 0x54, + DW_AT_ranges = 0x55, + DW_AT_trampoline = 0x56, + DW_AT_call_column = 0x57, + DW_AT_call_file = 0x58, + DW_AT_call_line = 0x59, + DW_AT_description = 0x5a, + DW_AT_binary_scale = 0x5b, + DW_AT_decimal_scale = 0x5c, + DW_AT_small = 0x5d, + DW_AT_decimal_sign = 0x5e, + DW_AT_digit_count = 0x5f, + DW_AT_picture_string = 0x60, + DW_AT_mutable = 0x61, + DW_AT_threads_scaled = 0x62, + DW_AT_explicit = 0x63, + DW_AT_object_pointer = 0x64, + DW_AT_endianity = 0x65, + DW_AT_elemental = 0x66, + DW_AT_pure = 0x67, + DW_AT_recursive = 0x68, + DW_AT_lo_user = 0x2000, DW_AT_MIPS_fde = 0x2001, DW_AT_MIPS_loop_begin = 0x2002, @@ -343,7 +418,7 @@ enum DW_OP_breg30 = 0x8e, /* Base register 30. */ DW_OP_breg31 = 0x8f, /* Base register 31. */ DW_OP_regx = 0x90, /* Unsigned LEB128 register. */ - DW_OP_fbreg = 0x91, /* Signed LEB128 register. */ + DW_OP_fbreg = 0x91, /* Signed LEB128 offset. */ DW_OP_bregx = 0x92, /* ULEB128 register followed by SLEB128 off. */ DW_OP_piece = 0x93, /* ULEB128 size of piece addressed. */ DW_OP_deref_size = 0x94, /* 1-byte size of data retrieved. */ @@ -353,6 +428,9 @@ enum DW_OP_call2 = 0x98, DW_OP_call4 = 0x99, DW_OP_call_ref = 0x9a, + DW_OP_form_tls_address = 0x9b,/* TLS offset to address in current thread */ + DW_OP_call_frame_cfa = 0x9c,/* CFA as determined by CFI. */ + DW_OP_bit_piece = 0x9d, /* ULEB128 size and ULEB128 offset in bits. */ DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */ DW_OP_hi_user = 0xff /* Implementation-defined range end. */ @@ -371,12 +449,42 @@ enum DW_ATE_signed_char = 0x6, DW_ATE_unsigned = 0x7, DW_ATE_unsigned_char = 0x8, + DW_ATE_imaginary_float = 0x9, + DW_ATE_packed_decimal = 0xa, + DW_ATE_numeric_string = 0xb, + DW_ATE_edited = 0xc, + DW_ATE_signed_fixed = 0xd, + DW_ATE_unsigned_fixed = 0xe, + DW_ATE_decimal_float = 0xf, DW_ATE_lo_user = 0x80, DW_ATE_hi_user = 0xff }; +/* DWARF decimal sign encodings. */ +enum + { + DW_DS_unsigned = 1, + DW_DS_leading_overpunch = 2, + DW_DS_trailing_overpunch = 3, + DW_DS_leading_separate = 4, + DW_DS_trailing_separate = 5, + }; + + +/* DWARF endianity encodings. */ +enum + { + DW_END_default = 0, + DW_END_big = 1, + DW_END_little = 2, + + DW_END_lo_user = 0x40, + DW_END_hi_user = 0xff + }; + + /* DWARF accessibility encodings. */ enum { @@ -422,6 +530,11 @@ enum DW_LANG_Ada95 = 0x000d, DW_LANG_Fortran95 = 0x000e, DW_LANG_PL1 = 0x000f, + DW_LANG_Objc = 0x0010, + DW_LANG_ObjC_plus_plus = 0x0011, + DW_LANG_UPC = 0x0012, + DW_LANG_D = 0x0013, + DW_LANG_lo_user = 0x8000, DW_LANG_Mips_Assembler = 0x8001, DW_LANG_hi_user = 0xffff @@ -488,16 +601,20 @@ enum DW_LNS_const_add_pc = 8, DW_LNS_fixed_advance_pc = 9, DW_LNS_set_prologue_end = 10, - DW_LNS_set_epilog_begin = 11 + DW_LNS_set_epilogue_begin = 11, + DW_LNS_set_isa = 12 }; -/* DWARF extended opcide encodings. */ +/* DWARF extended opcode encodings. */ enum { DW_LNE_end_sequence = 1, DW_LNE_set_address = 2, - DW_LNE_define_file = 3 + DW_LNE_define_file = 3, + + DW_LNE_lo_user = 128, + DW_LNE_hi_user = 255 }; @@ -540,6 +657,10 @@ enum DW_CFA_offset_extended_sf = 0x11, DW_CFA_def_cfa_sf = 0x12, DW_CFA_def_cfa_offset_sf = 0x13, + DW_CFA_val_offset = 0x14, + DW_CFA_val_offset_sf = 0x15, + DW_CFA_val_expression = 0x16, + DW_CFA_low_user = 0x1c, DW_CFA_MIPS_advance_loc8 = 0x1d, DW_CFA_GNU_window_save = 0x2d, @@ -551,4 +672,19 @@ enum /* DWARF XXX. */ #define DW_ADDR_none 0 +/* Section 7.2.2 of the DWARF3 specification defines a range of escape + codes that can appear in the length field of certain DWARF structures. + + These defines enumerate the minium and maximum values of this range. + Currently only the maximum value is used (to indicate that 64-bit + values are going to be used in the dwarf data that accompanies the + structure). The other values are reserved. + + Note: There is a typo in DWARF3 spec (published Dec 20, 2005). In + sections 7.4, 7.5.1, 7.19, 7.20 the minimum escape code is referred to + as 0xffffff00 whereas in fact it should be 0xfffffff0. */ +#define DWARF3_LENGTH_MIN_ESCAPE_CODE 0xfffffff0u +#define DWARF3_LENGTH_MAX_ESCAPE_CODE 0xffffffffu +#define DWARF3_LENGTH_64_BIT DWARF3_LENGTH_MAX_ESCAPE_CODE + #endif /* dwarf.h */ diff --git a/libdw/dwarf_abbrev_hash.c b/libdw/dwarf_abbrev_hash.c index 009e757f..5c5d6cb1 100644 --- a/libdw/dwarf_abbrev_hash.c +++ b/libdw/dwarf_abbrev_hash.c @@ -1,16 +1,52 @@ /* Implementation of hash table for DWARF .debug_abbrev section content. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_abbrev_hash.h b/libdw/dwarf_abbrev_hash.h index ef3cc48b..f124d166 100644 --- a/libdw/dwarf_abbrev_hash.h +++ b/libdw/dwarf_abbrev_hash.h @@ -1,16 +1,52 @@ /* Hash table for DWARF .debug_abbrev section content. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _DWARF_ABBREV_HASH_H #define _DWARF_ABBREV_HASH_H 1 diff --git a/libdw/dwarf_abbrevhaschildren.c b/libdw/dwarf_abbrevhaschildren.c index 2261b2f3..4e42a32b 100644 --- a/libdw/dwarf_abbrevhaschildren.c +++ b/libdw/dwarf_abbrevhaschildren.c @@ -1,16 +1,52 @@ /* Return true if abbreviation is children flag set. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_addrdie.c b/libdw/dwarf_addrdie.c new file mode 100644 index 00000000..84618721 --- /dev/null +++ b/libdw/dwarf_addrdie.c @@ -0,0 +1,75 @@ +/* Return CU DIE containing given address. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +Dwarf_Die * +dwarf_addrdie (dbg, addr, result) + Dwarf *dbg; + Dwarf_Addr addr; + Dwarf_Die *result; +{ + Dwarf_Aranges *aranges; + size_t naranges; + Dwarf_Off off; + + if (INTUSE(dwarf_getaranges) (dbg, &aranges, &naranges) != 0 + || INTUSE(dwarf_getarangeinfo) (INTUSE(dwarf_getarange_addr) (aranges, + addr), + NULL, NULL, &off) != 0) + return NULL; + + return INTUSE(dwarf_offdie) (dbg, off, result); +} diff --git a/libdw/dwarf_arrayorder.c b/libdw/dwarf_arrayorder.c index 072e70db..6d5a42d7 100644 --- a/libdw/dwarf_arrayorder.c +++ b/libdw/dwarf_arrayorder.c @@ -1,16 +1,52 @@ /* Return array order attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,7 @@ dwarf_arrayorder (die) Dwarf_Attribute attr_mem; Dwarf_Word value; - return dwarf_formudata (dwarf_attr (die, DW_AT_ordering, &attr_mem), - &value) == 0 ? (int) value : -1; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, DW_AT_ordering, + &attr_mem), + &value) == 0 ? (int) value : -1; } diff --git a/libdw/dwarf_attr.c b/libdw/dwarf_attr.c index a09f11ac..d3b03244 100644 --- a/libdw/dwarf_attr.c +++ b/libdw/dwarf_attr.c @@ -1,16 +1,52 @@ /* Return specific DWARF attribute of a DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -37,3 +73,4 @@ dwarf_attr (die, search_name, result) return result->code == search_name ? result : NULL; } +INTDEF(dwarf_attr) diff --git a/libdw/dwarf_attr_integrate.c b/libdw/dwarf_attr_integrate.c new file mode 100644 index 00000000..ce062f5b --- /dev/null +++ b/libdw/dwarf_attr_integrate.c @@ -0,0 +1,81 @@ +/* Return specific DWARF attribute of a DIE, integrating indirections. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + +Dwarf_Attribute * +dwarf_attr_integrate (Dwarf_Die *die, unsigned int search_name, + Dwarf_Attribute *result) +{ + Dwarf_Die die_mem; + + do + { + Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, search_name, result); + if (attr != NULL) + return attr; + + attr = INTUSE(dwarf_attr) (die, DW_AT_abstract_origin, result); + if (attr == NULL) + attr = INTUSE(dwarf_attr) (die, DW_AT_specification, result); + if (attr == NULL) + break; + + die = INTUSE(dwarf_formref_die) (attr, &die_mem); + } + while (die != NULL); + + return NULL; +} +INTDEF (dwarf_attr_integrate) diff --git a/libdw/dwarf_begin.c b/libdw/dwarf_begin.c index a2ffa1c6..77bdd778 100644 --- a/libdw/dwarf_begin.c +++ b/libdw/dwarf_begin.c @@ -1,16 +1,52 @@ /* Create descriptor from file descriptor for processing file. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -58,7 +94,9 @@ dwarf_begin (fd, cmd) /* Get an ELF descriptor. */ elf = elf_begin (fd, elfcmd, NULL); if (elf == NULL) + /* ANDROID_CHANGE_BEGIN */ { +#if 0 /* Test why the `elf_begin" call failed. */ struct stat64 st; @@ -68,11 +106,15 @@ dwarf_begin (fd, cmd) __libdw_seterrno (DWARF_E_INVALID_FILE); else __libdw_seterrno (DWARF_E_IO_ERROR); +#else + __libdw_seterrno (DWARF_E_IO_ERROR); +#endif + /* ANDROID_CHANGE_END */ } else { /* Do the real work now that we have an ELF descriptor. */ - result = dwarf_begin_elf (elf, cmd, NULL); + result = INTUSE(dwarf_begin_elf) (elf, cmd, NULL); /* If this failed, free the resources. */ if (result == NULL) diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index a9aa197c..aaac3999 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -1,16 +1,52 @@ /* Create descriptor from ELF descriptor for processing file. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -42,12 +78,13 @@ static const char dwarf_scnnames[IDX_last][17] = [IDX_debug_typenames] = ".debug_typenames", [IDX_debug_varnames] = ".debug_varnames", [IDX_debug_weaknames] = ".debug_weaknames", - [IDX_debug_macinfo] = ".debug_macinfo" + [IDX_debug_macinfo] = ".debug_macinfo", + [IDX_debug_ranges] = ".debug_ranges" }; #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0])) -static void +static Dwarf * check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) { GElf_Shdr shdr_mem; @@ -60,6 +97,11 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) wrong in the libelf library. */ abort (); + /* Ignore any SHT_NOBITS sections. Debugging sections should not + have been stripped, but in case of a corrupt file we won't try + to look at the missing data. */ + if (unlikely (shdr->sh_type == SHT_NOBITS)) + return result; /* Make sure the section is part of a section group only iff we really need it. If we are looking for the global (= non-section @@ -68,7 +110,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) a section which isn't part of the section group. */ if (! inscngrp && (shdr->sh_flags & SHF_GROUP) != 0) /* Ignore the section. */ - return; + return result; /* We recognize the DWARF section by their names. This is not very @@ -81,7 +123,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) invalid. */ __libdw_seterrno (DWARF_E_INVALID_ELF); free (result); - return; + return NULL; } @@ -103,6 +145,8 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) break; } + + return result; } @@ -116,9 +160,11 @@ valid_p (Dwarf *result) XXX Which sections are absolutely necessary? Add tests if necessary. For now we require only .debug_info. Hopefully this is correct. */ - if (unlikely (result->sectiondata[IDX_debug_info] == NULL)) + if (likely (result != NULL) + && unlikely (result->sectiondata[IDX_debug_info] == NULL)) { __libdw_seterrno (DWARF_E_NO_DWARF); + free (result); result = NULL; } @@ -127,20 +173,19 @@ valid_p (Dwarf *result) static Dwarf * -global_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd) +global_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr) { Elf_Scn *scn = NULL; - while ((scn = elf_nextscn (elf, scn)) != NULL) - check_section (result, ehdr, scn, false); + while (result != NULL && (scn = elf_nextscn (elf, scn)) != NULL) + result = check_section (result, ehdr, scn, false); return valid_p (result); } static Dwarf * -scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd, - Elf_Scn *scngrp) +scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp) { /* SCNGRP is the section descriptor for a section group which might contain debug sections. */ @@ -168,7 +213,9 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd, return NULL; } - check_section (result, ehdr, scn, true); + result = check_section (result, ehdr, scn, true); + if (result == NULL) + break; } return valid_p (result); @@ -234,9 +281,9 @@ dwarf_begin_elf (elf, cmd, scngrp) sections with the name are ignored. The DWARF specification does not really say this is allowed. */ if (scngrp == NULL) - return global_read (result, elf, ehdr, cmd); + return global_read (result, elf, ehdr); else - return scngrp_read (result, elf, ehdr, cmd, scngrp); + return scngrp_read (result, elf, ehdr, scngrp); } else if (cmd == DWARF_C_WRITE) { @@ -249,3 +296,4 @@ dwarf_begin_elf (elf, cmd, scngrp) free (result); return NULL; } +INTDEF(dwarf_begin_elf) diff --git a/libdw/dwarf_bitoffset.c b/libdw/dwarf_bitoffset.c index 6addbd72..235b7ee6 100644 --- a/libdw/dwarf_bitoffset.c +++ b/libdw/dwarf_bitoffset.c @@ -1,16 +1,52 @@ /* Return bit offset attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,7 @@ dwarf_bitoffset (die) Dwarf_Attribute attr_mem; Dwarf_Word value; - return dwarf_formudata (dwarf_attr (die, DW_AT_bit_offset, &attr_mem), - &value) == 0 ? (int) value : -1; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, DW_AT_bit_offset, + &attr_mem), + &value) == 0 ? (int) value : -1; } diff --git a/libdw/dwarf_bitsize.c b/libdw/dwarf_bitsize.c index 93688243..57d7fba0 100644 --- a/libdw/dwarf_bitsize.c +++ b/libdw/dwarf_bitsize.c @@ -1,16 +1,52 @@ /* Return bit size attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,7 @@ dwarf_bitsize (die) Dwarf_Attribute attr_mem; Dwarf_Word value; - return dwarf_formudata (dwarf_attr (die, DW_AT_bit_size, &attr_mem), - &value) == 0 ? (int) value : -1; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, DW_AT_bit_size, + &attr_mem), + &value) == 0 ? (int) value : -1; } diff --git a/libdw/dwarf_bytesize.c b/libdw/dwarf_bytesize.c index 8374676d..635a3c16 100644 --- a/libdw/dwarf_bytesize.c +++ b/libdw/dwarf_bytesize.c @@ -1,16 +1,52 @@ /* Return byte size attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,7 @@ dwarf_bytesize (die) Dwarf_Attribute attr_mem; Dwarf_Word value; - return dwarf_formudata (dwarf_attr (die, DW_AT_byte_size, &attr_mem), - &value) == 0 ? (int) value : -1; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, DW_AT_byte_size, + &attr_mem), + &value) == 0 ? (int) value : -1; } diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c index 0ccac099..0080cf9d 100644 --- a/libdw/dwarf_child.c +++ b/libdw/dwarf_child.c @@ -1,16 +1,52 @@ -/* Return vhild of current DIE. - Copyright (C) 2003, 2004 Red Hat, Inc. +/* Return child of current DIE. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,12 +60,12 @@ unsigned char * -internal_function_def +internal_function __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, unsigned int *codep, unsigned int *formp) { Dwarf *dbg = die->cu->dbg; - unsigned char *readp = (unsigned char *) die->addr; + const unsigned char *readp = (unsigned char *) die->addr; /* First we have to get the abbreviation code so that we can decode the data in the DIE. */ @@ -41,10 +77,11 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, if (abbrevp == NULL) { abbrevp = __libdw_findabbrev (die->cu, abbrev_code); - die->abbrev = abbrevp ?: (Dwarf_Abbrev *) -1l; + die->abbrev = abbrevp ?: DWARF_END_ABBREV; } - if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l)) + if (unlikely (die->abbrev == DWARF_END_ABBREV)) { + invalid_dwarf: __libdw_seterrno (DWARF_E_INVALID_DWARF); return NULL; } @@ -54,15 +91,12 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, = ((unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf + dbg->sectiondata[IDX_debug_abbrev]->d_size); - unsigned char *attrp = die->abbrev->attrp; + const unsigned char *attrp = die->abbrev->attrp; while (1) { /* Are we still in bounds? This test needs to be refined. */ if (unlikely (attrp + 1 >= endp)) - { - __libdw_seterrno (DWARF_E_INVALID_DWARF); - return NULL; - } + goto invalid_dwarf; /* Get attribute name and form. @@ -85,7 +119,7 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, if (formp != NULL) *formp = attr_form; - return readp; + return (unsigned char *) readp; } /* Skip over the rest of this attribute (if there is any). */ @@ -110,7 +144,7 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, if (formp != NULL) *formp = INVALID; - return readp; + return (unsigned char *) readp; } @@ -127,10 +161,10 @@ dwarf_child (die, result) void *addr = NULL; /* If we already know there are no children do not search. */ - if (die->abbrev != (Dwarf_Abbrev *) -1 + if (die->abbrev != DWARF_END_ABBREV && (die->abbrev == NULL || die->abbrev->has_children)) addr = __libdw_find_attr (die, INVALID, NULL, NULL); - if (die->abbrev == (Dwarf_Abbrev *) -1l) + if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l)) return -1; /* Make sure the DIE really has children. */ @@ -141,6 +175,15 @@ dwarf_child (die, result) if (addr == NULL) return -1; + /* It's kosher (just suboptimal) to have a null entry first thing (7.5.3). + So if this starts with ULEB128 of 0 (even with silly encoding of 0), + it is a kosher null entry and we do not really have any children. */ + const unsigned char *code = addr; + while (unlikely (*code == 0x80)) + ++code; + if (unlikely (*code == '\0')) + return 1; + /* RESULT can be the same as DIE. So preserve what we need. */ struct Dwarf_CU *cu = die->cu; @@ -156,3 +199,4 @@ dwarf_child (die, result) return 0; } +INTDEF(dwarf_child) diff --git a/libdw/dwarf_cuoffset.c b/libdw/dwarf_cuoffset.c index f3adfa83..10238b43 100644 --- a/libdw/dwarf_cuoffset.c +++ b/libdw/dwarf_cuoffset.c @@ -1,16 +1,52 @@ /* Return offset of DIE in CU. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_decl_column.c b/libdw/dwarf_decl_column.c new file mode 100644 index 00000000..5e0f3e0c --- /dev/null +++ b/libdw/dwarf_decl_column.c @@ -0,0 +1,63 @@ +/* Get column number of beginning of given declaration. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + + +int +dwarf_decl_column (Dwarf_Die *decl, int *colp) +{ + return __libdw_attr_intval (decl, colp, DW_AT_decl_column); +} diff --git a/libdw/dwarf_decl_file.c b/libdw/dwarf_decl_file.c new file mode 100644 index 00000000..b1d62df2 --- /dev/null +++ b/libdw/dwarf_decl_file.c @@ -0,0 +1,107 @@ +/* Return file name containing definition of the given function. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> +#include "libdwP.h" + + +const char * +dwarf_decl_file (Dwarf_Die *die) +{ + Dwarf_Attribute attr_mem; + Dwarf_Sword idx = 0; + + if (INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (die, DW_AT_decl_file, + &attr_mem), &idx) != 0) + return NULL; + + /* Zero means no source file information available. */ + if (idx == 0) + { + __libdw_seterrno (DWARF_E_NO_ENTRY); + return NULL; + } + + /* Get the array of source files for the CU. */ + struct Dwarf_CU *cu = die->cu; + if (cu->lines == NULL) + { + Dwarf_Lines *lines; + size_t nlines; + + /* Let the more generic function do the work. It'll create more + data but that will be needed in an real program anyway. */ + (void) INTUSE(dwarf_getsrclines) (&CUDIE (cu), &lines, &nlines); + assert (cu->lines != NULL); + } + + if (cu->lines == (void *) -1l) + { + /* If the file index is not zero, there must be file information + available. */ + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + + assert (cu->files != NULL && cu->files != (void *) -1l); + + if (idx >= cu->files->nfiles) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + + return cu->files->info[idx].name; +} diff --git a/libdw/dwarf_decl_line.c b/libdw/dwarf_decl_line.c new file mode 100644 index 00000000..b4e3c42e --- /dev/null +++ b/libdw/dwarf_decl_line.c @@ -0,0 +1,83 @@ +/* Get line number of beginning of given function. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> +#include <limits.h> +#include "libdwP.h" + + +int +dwarf_decl_line (Dwarf_Die *func, int *linep) +{ + return __libdw_attr_intval (func, linep, DW_AT_decl_line); +} + + +int internal_function +__libdw_attr_intval (Dwarf_Die *die, int *linep, int attval) +{ + Dwarf_Attribute attr_mem; + Dwarf_Sword line; + + int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (die, attval, + &attr_mem), &line); + if (res == 0) + { + assert (line >= 0 && line <= INT_MAX); + *linep = line; + } + + return res; +} diff --git a/libdw/dwarf_diecu.c b/libdw/dwarf_diecu.c new file mode 100644 index 00000000..a62b8222 --- /dev/null +++ b/libdw/dwarf_diecu.c @@ -0,0 +1,83 @@ +/* Return CU DIE containing given DIE. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include "libdwP.h" + + +Dwarf_Die * +dwarf_diecu (die, result, address_sizep, offset_sizep) + Dwarf_Die *die; + Dwarf_Die *result; + uint8_t *address_sizep; + uint8_t *offset_sizep; +{ + if (die == NULL) + return NULL; + + /* Clear the entire DIE structure. This signals we have not yet + determined any of the information. */ + memset (result, '\0', sizeof (Dwarf_Die)); + + result->addr = ((char *) die->cu->dbg->sectiondata[IDX_debug_info]->d_buf + + DIE_OFFSET_FROM_CU_OFFSET (die->cu->start, + die->cu->offset_size)); + result->cu = die->cu; + + if (address_sizep != NULL) + *address_sizep = die->cu->address_size; + if (offset_sizep != NULL) + *offset_sizep = die->cu->offset_size; + + return result; +} diff --git a/libdw/dwarf_diename.c b/libdw/dwarf_diename.c index 78555dc3..3b66d12e 100644 --- a/libdw/dwarf_diename.c +++ b/libdw/dwarf_diename.c @@ -1,16 +1,52 @@ /* Return string in name attribute of DIE. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -26,5 +62,8 @@ dwarf_diename (die) { Dwarf_Attribute attr_mem; - return dwarf_formstring (dwarf_attr (die, DW_AT_name, &attr_mem)); + return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr_integrate) (die, + DW_AT_name, + &attr_mem)); } +INTDEF (dwarf_diename) diff --git a/libdw/dwarf_dieoffset.c b/libdw/dwarf_dieoffset.c index 2657c223..4d712f7f 100644 --- a/libdw/dwarf_dieoffset.c +++ b/libdw/dwarf_dieoffset.c @@ -1,16 +1,52 @@ /* Return offset of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -25,6 +61,8 @@ dwarf_dieoffset (die) Dwarf_Die *die; { return (die == NULL - ? -1l - : die->addr - die->cu->dbg->sectiondata[IDX_debug_info]->d_buf); + ? ~0ul + : (Dwarf_Off) (die->addr + - die->cu->dbg->sectiondata[IDX_debug_info]->d_buf)); } +INTDEF(dwarf_dieoffset) diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 0745d717..60c9716e 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -1,16 +1,52 @@ /* Release debugging handling context. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,7 +60,7 @@ static void -noop_free (void *arg) +noop_free (void *arg __attribute__ ((unused))) { } @@ -73,3 +109,4 @@ dwarf_end (dwarf) return 0; } +INTDEF(dwarf_end) diff --git a/libdw/dwarf_entry_breakpoints.c b/libdw/dwarf_entry_breakpoints.c new file mode 100644 index 00000000..578464f3 --- /dev/null +++ b/libdw/dwarf_entry_breakpoints.c @@ -0,0 +1,178 @@ +/* Find entry breakpoint locations for a function. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include "libdwP.h" +#include <dwarf.h> +#include <stdlib.h> + + +int +dwarf_entry_breakpoints (die, bkpts) + Dwarf_Die *die; + Dwarf_Addr **bkpts; +{ + int nbkpts = 0; + *bkpts = NULL; + + /* Add one breakpoint location to the result vector. */ + inline int add_bkpt (Dwarf_Addr pc) + { + Dwarf_Addr *newlist = realloc (*bkpts, ++nbkpts * sizeof newlist[0]); + if (newlist == NULL) + { + free (*bkpts); + *bkpts = NULL; + __libdw_seterrno (DWARF_E_NOMEM); + return -1; + } + newlist[nbkpts - 1] = pc; + *bkpts = newlist; + return nbkpts; + } + + /* Fallback result, break at the entrypc/lowpc value. */ + inline int entrypc_bkpt (void) + { + Dwarf_Addr pc; + return INTUSE(dwarf_entrypc) (die, &pc) < 0 ? -1 : add_bkpt (pc); + } + + /* Fetch the CU's line records to look for this DIE's addresses. */ + Dwarf_Die cudie = CUDIE (die->cu); + Dwarf_Lines *lines; + size_t nlines; + if (INTUSE(dwarf_getsrclines) (&cudie, &lines, &nlines) < 0) + { + int error = INTUSE (dwarf_errno) (); + if (error == DWARF_E_NO_DEBUG_LINE) + return entrypc_bkpt (); + __libdw_seterrno (error); + return -1; + } + + /* Search a contiguous PC range for prologue-end markers. + If DWARF, look for proper markers. + Failing that, if ADHOC, look for the ad hoc convention. */ + inline int search_range (Dwarf_Addr low, Dwarf_Addr high, + bool dwarf, bool adhoc) + { + size_t l = 0, u = nlines; + while (l < u) + { + size_t idx = (l + u) / 2; + if (lines->info[idx].addr < low) + l = idx + 1; + else if (lines->info[idx].addr > low) + u = idx; + else if (lines->info[idx].end_sequence) + l = idx + 1; + else + { + l = idx; + break; + } + } + if (l < u) + { + if (dwarf) + for (size_t i = l; i < u && lines->info[i].addr < high; ++i) + if (lines->info[i].prologue_end + && add_bkpt (lines->info[i].addr) < 0) + return -1; + if (adhoc && nbkpts == 0) + while (++l < nlines && lines->info[l].addr < high) + if (!lines->info[l].end_sequence) + return add_bkpt (lines->info[l].addr); + return nbkpts; + } + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + + /* Search each contiguous address range for DWARF prologue_end markers. */ + + Dwarf_Addr base; + Dwarf_Addr begin; + Dwarf_Addr end; + ptrdiff_t offset = INTUSE(dwarf_ranges) (die, 0, &base, &begin, &end); + if (offset < 0) + return -1; + + /* Most often there is a single contiguous PC range for the DIE. */ + if (offset == 1) + return search_range (begin, end, true, true) ?: entrypc_bkpt (); + + Dwarf_Addr lowpc = (Dwarf_Addr) -1l; + Dwarf_Addr highpc = (Dwarf_Addr) -1l; + while (offset > 0) + { + /* We have an address range entry. */ + if (search_range (begin, end, true, false) < 0) + return -1; + + if (begin < lowpc) + { + lowpc = begin; + highpc = end; + } + + offset = INTUSE(dwarf_ranges) (die, offset, &base, &begin, &end); + } + + /* If we didn't find any proper DWARF markers, then look in the + lowest-addressed range for an ad hoc marker. Failing that, + fall back to just using the entrypc value. */ + return (nbkpts + ?: (lowpc == (Dwarf_Addr) -1l ? 0 + : search_range (lowpc, highpc, false, true)) + ?: entrypc_bkpt ()); +} diff --git a/libdw/dwarf_entrypc.c b/libdw/dwarf_entrypc.c new file mode 100644 index 00000000..1719be27 --- /dev/null +++ b/libdw/dwarf_entrypc.c @@ -0,0 +1,71 @@ +/* Return entry PC attribute of DIE. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + + +int +dwarf_entrypc (die, return_addr) + Dwarf_Die *die; + Dwarf_Addr *return_addr; +{ + Dwarf_Attribute attr_mem; + + return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_entry_pc, + &attr_mem) + ?: INTUSE(dwarf_attr) (die, DW_AT_low_pc, + &attr_mem), + return_addr); +} +INTDEF(dwarf_entrypc) diff --git a/libdw/dwarf_error.c b/libdw/dwarf_error.c index fe8966ee..fe916641 100644 --- a/libdw/dwarf_error.c +++ b/libdw/dwarf_error.c @@ -1,16 +1,52 @@ /* Retrieve ELF descriptor used for DWARF access. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,7 +60,7 @@ #ifdef USE_TLS /* The error number. */ -static int global_error; +static __thread int global_error; #else /* This is the key for the thread specific memory. */ static tls_key_t key; @@ -65,6 +101,7 @@ dwarf_errno (void) global_error = DWARF_E_NOERROR; return result; } +INTDEF(dwarf_errno) /* XXX For now we use string pointers. Once the table stablelizes @@ -104,6 +141,8 @@ static const char *errmsgs[] = [DWARF_E_INVALID_ARANGE_IDX] = N_("invalid address range index"), [DWARF_E_NO_MATCH] = N_("no matching address range"), [DWARF_E_NO_FLAG] = N_("no flag value"), + [DWARF_E_INVALID_OFFSET] = N_("invalid offset"), + [DWARF_E_NO_DEBUG_RANGES] = N_(".debug_ranges section missing"), }; #define nerrmsgs (sizeof (errmsgs) / sizeof (errmsgs[0])) @@ -152,12 +191,13 @@ dwarf_errmsg (error) return _(errmsgs[error == -1 ? last_error : error]); } +INTDEF(dwarf_errmsg) #ifndef USE_TLS /* Free the thread specific data, this is done if a thread terminates. */ static void -free_key_mem (void *mem) +free_key_mem (void *mem __attribute__ ((unused))) { setspecific (key, NULL); } diff --git a/libdw/dwarf_filesrc.c b/libdw/dwarf_filesrc.c index 770c004b..b48340d4 100644 --- a/libdw/dwarf_filesrc.c +++ b/libdw/dwarf_filesrc.c @@ -1,16 +1,52 @@ /* Find source file information. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_formaddr.c b/libdw/dwarf_formaddr.c index 4e8cdb0b..dcb58d43 100644 --- a/libdw/dwarf_formaddr.c +++ b/libdw/dwarf_formaddr.c @@ -1,16 +1,52 @@ /* Return address represented by attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -41,3 +77,4 @@ dwarf_formaddr (attr, return_addr) return 0; } +INTDEF(dwarf_formaddr) diff --git a/libdw/dwarf_formblock.c b/libdw/dwarf_formblock.c index 08566829..51396d47 100644 --- a/libdw/dwarf_formblock.c +++ b/libdw/dwarf_formblock.c @@ -1,16 +1,52 @@ /* Return block represented by attribute. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -28,8 +64,7 @@ dwarf_formblock (attr, return_block) if (attr == NULL) return -1; - unsigned int u128; - unsigned char *datap; + const unsigned char *datap; switch (attr->form) { @@ -50,9 +85,8 @@ dwarf_formblock (attr, return_block) case DW_FORM_block: datap = attr->valp; - get_uleb128 (u128, datap); - return_block->length = u128; - return_block->data = datap; + get_uleb128 (return_block->length, datap); + return_block->data = (unsigned char *) datap; break; default: @@ -71,3 +105,4 @@ dwarf_formblock (attr, return_block) return 0; } +INTDEF(dwarf_formblock) diff --git a/libdw/dwarf_formflag.c b/libdw/dwarf_formflag.c index ac344019..4e57c3af 100644 --- a/libdw/dwarf_formflag.c +++ b/libdw/dwarf_formflag.c @@ -1,16 +1,52 @@ /* Return flag represented by attribute. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_formref.c b/libdw/dwarf_formref.c index d6b1f0f6..b8463b70 100644 --- a/libdw/dwarf_formref.c +++ b/libdw/dwarf_formref.c @@ -1,16 +1,52 @@ /* Return reference offset represented by attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -19,17 +55,18 @@ #include <dwarf.h> #include "libdwP.h" - int -dwarf_formref (attr, return_offset) +__libdw_formref (attr, return_offset) Dwarf_Attribute *attr; Dwarf_Off *return_offset; { - if (attr == NULL) - return -1; + const unsigned char *datap; - unsigned int u128; - unsigned char *datap; + if (attr->valp == NULL) + { + __libdw_seterrno (DWARF_E_INVALID_REFERENCE); + return -1; + } switch (attr->form) { @@ -51,8 +88,7 @@ dwarf_formref (attr, return_offset) case DW_FORM_ref_udata: datap = attr->valp; - get_uleb128 (u128, datap); - *return_offset = u128; + get_uleb128 (*return_offset, datap); break; case DW_FORM_ref_addr: @@ -66,3 +102,16 @@ dwarf_formref (attr, return_offset) return 0; } + +/* This is the old public entry point. + It is now deprecated in favor of dwarf_formref_die. */ +int +dwarf_formref (attr, return_offset) + Dwarf_Attribute *attr; + Dwarf_Off *return_offset; +{ + if (attr == NULL) + return -1; + + return __libdw_formref (attr, return_offset); +} diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c new file mode 100644 index 00000000..90a4b2d3 --- /dev/null +++ b/libdw/dwarf_formref_die.c @@ -0,0 +1,90 @@ +/* Look up the DIE in a reference-form attribute. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" +#include <dwarf.h> + + +Dwarf_Die * +dwarf_formref_die (attr, die_mem) + Dwarf_Attribute *attr; + Dwarf_Die *die_mem; +{ + if (attr == NULL) + return NULL; + + Dwarf_Off offset; + if (attr->form == DW_FORM_ref_addr) + { + /* This has an absolute offset. */ + + uint8_t ref_size = (attr->cu->version == 2 + ? attr->cu->address_size + : attr->cu->offset_size); + + if (ref_size == 8) + offset = read_8ubyte_unaligned (attr->cu->dbg, attr->valp); + else + offset = read_4ubyte_unaligned (attr->cu->dbg, attr->valp); + } + else + { + /* Other forms produce an offset from the CU. */ + if (unlikely (__libdw_formref (attr, &offset) != 0)) + return NULL; + offset += attr->cu->start; + } + + return INTUSE(dwarf_offdie) (attr->cu->dbg, offset, die_mem); +} +INTDEF (dwarf_formref_die) diff --git a/libdw/dwarf_formsdata.c b/libdw/dwarf_formsdata.c index ad845102..ab7249d1 100644 --- a/libdw/dwarf_formsdata.c +++ b/libdw/dwarf_formsdata.c @@ -1,16 +1,52 @@ /* Return signed constant represented by attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -28,8 +64,7 @@ dwarf_formsdata (attr, return_sval) if (attr == NULL) return -1; - unsigned int u128; - unsigned char *datap; + const unsigned char *datap; switch (attr->form) { @@ -51,14 +86,12 @@ dwarf_formsdata (attr, return_sval) case DW_FORM_sdata: datap = attr->valp; - get_sleb128 (u128, datap); - *return_sval = u128; + get_sleb128 (*return_sval, datap); break; case DW_FORM_udata: datap = attr->valp; - get_uleb128 (u128, datap); - *return_sval = u128; + get_uleb128 (*return_sval, datap); break; default: @@ -68,3 +101,4 @@ dwarf_formsdata (attr, return_sval) return 0; } +INTDEF(dwarf_formsdata) diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c index c4e59d78..790831ea 100644 --- a/libdw/dwarf_formstring.c +++ b/libdw/dwarf_formstring.c @@ -1,16 +1,52 @@ /* Return string associated with given attribute. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -55,3 +91,4 @@ dwarf_formstring (attrp) return (const char *) dbg->sectiondata[IDX_debug_str]->d_buf + off; } +INTDEF(dwarf_formstring) diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c index 66b8c2a3..b5c40bb5 100644 --- a/libdw/dwarf_formudata.c +++ b/libdw/dwarf_formudata.c @@ -1,16 +1,52 @@ /* Return unsigned constant represented by attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -28,8 +64,7 @@ dwarf_formudata (attr, return_uval) if (attr == NULL) return -1; - unsigned int u128; - unsigned char *datap; + const unsigned char *datap; switch (attr->form) { @@ -51,14 +86,12 @@ dwarf_formudata (attr, return_uval) case DW_FORM_sdata: datap = attr->valp; - get_sleb128 (u128, datap); - *return_uval = u128; + get_sleb128 (*return_uval, datap); break; case DW_FORM_udata: datap = attr->valp; - get_uleb128 (u128, datap); - *return_uval = u128; + get_uleb128 (*return_uval, datap); break; default: @@ -68,3 +101,4 @@ dwarf_formudata (attr, return_uval) return 0; } +INTDEF(dwarf_formudata) diff --git a/libdw/dwarf_func_inline.c b/libdw/dwarf_func_inline.c new file mode 100644 index 00000000..6018691a --- /dev/null +++ b/libdw/dwarf_func_inline.c @@ -0,0 +1,121 @@ +/* Convenience functions for handling DWARF descriptions of inline functions. + Copyright (C) 2005,2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" +#include <dwarf.h> + +struct visitor_info +{ + void *die_addr; + int (*callback) (Dwarf_Die *, void *); + void *arg; +}; + +static int +scope_visitor (unsigned int depth __attribute__ ((unused)), + struct Dwarf_Die_Chain *die, void *arg) +{ + struct visitor_info *const v = arg; + + if (INTUSE(dwarf_tag) (&die->die) != DW_TAG_inlined_subroutine) + return DWARF_CB_OK; + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&die->die, DW_AT_abstract_origin, + &attr_mem); + if (attr == NULL) + return DWARF_CB_OK; + + Dwarf_Die origin_mem; + Dwarf_Die *origin = INTUSE(dwarf_formref_die) (attr, &origin_mem); + if (origin == NULL) + return DWARF_CB_ABORT; + + if (origin->addr != v->die_addr) + return DWARF_CB_OK; + + return (*v->callback) (&die->die, v->arg); +} + +int +dwarf_func_inline (Dwarf_Die *func) +{ + Dwarf_Attribute attr_mem; + Dwarf_Word val; + if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (func, DW_AT_inline, + &attr_mem), + &val) == 0) + switch (val) + { + case DW_INL_not_inlined: + return 0; + + case DW_INL_declared_not_inlined: + return -1; + + case DW_INL_inlined: + case DW_INL_declared_inlined: + return 1; + } + + return 0; +} + +int +dwarf_func_inline_instances (Dwarf_Die *func, + int (*callback) (Dwarf_Die *, void *), + void *arg) +{ + struct visitor_info v = { func->addr, callback, arg }; + struct Dwarf_Die_Chain cu = { .die = CUDIE (func->cu), .parent = NULL }; + return __libdw_visit_scopes (0, &cu, &scope_visitor, NULL, &v); +} diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c index 0021e222..07bf6dfc 100644 --- a/libdw/dwarf_getabbrev.c +++ b/libdw/dwarf_getabbrev.c @@ -1,16 +1,52 @@ /* Get abbreviation at given offset. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -22,7 +58,7 @@ Dwarf_Abbrev * -internal_function_def +internal_function __libdw_getabbrev (dbg, cu, offset, lengthp, result) Dwarf *dbg; struct Dwarf_CU *cu; @@ -34,11 +70,18 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result) if (dbg->sectiondata[IDX_debug_abbrev] == NULL) return NULL; - unsigned char *abbrevp + if (offset >= dbg->sectiondata[IDX_debug_abbrev]->d_size) + { + __libdw_seterrno (DWARF_E_INVALID_OFFSET); + return NULL; + } + + const unsigned char *abbrevp = (unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf + offset; + if (*abbrevp == '\0') /* We are past the last entry. */ - return NULL; + return DWARF_END_ABBREV; /* 7.5.3 Abbreviations Tables @@ -56,7 +99,7 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result) consists of two parts. The first part is an unsigned LEB128 number representing the attribute's name. The second part is an unsigned LEB128 number representing the attribute's form. */ - unsigned char *start_abbrevp = abbrevp; + const unsigned char *start_abbrevp = abbrevp; unsigned int code; get_uleb128 (code, abbrevp); @@ -88,7 +131,7 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result) abb->code = code; get_uleb128 (abb->tag, abbrevp); abb->has_children = *abbrevp++ == DW_CHILDREN_yes; - abb->attrp = abbrevp; + abb->attrp = (unsigned char *) abbrevp; abb->offset = offset; /* Skip over all the attributes and count them while doing so. */ diff --git a/libdw/dwarf_getabbrevattr.c b/libdw/dwarf_getabbrevattr.c index d9337aac..05da17c9 100644 --- a/libdw/dwarf_getabbrevattr.c +++ b/libdw/dwarf_getabbrevattr.c @@ -1,16 +1,52 @@ /* Get specific attribute of abbreviation. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -33,8 +69,8 @@ dwarf_getabbrevattr (abbrev, idx, namep, formp, offsetp) return -1; size_t cnt = 0; - unsigned char *attrp = abbrev->attrp; - unsigned char *start_attrp; + const unsigned char *attrp = abbrev->attrp; + const unsigned char *start_attrp; unsigned int name; unsigned int form; diff --git a/libdw/dwarf_getabbrevcode.c b/libdw/dwarf_getabbrevcode.c index ef3dac46..edf492d8 100644 --- a/libdw/dwarf_getabbrevcode.c +++ b/libdw/dwarf_getabbrevcode.c @@ -1,16 +1,52 @@ /* Get abbreviation code. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_getabbrevtag.c b/libdw/dwarf_getabbrevtag.c index 4707fdd1..4f1f72ca 100644 --- a/libdw/dwarf_getabbrevtag.c +++ b/libdw/dwarf_getabbrevtag.c @@ -1,16 +1,52 @@ /* Get abbreviation tag. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_getarange_addr.c b/libdw/dwarf_getarange_addr.c index df143d02..855c855b 100644 --- a/libdw/dwarf_getarange_addr.c +++ b/libdw/dwarf_getarange_addr.c @@ -1,16 +1,52 @@ /* Get address range which includes given address. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,11 +63,21 @@ dwarf_getarange_addr (aranges, addr) if (aranges == NULL) return NULL; - for (size_t cnt = 0; cnt < aranges->naranges; ++cnt) - if (aranges->info[cnt].addr <= addr - && addr < aranges->info[cnt].addr + aranges->info[cnt].length) - return &aranges->info[cnt]; + /* The ranges are sorted by address, so we can use binary search. */ + size_t l = 0, u = aranges->naranges; + while (l < u) + { + size_t idx = (l + u) / 2; + if (addr < aranges->info[idx].addr) + u = idx; + else if (addr > aranges->info[idx].addr + && addr - aranges->info[idx].addr >= aranges->info[idx].length) + l = idx + 1; + else + return &aranges->info[idx]; + } __libdw_seterrno (DWARF_E_NO_MATCH); return NULL; } +INTDEF(dwarf_getarange_addr) diff --git a/libdw/dwarf_getarangeinfo.c b/libdw/dwarf_getarangeinfo.c index b96c6316..7cefbf71 100644 --- a/libdw/dwarf_getarangeinfo.c +++ b/libdw/dwarf_getarangeinfo.c @@ -1,16 +1,52 @@ /* Return list address ranges. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -35,3 +71,4 @@ dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp, return 0; } +INTDEF(dwarf_getarangeinfo) diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c index 754baeca..96e99620 100644 --- a/libdw/dwarf_getaranges.c +++ b/libdw/dwarf_getaranges.c @@ -1,25 +1,61 @@ /* Return list address ranges. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdlib.h> - -#include <libdwP.h> - +#include <assert.h> +#include "libdwP.h" +#include <dwarf.h> struct arangelist { @@ -27,6 +63,14 @@ struct arangelist struct arangelist *next; }; +/* Compare by Dwarf_Arange.addr, given pointers into an array of pointeers. */ +static int +compare_aranges (const void *a, const void *b) +{ + Dwarf_Arange *const *p1 = a, *const *p2 = b; + Dwarf_Arange *l1 = *p1, *l2 = *p2; + return l1->addr - l2->addr; +} int dwarf_getaranges (dbg, aranges, naranges) @@ -45,6 +89,15 @@ dwarf_getaranges (dbg, aranges, naranges) return 0; } + if (dbg->sectiondata[IDX_debug_aranges] == NULL) + { + /* No such section. */ + *aranges = NULL; + if (naranges != NULL) + *naranges = 0; + return 0; + } + if (dbg->sectiondata[IDX_debug_aranges]->d_buf == NULL) return -1; @@ -78,11 +131,14 @@ dwarf_getaranges (dbg, aranges, naranges) a segment descriptor on the target system. */ Dwarf_Word length = read_4ubyte_unaligned_inc (dbg, readp); unsigned int length_bytes = 4; - if (length == 0xffffffff) + if (length == DWARF3_LENGTH_64_BIT) { length = read_8ubyte_unaligned_inc (dbg, readp); length_bytes = 8; } + else if (unlikely (length >= DWARF3_LENGTH_MIN_ESCAPE_CODE + && length <= DWARF3_LENGTH_MAX_ESCAPE_CODE)) + goto invalid; unsigned int version = read_2ubyte_unaligned_inc (dbg, readp); if (version != 2) @@ -98,6 +154,10 @@ dwarf_getaranges (dbg, aranges, naranges) else offset = read_8ubyte_unaligned_inc (dbg, readp); + /* Sanity-check the offset. */ + if (offset + 4 > dbg->sectiondata[IDX_debug_info]->d_size) + goto invalid; + unsigned int address_size = *readp++; if (address_size != 4 && address_size != 8) goto invalid; @@ -110,8 +170,6 @@ dwarf_getaranges (dbg, aranges, naranges) readp += ((2 * address_size - ((readp - hdrstart) % (2 * address_size))) % (2 * address_size)); - //arange_info->offset = offset; - while (1) { Dwarf_Word range_address; @@ -142,11 +200,17 @@ dwarf_getaranges (dbg, aranges, naranges) const char *cu_header = (dbg->sectiondata[IDX_debug_info]->d_buf + offset); unsigned int offset_size; - if (read_4ubyte_unaligned_noncvt (cu_header) == 0xffffffff) + if (read_4ubyte_unaligned_noncvt (cu_header) == DWARF3_LENGTH_64_BIT) offset_size = 8; else offset_size = 4; - new_arange->arange.offset = offset + 3 * offset_size - 4 + 3; + new_arange->arange.offset = DIE_OFFSET_FROM_CU_OFFSET (offset, + offset_size); + + /* Sanity-check the data. */ + if (new_arange->arange.offset + >= dbg->sectiondata[IDX_debug_info]->d_size) + goto invalid; new_arange->next = arangelist; arangelist = new_arange; @@ -163,22 +227,44 @@ dwarf_getaranges (dbg, aranges, naranges) } /* Allocate the array for the result. */ - if (naranges != NULL) - *naranges = narangelist; - *aranges = libdw_alloc (dbg, Dwarf_Aranges, - sizeof (Dwarf_Aranges) - + narangelist * sizeof (Dwarf_Arange), 1); - - (*aranges)->dbg = dbg; - (*aranges)->naranges = narangelist; - - while (narangelist-- > 0) + void *buf = libdw_alloc (dbg, Dwarf_Aranges, + sizeof (Dwarf_Aranges) + + narangelist * sizeof (Dwarf_Arange), 1); + + /* First use the buffer for the pointers, and sort the entries. + We'll write the pointers in the end of the buffer, and then + copy into the buffer from the beginning so the overlap works. */ + assert (sizeof (Dwarf_Arange) >= sizeof (Dwarf_Arange *)); + Dwarf_Arange **sortaranges = (buf + sizeof (Dwarf_Aranges) + + ((sizeof (Dwarf_Arange) + - sizeof (Dwarf_Arange *)) * narangelist)); + + /* The list is in LIFO order and usually they come in clumps with + ascending addresses. So fill from the back to probably start with + runs already in order before we sort. */ + unsigned int i = narangelist; + while (i-- > 0) { - (*aranges)->info[narangelist] = arangelist->arange; + sortaranges[i] = &arangelist->arange; arangelist = arangelist->next; } + assert (arangelist == NULL); + /* Sort by ascending address. */ + qsort (sortaranges, narangelist, sizeof sortaranges[0], &compare_aranges); + + /* Now that they are sorted, put them in the final array. + The buffers overlap, so we've clobbered the early elements + of SORTARANGES by the time we're reading the later ones. */ + *aranges = buf; + (*aranges)->dbg = dbg; + (*aranges)->naranges = narangelist; dbg->aranges = *aranges; + if (naranges != NULL) + *naranges = narangelist; + for (i = 0; i < narangelist; ++i) + (*aranges)->info[i] = *sortaranges[i]; return 0; } +INTDEF(dwarf_getaranges) diff --git a/libdw/dwarf_getattrcnt.c b/libdw/dwarf_getattrcnt.c index 0758e030..f85adf0f 100644 --- a/libdw/dwarf_getattrcnt.c +++ b/libdw/dwarf_getattrcnt.c @@ -1,16 +1,52 @@ /* Get number of attributes of abbreviation. Copyright (C) 2003, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_getattrs.c b/libdw/dwarf_getattrs.c index 4ead80cc..42f25ca0 100644 --- a/libdw/dwarf_getattrs.c +++ b/libdw/dwarf_getattrs.c @@ -1,16 +1,52 @@ /* Get attributes of the DIE. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -26,7 +62,7 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), if (die == NULL) return -1l; - unsigned char *die_addr = die->addr; + const unsigned char *die_addr = die->addr; /* Get the abbreviation code. */ unsigned int u128; @@ -36,14 +72,15 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), /* Find the abbreviation. */ die->abbrev = __libdw_findabbrev (die->cu, u128); - if (die->abbrev == (Dwarf_Abbrev *) -1l) + if (unlikely (die->abbrev == DWARF_END_ABBREV)) { + invalid_dwarf: __libdw_seterrno (DWARF_E_INVALID_DWARF); return -1l; } /* This is where the attributes start. */ - unsigned char *attrp = die->abbrev->attrp + offset; + const unsigned char *attrp = die->abbrev->attrp + offset; /* Go over the list of attributes. */ Dwarf *dbg = die->cu->dbg; @@ -53,28 +90,34 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), if (unlikely (attrp >= ((unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf + dbg->sectiondata[IDX_debug_abbrev]->d_size))) - { - __libdw_seterrno (DWARF_E_INVALID_DWARF); - return -1; - } + goto invalid_dwarf; /* Get attribute name and form. */ Dwarf_Attribute attr; + const unsigned char *remembered_attrp = attrp; + // XXX Fix bound checks get_uleb128 (attr.code, attrp); get_uleb128 (attr.form, attrp); /* We can stop if we found the attribute with value zero. */ if (attr.code == 0 && attr.form == 0) - return 0; + /* Do not return 0 here - there would be no way to + distinguish this value from the attribute at offset 0. + Instead we return +1 which would never be a valid + offset of an attribute. */ + return 1l; /* Fill in the rest. */ - attr.valp = die_addr; + attr.valp = (unsigned char *) die_addr; attr.cu = die->cu; /* Now call the callback function. */ if (callback (&attr, arg) != DWARF_CB_OK) - return attrp - die->abbrev->attrp; + /* Return the offset of the start of the attribute, so that + dwarf_getattrs() can be restarted from this point if the + caller so desires. */ + return remembered_attrp - die->abbrev->attrp; /* Skip over the rest of this attribute (if there is any). */ if (attr.form != 0) diff --git a/libdw/dwarf_getelf.c b/libdw/dwarf_getelf.c index 1e2a06aa..daf3b9a7 100644 --- a/libdw/dwarf_getelf.c +++ b/libdw/dwarf_getelf.c @@ -1,16 +1,52 @@ /* Retrieve ELF descriptor used for DWARF access. - Copyright (C) 2002, 2004 Red Hat, Inc. + Copyright (C) 2002, 2004, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -22,7 +58,7 @@ Elf * -dwarf_get_elf (dwarf) +dwarf_getelf (dwarf) Dwarf *dwarf; { if (dwarf == NULL) diff --git a/libdw/dwarf_getfuncs.c b/libdw/dwarf_getfuncs.c new file mode 100644 index 00000000..c0352fbf --- /dev/null +++ b/libdw/dwarf_getfuncs.c @@ -0,0 +1,94 @@ +/* Get function information. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + + +ptrdiff_t +dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *), + void *arg, ptrdiff_t offset) +{ + if (unlikely (cudie == NULL + || INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit)) + return -1; + + Dwarf_Die die_mem; + Dwarf_Die *die; + + int res; + if (offset == 0) + res = INTUSE(dwarf_child) (cudie, &die_mem); + else + { + die = INTUSE(dwarf_offdie) (cudie->cu->dbg, offset, &die_mem); + res = INTUSE(dwarf_siblingof) (die, &die_mem); + } + die = res != 0 ? NULL : &die_mem; + + while (die != NULL) + { + if (INTUSE(dwarf_tag) (die) == DW_TAG_subprogram) + { + if (callback (die, arg) != DWARF_CB_OK) + return INTUSE(dwarf_dieoffset) (die); + } + + if (INTUSE(dwarf_siblingof) (die, &die_mem) != 0) + break; + } + + /* That's all. */ + return 0; +} diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c new file mode 100644 index 00000000..f680aa96 --- /dev/null +++ b/libdw/dwarf_getlocation.c @@ -0,0 +1,496 @@ +/* Return location expression list. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include <search.h> +#include <stdlib.h> + +#include <libdwP.h> + + +static bool +attr_ok (Dwarf_Attribute *attr) +{ + if (attr == NULL) + return false; + + /* Must be one of the attributes listed below. */ + switch (attr->code) + { + case DW_AT_location: + case DW_AT_data_member_location: + case DW_AT_vtable_elem_location: + case DW_AT_string_length: + case DW_AT_use_location: + case DW_AT_frame_base: + case DW_AT_return_addr: + case DW_AT_static_link: + break; + + default: + __libdw_seterrno (DWARF_E_NO_LOCLIST); + return false; + } + + return true; +} + + +struct loclist +{ + uint8_t atom; + Dwarf_Word number; + Dwarf_Word number2; + Dwarf_Word offset; + struct loclist *next; +}; + + +static int +loc_compare (const void *p1, const void *p2) +{ + const struct loc_s *l1 = (const struct loc_s *) p1; + const struct loc_s *l2 = (const struct loc_s *) p2; + + if ((uintptr_t) l1->addr < (uintptr_t) l2->addr) + return -1; + if ((uintptr_t) l1->addr > (uintptr_t) l2->addr) + return 1; + + return 0; +} + +static int +getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block, + Dwarf_Op **llbuf, size_t *listlen) +{ + Dwarf *dbg = cu->dbg; + + /* Check whether we already looked at this list. */ + struct loc_s fake = { .addr = block->data }; + struct loc_s **found = tfind (&fake, &cu->locs, loc_compare); + if (found != NULL) + { + /* We already saw it. */ + *llbuf = (*found)->loc; + *listlen = (*found)->nloc; + + return 0; + } + + const unsigned char *data = block->data; + const unsigned char *const end_data = data + block->length; + + struct loclist *loclist = NULL; + unsigned int n = 0; + /* Decode the opcodes. It is possible in some situations to have a + block of size zero. */ + while (data < end_data) + { + struct loclist *newloc; + newloc = (struct loclist *) alloca (sizeof (struct loclist)); + newloc->number = 0; + newloc->number2 = 0; + newloc->offset = data - block->data; + newloc->next = loclist; + loclist = newloc; + ++n; + + switch ((newloc->atom = *data++)) + { + case DW_OP_addr: + /* Address, depends on address size of CU. */ + if (cu->address_size == 4) + { + if (unlikely (data + 4 > end_data)) + { + invalid: + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + + newloc->number = read_4ubyte_unaligned_inc (dbg, data); + } + else + { + if (unlikely (data + 8 > end_data)) + goto invalid; + + newloc->number = read_8ubyte_unaligned_inc (dbg, data); + } + break; + + case DW_OP_deref: + case DW_OP_dup: + case DW_OP_drop: + case DW_OP_over: + case DW_OP_swap: + case DW_OP_rot: + case DW_OP_xderef: + case DW_OP_abs: + case DW_OP_and: + case DW_OP_div: + case DW_OP_minus: + case DW_OP_mod: + case DW_OP_mul: + case DW_OP_neg: + case DW_OP_not: + case DW_OP_or: + case DW_OP_plus: + case DW_OP_shl: + case DW_OP_shr: + case DW_OP_shra: + case DW_OP_xor: + case DW_OP_eq: + case DW_OP_ge: + case DW_OP_gt: + case DW_OP_le: + case DW_OP_lt: + case DW_OP_ne: + case DW_OP_lit0 ... DW_OP_lit31: + case DW_OP_reg0 ... DW_OP_reg31: + case DW_OP_nop: + case DW_OP_push_object_address: + case DW_OP_call_ref: + /* No operand. */ + break; + + case DW_OP_const1u: + case DW_OP_pick: + case DW_OP_deref_size: + case DW_OP_xderef_size: + if (unlikely (data >= end_data)) + goto invalid; + + newloc->number = *data++; + break; + + case DW_OP_const1s: + if (unlikely (data >= end_data)) + goto invalid; + + newloc->number = *((int8_t *) data); + ++data; + break; + + case DW_OP_const2u: + if (unlikely (data + 2 > end_data)) + goto invalid; + + newloc->number = read_2ubyte_unaligned_inc (dbg, data); + break; + + case DW_OP_const2s: + case DW_OP_skip: + case DW_OP_bra: + case DW_OP_call2: + if (unlikely (data + 2 > end_data)) + goto invalid; + + newloc->number = read_2sbyte_unaligned_inc (dbg, data); + break; + + case DW_OP_const4u: + if (unlikely (data + 4 > end_data)) + goto invalid; + + newloc->number = read_4ubyte_unaligned_inc (dbg, data); + break; + + case DW_OP_const4s: + case DW_OP_call4: + if (unlikely (data + 4 > end_data)) + goto invalid; + + newloc->number = read_4sbyte_unaligned_inc (dbg, data); + break; + + case DW_OP_const8u: + if (unlikely (data + 8 > end_data)) + goto invalid; + + newloc->number = read_8ubyte_unaligned_inc (dbg, data); + break; + + case DW_OP_const8s: + if (unlikely (data + 8 > end_data)) + goto invalid; + + newloc->number = read_8sbyte_unaligned_inc (dbg, data); + break; + + case DW_OP_constu: + case DW_OP_plus_uconst: + case DW_OP_regx: + case DW_OP_piece: + /* XXX Check size. */ + get_uleb128 (newloc->number, data); + break; + + case DW_OP_consts: + case DW_OP_breg0 ... DW_OP_breg31: + case DW_OP_fbreg: + /* XXX Check size. */ + get_sleb128 (newloc->number, data); + break; + + case DW_OP_bregx: + /* XXX Check size. */ + get_uleb128 (newloc->number, data); + get_sleb128 (newloc->number2, data); + break; + + default: + goto invalid; + } + } + + if (unlikely (n == 0)) + { + /* This is not allowed. + + XXX Is it? */ + goto invalid; + } + + /* Allocate the array. */ + Dwarf_Op *result = libdw_alloc (dbg, Dwarf_Op, sizeof (Dwarf_Op), n); + + /* Store the result. */ + *llbuf = result; + *listlen = n; + + do + { + /* We populate the array from the back since the list is + backwards. */ + --n; + result[n].atom = loclist->atom; + result[n].number = loclist->number; + result[n].number2 = loclist->number2; + result[n].offset = loclist->offset; + + loclist = loclist->next; + } + while (n > 0); + + /* Insert a record in the search tree so that we can find it again + later. */ + struct loc_s *newp = libdw_alloc (dbg, struct loc_s, sizeof (struct loc_s), + 1); + newp->addr = block->data; + newp->loc = result; + newp->nloc = *listlen; + (void) tsearch (newp, &cu->locs, loc_compare); + + /* We did it. */ + return 0; +} + +int +dwarf_getlocation (attr, llbuf, listlen) + Dwarf_Attribute *attr; + Dwarf_Op **llbuf; + size_t *listlen; +{ + if (! attr_ok (attr)) + return -1; + + /* If it has a block form, it's a single location expression. */ + Dwarf_Block block; + if (INTUSE(dwarf_formblock) (attr, &block) != 0) + return -1; + + return getlocation (attr->cu, &block, llbuf, listlen); +} + +int +dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs) + Dwarf_Attribute *attr; + Dwarf_Addr address; + Dwarf_Op **llbufs; + size_t *listlens; + size_t maxlocs; +{ + if (! attr_ok (attr)) + return -1; + + if (llbufs == NULL) + maxlocs = SIZE_MAX; + + /* If it has a block form, it's a single location expression. */ + Dwarf_Block block; + if (INTUSE(dwarf_formblock) (attr, &block) == 0) + { + if (maxlocs == 0) + return 0; + if (llbufs != NULL && + getlocation (attr->cu, &block, &llbufs[0], &listlens[0]) != 0) + return -1; + return listlens[0] == 0 ? 0 : 1; + } + + int error = INTUSE(dwarf_errno) (); + if (unlikely (error != DWARF_E_NO_BLOCK)) + { + __libdw_seterrno (error); + return -1; + } + + /* Must have the form data4 or data8 which act as an offset. */ + Dwarf_Word offset; + if (unlikely (INTUSE(dwarf_formudata) (attr, &offset) != 0)) + return -1; + + const Elf_Data *d = attr->cu->dbg->sectiondata[IDX_debug_loc]; + if (unlikely (d == NULL)) + { + __libdw_seterrno (DWARF_E_NO_LOCLIST); + return -1; + } + + Dwarf_Addr base = (Dwarf_Addr) -1; + unsigned char *readp = d->d_buf + offset; + size_t got = 0; + while (got < maxlocs) + { + if ((unsigned char *) d->d_buf + d->d_size - readp + < attr->cu->address_size * 2) + { + invalid: + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + + Dwarf_Addr begin; + Dwarf_Addr end; + if (attr->cu->address_size == 8) + { + begin = read_8ubyte_unaligned_inc (attr->cu->dbg, readp); + end = read_8ubyte_unaligned_inc (attr->cu->dbg, readp); + + if (begin == (Elf64_Addr) -1l) /* Base address entry. */ + { + base = end; + if (unlikely (base == (Dwarf_Addr) -1)) + goto invalid; + continue; + } + } + else + { + begin = read_4ubyte_unaligned_inc (attr->cu->dbg, readp); + end = read_4ubyte_unaligned_inc (attr->cu->dbg, readp); + + if (begin == (Elf32_Addr) -1) /* Base address entry. */ + { + base = end; + continue; + } + } + + if (begin == 0 && end == 0) /* End of list entry. */ + break; + + if ((unsigned char *) d->d_buf + d->d_size - readp < 2) + goto invalid; + + /* We have a location expression. */ + block.length = read_2ubyte_unaligned_inc (attr->cu->dbg, readp); + block.data = readp; + if ((unsigned char *) d->d_buf + d->d_size - readp + < (ptrdiff_t) block.length) + goto invalid; + readp += block.length; + + if (base == (Dwarf_Addr) -1) + { + /* Fetch the CU's base address. */ + Dwarf_Die cudie = CUDIE (attr->cu); + + /* Find the base address of the compilation unit. It will + normally be specified by DW_AT_low_pc. In DWARF-3 draft 4, + the base address could be overridden by DW_AT_entry_pc. It's + been removed, but GCC emits DW_AT_entry_pc and not DW_AT_lowpc + for compilation units with discontinuous ranges. */ + Dwarf_Attribute attr_mem; + if (unlikely (INTUSE(dwarf_lowpc) (&cudie, &base) != 0) + && INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (&cudie, + DW_AT_entry_pc, + &attr_mem), + &base) != 0) + { + if (INTUSE(dwarf_errno) () != 0) + return -1; + + /* The compiler provided no base address when it should + have. Buggy GCC does this when it used absolute + addresses in the location list and no DW_AT_ranges. */ + base = 0; + } + } + + if (address >= base + begin && address < base + end) + { + /* This one matches the address. */ + if (llbufs != NULL + && unlikely (getlocation (attr->cu, &block, + &llbufs[got], &listlens[got]) != 0)) + return -1; + ++got; + } + } + + return got; +} diff --git a/libdw/dwarf_getloclist.c b/libdw/dwarf_getloclist.c deleted file mode 100644 index 6339a8c8..00000000 --- a/libdw/dwarf_getloclist.c +++ /dev/null @@ -1,296 +0,0 @@ -/* Return location expression list. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <dwarf.h> -#include <search.h> -#include <stdlib.h> - -#include <libdwP.h> - - -struct loclist -{ - uint8_t atom; - Dwarf_Word number; - Dwarf_Word number2; - Dwarf_Word offset; - struct loclist *next; -}; - - -static int -loc_compare (const void *p1, const void *p2) -{ - const struct loc_s *l1 = (const struct loc_s *) p1; - const struct loc_s *l2 = (const struct loc_s *) p2; - - if ((uintptr_t) l1->addr < (uintptr_t) l2->addr) - return -1; - if ((uintptr_t) l1->addr > (uintptr_t) l2->addr) - return 1; - - return 0; -} - - -int -dwarf_getloclist (attr, llbuf, listlen) - Dwarf_Attribute *attr; - Dwarf_Loc **llbuf; - size_t *listlen; -{ - /* Must by one of the attribute listed below. */ - if (attr->code != DW_AT_location - && attr->code != DW_AT_data_member_location - && attr->code != DW_AT_vtable_elem_location - && attr->code != DW_AT_string_length - && attr->code != DW_AT_use_location - && attr->code != DW_AT_return_addr) - { - __libdw_seterrno (DWARF_E_NO_LOCLIST); - return -1; - } - - struct Dwarf_CU *cu = attr->cu; - Dwarf *dbg = cu->dbg; - - /* Must have the form data4 or data8 which act as an offset. */ - Dwarf_Block block; - if (dwarf_formblock (attr, &block) != 0) - return -1; - - /* Check whether we already looked at this list. */ - struct loc_s fake = { .addr = block.data }; - struct loc_s **found = tfind (&fake, &cu->locs, loc_compare); - if (found != NULL) - { - /* We already saw it. */ - *llbuf = (*found)->loc; - *listlen = (*found)->nloc; - - return 0; - } - - unsigned char *data = block.data; - unsigned char *const end_data = data + block.length; - - struct loclist *loclist = NULL; - unsigned int n = 0; - /* Decode the opcodes. It is possible in some situations to have a - block of size zero. */ - while (data < end_data) - { - struct loclist *newloc; - newloc = (struct loclist *) alloca (sizeof (struct loclist)); - newloc->number = 0; - newloc->number2 = 0; - newloc->offset = data - block.data; - newloc->next = loclist; - loclist = newloc; - ++n; - - switch ((newloc->atom = *data++)) - { - case DW_OP_addr: - /* Address, depends on address size of CU. */ - if (cu->address_size == 4) - { - if (unlikely (data + 4 > end_data)) - { - invalid: - __libdw_seterrno (DWARF_E_INVALID_DWARF); - return -1; - } - - newloc->number = read_4ubyte_unaligned_inc (dbg, data); - } - else - { - if (unlikely (data + 8 > end_data)) - goto invalid; - - newloc->number = read_8ubyte_unaligned_inc (dbg, data); - } - break; - - case DW_OP_deref: - case DW_OP_dup: - case DW_OP_drop: - case DW_OP_over: - case DW_OP_swap: - case DW_OP_rot: - case DW_OP_xderef: - case DW_OP_abs: - case DW_OP_and: - case DW_OP_div: - case DW_OP_minus: - case DW_OP_mod: - case DW_OP_mul: - case DW_OP_neg: - case DW_OP_not: - case DW_OP_or: - case DW_OP_plus: - case DW_OP_shl: - case DW_OP_shr: - case DW_OP_shra: - case DW_OP_xor: - case DW_OP_eq: - case DW_OP_ge: - case DW_OP_gt: - case DW_OP_le: - case DW_OP_lt: - case DW_OP_ne: - case DW_OP_lit0 ... DW_OP_lit31: - case DW_OP_reg0 ... DW_OP_reg31: - case DW_OP_nop: - case DW_OP_push_object_address: - case DW_OP_call_ref: - /* No operand. */ - break; - - case DW_OP_const1u: - case DW_OP_pick: - case DW_OP_deref_size: - case DW_OP_xderef_size: - if (unlikely (data >= end_data)) - goto invalid; - - newloc->number = *data++; - break; - - case DW_OP_const1s: - if (unlikely (data >= end_data)) - goto invalid; - - newloc->number = *((int8_t *) data); - ++data; - break; - - case DW_OP_const2u: - if (unlikely (data + 2 > end_data)) - goto invalid; - - newloc->number = read_2ubyte_unaligned_inc (dbg, data); - break; - - case DW_OP_const2s: - case DW_OP_skip: - case DW_OP_bra: - case DW_OP_call2: - if (unlikely (data + 2 > end_data)) - goto invalid; - - newloc->number = read_2sbyte_unaligned_inc (dbg, data); - break; - - case DW_OP_const4u: - if (unlikely (data + 4 > end_data)) - goto invalid; - - newloc->number = read_4ubyte_unaligned_inc (dbg, data); - break; - - case DW_OP_const4s: - case DW_OP_call4: - if (unlikely (data + 4 > end_data)) - goto invalid; - - newloc->number = read_4sbyte_unaligned_inc (dbg, data); - break; - - case DW_OP_const8u: - if (unlikely (data + 8 > end_data)) - goto invalid; - - newloc->number = read_8ubyte_unaligned_inc (dbg, data); - break; - - case DW_OP_const8s: - if (unlikely (data + 8 > end_data)) - goto invalid; - - newloc->number = read_8sbyte_unaligned_inc (dbg, data); - break; - - case DW_OP_constu: - case DW_OP_plus_uconst: - case DW_OP_regx: - case DW_OP_piece: - /* XXX Check size. */ - get_uleb128 (newloc->number, data); - break; - - case DW_OP_consts: - case DW_OP_breg0 ... DW_OP_breg31: - case DW_OP_fbreg: - /* XXX Check size. */ - get_sleb128 (newloc->number, data); - break; - - case DW_OP_bregx: - /* XXX Check size. */ - get_uleb128 (newloc->number, data); - get_sleb128 (newloc->number2, data); - break; - - default: - goto invalid; - } - } - - if (unlikely (n == 0)) - { - /* This is not allowed. - - XXX Is it? */ - goto invalid; - } - - /* Allocate the array. */ - Dwarf_Loc *result = libdw_alloc (dbg, Dwarf_Loc, sizeof (Dwarf_Loc), n); - - /* Store the result. */ - *llbuf = result; - *listlen = n; - - do - { - /* We populate the array from the back since the list is - backwards. */ - --n; - result[n].atom = loclist->atom; - result[n].number = loclist->number; - result[n].number2 = loclist->number2; - result[n].offset = loclist->offset; - - loclist = loclist->next; - } - while (n > 0); - - /* Insert a record in the search tree so that we can find it again - later. */ - struct loc_s *newp = libdw_alloc (dbg, struct loc_s, sizeof (struct loc_s), - 1); - newp->addr = block.data; - newp->loc = result; - newp->nloc = *listlen; - (void) tsearch (newp, &cu->locs, loc_compare); - - /* We did it. */ - return 0; -} diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c index f6f933aa..743ade3b 100644 --- a/libdw/dwarf_getmacros.c +++ b/libdw/dwarf_getmacros.c @@ -1,16 +1,52 @@ -/* Get public symbol information. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. +/* Get macro information. + Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -31,12 +67,12 @@ dwarf_getmacros (die, callback, arg, offset) { /* Get the appropriate attribute. */ Dwarf_Attribute attr; - if (dwarf_attr (die, DW_AT_macro_info, &attr) == NULL) + if (INTUSE(dwarf_attr) (die, DW_AT_macro_info, &attr) == NULL) return -1; /* Offset into the .debug_macinfo section. */ Dwarf_Word macoff; - if (dwarf_formudata (&attr, &macoff) != 0) + if (INTUSE(dwarf_formudata) (&attr, &macoff) != 0) return -1; const unsigned char *readp @@ -85,6 +121,11 @@ dwarf_getmacros (die, callback, arg, offset) break; case DW_MACINFO_end_file: + /* No parameters for this one. */ + u128 = 0; + break; + + case 0: /* Nothing more to do. */ return 0; diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c index c3cb5e2e..3897c259 100644 --- a/libdw/dwarf_getpubnames.c +++ b/libdw/dwarf_getpubnames.c @@ -1,16 +1,52 @@ /* Get public symbol information. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -22,7 +58,11 @@ #include <sys/param.h> #include <libdwP.h> +#include <dwarf.h> +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ static int get_offsets (Dwarf *dbg) @@ -57,11 +97,18 @@ get_offsets (Dwarf *dbg) /* Read the set header. */ int len_bytes = 4; Dwarf_Off len = read_4ubyte_unaligned_inc (dbg, readp); - if (len == 0xffffffff) + if (len == DWARF3_LENGTH_64_BIT) { len = read_8ubyte_unaligned_inc (dbg, readp); len_bytes = 8; } + else if (unlikely (len >= DWARF3_LENGTH_MIN_ESCAPE_CODE + && len <= DWARF3_LENGTH_MAX_ESCAPE_CODE)) + { + invalid_dwarf: + __libdw_seterrno (DWARF_E_INVALID_DWARF); + goto err_return; + } /* Now we know the offset of the first offset/name pair. */ mem[cnt].set_start = readp + 2 + 2 * len_bytes - startp; @@ -73,7 +120,7 @@ get_offsets (Dwarf *dbg) /* Read the version. It better be two for now. */ uint16_t version = read_2ubyte_unaligned (dbg, readp); - if (version != 2) + if (unlikely (version != 2)) { __libdw_seterrno (DWARF_E_INVALID_VERSION); goto err_return; @@ -86,14 +133,16 @@ get_offsets (Dwarf *dbg) mem[cnt].cu_offset = read_8ubyte_unaligned (dbg, readp + 2); /* Determine the size of the CU header. */ - assert (dbg->sectiondata[IDX_debug_info] != NULL); - assert (dbg->sectiondata[IDX_debug_info]->d_buf != NULL); - assert (mem[cnt].cu_offset + 3 - < dbg->sectiondata[IDX_debug_info]->d_size); + if (unlikely (dbg->sectiondata[IDX_debug_info] == NULL + || dbg->sectiondata[IDX_debug_info]->d_buf == NULL + || (mem[cnt].cu_offset + 3 + >= dbg->sectiondata[IDX_debug_info]->d_size))) + goto invalid_dwarf; + unsigned char *infop = ((unsigned char *) dbg->sectiondata[IDX_debug_info]->d_buf + mem[cnt].cu_offset); - if (read_4ubyte_unaligned_noncvt (infop) == 0xffffffff) + if (read_4ubyte_unaligned_noncvt (infop) == DWARF3_LENGTH_64_BIT) mem[cnt].cu_header_size = 23; else mem[cnt].cu_header_size = 11; @@ -127,14 +176,21 @@ dwarf_getpubnames (dbg, callback, arg, offset) if (dbg == NULL) return -1l; + if (unlikely (offset < 0)) + { + __libdw_seterrno (DWARF_E_INVALID_OFFSET); + return -1l; + } + /* Make sure it is a valid offset. */ if (unlikely (dbg->sectiondata[IDX_debug_pubnames] == NULL - || offset >= dbg->sectiondata[IDX_debug_pubnames]->d_size)) + || ((size_t) offset + >= dbg->sectiondata[IDX_debug_pubnames]->d_size))) /* No (more) entry. */ return 0; /* If necessary read the set information. */ - if (dbg->pubnames_nsets == 0 && get_offsets (dbg) != 0) + if (dbg->pubnames_nsets == 0 && unlikely (get_offsets (dbg) != 0)) return -1l; /* Find the place where to start. */ @@ -147,9 +203,10 @@ dwarf_getpubnames (dbg, callback, arg, offset) else { for (cnt = 0; cnt + 1 < dbg->pubnames_nsets; ++cnt) - if (offset >= dbg->pubnames_sets[cnt].set_start) + if ((Dwarf_Off) offset >= dbg->pubnames_sets[cnt].set_start) { - assert (offset < dbg->pubnames_sets[cnt + 1].set_start); + assert ((Dwarf_Off) offset + < dbg->pubnames_sets[cnt + 1].set_start); break; } assert (cnt + 1 < dbg->pubnames_nsets); @@ -181,7 +238,13 @@ dwarf_getpubnames (dbg, callback, arg, offset) gl.die_offset += dbg->pubnames_sets[cnt].cu_offset; gl.name = (char *) readp; + /* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + readp = gl.name + strlen(gl.name) + 1; +#else readp = (unsigned char *) rawmemchr (gl.name, '\0') + 1; +#endif + /* ANDROID_CHANGE_END */ /* We found name and DIE offset. Report it. */ if (callback (dbg, &gl, arg) != DWARF_CB_OK) diff --git a/libdw/dwarf_getscopes.c b/libdw/dwarf_getscopes.c new file mode 100644 index 00000000..73431ba7 --- /dev/null +++ b/libdw/dwarf_getscopes.c @@ -0,0 +1,222 @@ +/* Return scope DIEs containing PC address. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <stdlib.h> +#include "libdwP.h" +#include <dwarf.h> + + +struct args +{ + Dwarf_Addr pc; + Dwarf_Die *scopes; + unsigned int inlined, nscopes; + Dwarf_Die inlined_origin; +}; + +/* Preorder visitor: prune the traversal if this DIE does not contain PC. */ +static int +pc_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) +{ + struct args *a = arg; + + if (a->scopes != NULL) + die->prune = true; + else + { + /* dwarf_haspc returns an error if there are no appropriate attributes. + But we use it indiscriminantly instead of presuming which tags can + have PC attributes. So when it fails for that reason, treat it just + as a nonmatching return. */ + int result = INTUSE(dwarf_haspc) (&die->die, a->pc); + if (result < 0) + { + int error = INTUSE(dwarf_errno) (); + if (error != DWARF_E_NOERROR && error != DWARF_E_NO_DEBUG_RANGES) + { + __libdw_seterrno (error); + return -1; + } + result = 0; + } + if (result == 0) + die->prune = true; + + if (!die->prune + && INTUSE (dwarf_tag) (&die->die) == DW_TAG_inlined_subroutine) + a->inlined = depth; + } + + return 0; +} + +/* Preorder visitor for second partial traversal after finding a + concrete inlined instance. */ +static int +origin_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) +{ + struct args *a = arg; + + if (die->die.addr != a->inlined_origin.addr) + return 0; + + /* We have a winner! This is the abstract definition of the inline + function of which A->scopes[A->nscopes - 1] is a concrete instance. + */ + + unsigned int nscopes = a->nscopes + depth; + Dwarf_Die *scopes = realloc (a->scopes, nscopes * sizeof scopes[0]); + if (scopes == NULL) + { + free (a->scopes); + __libdw_seterrno (DWARF_E_NOMEM); + return -1; + } + + a->scopes = scopes; + do + { + die = die->parent; + scopes[a->nscopes++] = die->die; + } + while (a->nscopes < nscopes); + assert (die->parent == NULL); + return a->nscopes; +} + +/* Postorder visitor: first (innermost) call wins. */ +static int +pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) +{ + struct args *a = arg; + + if (die->prune) + return 0; + + if (a->scopes == NULL) + { + /* We have hit the innermost DIE that contains the target PC. */ + + a->nscopes = depth + 1 - a->inlined; + a->scopes = malloc (a->nscopes * sizeof a->scopes[0]); + if (a->scopes == NULL) + { + __libdw_seterrno (DWARF_E_NOMEM); + return -1; + } + + for (unsigned int i = 0; i < a->nscopes; ++i) + { + a->scopes[i] = die->die; + die = die->parent; + } + + if (a->inlined == 0) + { + assert (die == NULL); + return a->nscopes; + } + + /* This is the concrete inlined instance itself. + Record its abstract_origin pointer. */ + Dwarf_Die *const inlinedie = &a->scopes[depth - a->inlined]; + + assert (INTUSE (dwarf_tag) (inlinedie) == DW_TAG_inlined_subroutine); + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = INTUSE (dwarf_attr) (inlinedie, + DW_AT_abstract_origin, + &attr_mem); + if (INTUSE (dwarf_formref_die) (attr, &a->inlined_origin) == NULL) + return -1; + return 0; + } + + + /* We've recorded the scopes back to one that is a concrete inlined + instance. Now return out of the traversal back to the scope + containing that instance. */ + + assert (a->inlined); + if (depth >= a->inlined) + /* Not there yet. */ + return 0; + + /* Now we are in a scope that contains the concrete inlined instance. + Search it for the inline function's abstract definition. + If we don't find it, return to search the containing scope. + If we do find it, the nonzero return value will bail us out + of the postorder traversal. */ + return __libdw_visit_scopes (depth, die, &origin_match, NULL, a); +} + + +int +dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, Dwarf_Die **scopes) +{ + if (cudie == NULL) + return -1; + + struct Dwarf_Die_Chain cu = { .parent = NULL, .die = *cudie }; + struct args a = { .pc = pc }; + + int result = __libdw_visit_scopes (0, &cu, &pc_match, &pc_record, &a); + + if (result == 0 && a.scopes != NULL) + result = __libdw_visit_scopes (0, &cu, &origin_match, NULL, &a); + + if (result > 0) + *scopes = a.scopes; + + return result; +} diff --git a/libdw/dwarf_getscopes_die.c b/libdw/dwarf_getscopes_die.c new file mode 100644 index 00000000..07fb9b00 --- /dev/null +++ b/libdw/dwarf_getscopes_die.c @@ -0,0 +1,95 @@ +/* Return scope DIEs containing given DIE. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include "libdwP.h" +#include <assert.h> +#include <stdlib.h> + +static int +scope_visitor (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) +{ + if (die->die.addr != *(void **) arg) + return 0; + + Dwarf_Die *scopes = malloc (depth * sizeof scopes[0]); + if (scopes == NULL) + { + __libdw_seterrno (DWARF_E_NOMEM); + return -1; + } + + unsigned int i = 0; + do + { + scopes[i++] = die->die; + die = die->parent; + } + while (die != NULL); + assert (i == depth); + + *(void **) arg = scopes; + return depth; +} + +int +dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes) +{ + if (die == NULL) + return -1; + + struct Dwarf_Die_Chain cu = { .die = CUDIE (die->cu), .parent = NULL }; + void *info = die->addr; + int result = __libdw_visit_scopes (1, &cu, &scope_visitor, NULL, &info); + if (result > 0) + *scopes = info; + return result; +} diff --git a/libdw/dwarf_getscopevar.c b/libdw/dwarf_getscopevar.c new file mode 100644 index 00000000..4e5b429e --- /dev/null +++ b/libdw/dwarf_getscopevar.c @@ -0,0 +1,177 @@ +/* Find a named variable or parameter within given scopes. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdbool.h> +#include <string.h> +#include "libdwP.h" +#include <dwarf.h> + + +/* Find the containing CU's files. */ +static int +getfiles (Dwarf_Die *die, Dwarf_Files **files) +{ + return INTUSE(dwarf_getsrcfiles) (&CUDIE (die->cu), files, NULL); +} + +/* Fetch an attribute that should have a constant integer form. */ +static int +getattr (Dwarf_Die *die, int search_name, Dwarf_Word *value) +{ + Dwarf_Attribute attr_mem; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, search_name, + &attr_mem), value); +} + +/* Search SCOPES[0..NSCOPES-1] for a variable called NAME. + Ignore the first SKIP_SHADOWS scopes that match the name. + If MATCH_FILE is not null, accept only declaration in that source file; + if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration + at that line and column. + + If successful, fill in *RESULT with the DIE of the variable found, + and return N where SCOPES[N] is the scope defining the variable. + Return -1 for errors or -2 for no matching variable found. */ + +int +dwarf_getscopevar (Dwarf_Die *scopes, int nscopes, + const char *name, int skip_shadows, + const char *match_file, int match_lineno, int match_linecol, + Dwarf_Die *result) +{ + /* Match against the given file name. */ + size_t match_file_len = match_file == NULL ? 0 : strlen (match_file); + bool lastfile_matches = false; + const char *lastfile = NULL; + inline bool file_matches (Dwarf_Files *files, size_t idx) + { + if (idx >= files->nfiles) + return false; + + const char *file = files->info[idx].name; + if (file != lastfile) + { + size_t len = strlen (file); + lastfile_matches = (len >= match_file_len + && !memcmp (match_file, file, match_file_len) + && (len == match_file_len + || file[len - match_file_len - 1] == '/')); + } + return lastfile_matches; + } + + /* Start with the innermost scope and move out. */ + for (int out = 0; out < nscopes; ++out) + if (INTUSE(dwarf_haschildren) (&scopes[out])) + { + if (INTUSE(dwarf_child) (&scopes[out], result) != 0) + return -1; + do + { + switch (INTUSE(dwarf_tag) (result)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + break; + + default: + continue; + } + + /* Only get here for a variable or parameter. Check the name. */ + Dwarf_Attribute attr_mem; + const char *diename = INTUSE(dwarf_formstring) + (INTUSE(dwarf_attr_integrate) (result, DW_AT_name, &attr_mem)); + if (diename != NULL && !strcmp (name, diename)) + { + /* We have a matching name. */ + + if (skip_shadows > 0) + { + /* Punt this scope for the one it shadows. */ + --skip_shadows; + break; + } + + if (match_file != NULL) + { + /* Check its decl_file. */ + + Dwarf_Word i; + Dwarf_Files *files; + if (getattr (result, DW_AT_decl_file, &i) != 0 + || getfiles (&scopes[out], &files) != 0) + break; + + if (!file_matches (files, i)) + break; + + if (match_lineno > 0 + && (getattr (result, DW_AT_decl_line, &i) != 0 + || (int) i != match_lineno)) + break; + if (match_linecol > 0 + && (getattr (result, DW_AT_decl_column, &i) != 0 + || (int) i != match_linecol)) + break; + } + + /* We have a winner! */ + return out; + } + } + while (INTUSE(dwarf_siblingof) (result, result) == 0); + } + + return -2; +} diff --git a/libdw/dwarf_getsrc_die.c b/libdw/dwarf_getsrc_die.c index 33cbd7b3..96aa41fd 100644 --- a/libdw/dwarf_getsrc_die.c +++ b/libdw/dwarf_getsrc_die.c @@ -1,22 +1,59 @@ /* Find line information for address. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include "libdwP.h" +#include <assert.h> Dwarf_Line * @@ -25,13 +62,37 @@ dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr) Dwarf_Lines *lines; size_t nlines; - if (dwarf_getsrclines (cudie, &lines, &nlines) != 0) + if (INTUSE(dwarf_getsrclines) (cudie, &lines, &nlines) != 0) return NULL; - if (addr >= lines->info[0].addr ) - for (size_t n = 1; n < nlines; ++n) - if (addr < lines->info[n].addr) - return &lines->info[n - 1]; + /* The lines are sorted by address, so we can use binary search. */ + size_t l = 0, u = nlines; + while (l < u) + { + size_t idx = (l + u) / 2; + if (addr < lines->info[idx].addr) + u = idx; + else if (addr > lines->info[idx].addr || lines->info[idx].end_sequence) + l = idx + 1; + else + return &lines->info[idx]; + } + + if (nlines > 0) + assert (lines->info[nlines - 1].end_sequence); + + /* If none were equal, the closest one below is what we want. We + never want the last one, because it's the end-sequence marker + with an address at the high bound of the CU's code. If the debug + information is faulty and no end-sequence marker is present, we + still ignore it. */ + if (u > 0 && u < nlines && addr > lines->info[u - 1].addr) + { + while (lines->info[u - 1].end_sequence && u > 0) + --u; + if (u > 0) + return &lines->info[u - 1]; + } __libdw_seterrno (DWARF_E_ADDR_OUTOFRANGE); return NULL; diff --git a/libdw/dwarf_getsrc_file.c b/libdw/dwarf_getsrc_file.c new file mode 100644 index 00000000..91abbaeb --- /dev/null +++ b/libdw/dwarf_getsrc_file.c @@ -0,0 +1,194 @@ +/* Find line information for given file/line/column triple. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <limits.h> +#include <stdlib.h> +#include <string.h> + +#include "libdwP.h" + + +int +dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, + Dwarf_Line ***srcsp, size_t *nsrcs) +{ + if (dbg == NULL) + return -1; + + bool is_basename = strchr (fname, '/') == NULL; + + size_t max_match = *nsrcs ?: ~0u; + size_t act_match = *nsrcs; + size_t cur_match = 0; + Dwarf_Line **match = *nsrcs == 0 ? NULL : *srcsp; + + Dwarf_Off off = 0; + size_t cuhl; + Dwarf_Off noff; + + while (INTUSE(dwarf_nextcu) (dbg, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + { + Dwarf_Die cudie_mem; + Dwarf_Die *cudie = INTUSE(dwarf_offdie) (dbg, off + cuhl, &cudie_mem); + if (cudie == NULL) + continue; + + /* Get the line number information for this file. */ + Dwarf_Lines *lines; + size_t nlines; + if (INTUSE(dwarf_getsrclines) (cudie, &lines, &nlines) != 0) + return -1; + + /* Search through all the line number records for a matching + file and line/column number. If any of the numbers is zero, + no match is performed. */ + unsigned int lastfile = UINT_MAX; + bool lastmatch = false; + for (size_t cnt = 0; cnt < nlines; ++cnt) + { + Dwarf_Line *line = &lines->info[cnt]; + + if (lastfile != line->file) + { + lastfile = line->file; + if (lastfile >= line->files->nfiles) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } + + /* Match the name with the name the user provided. */ + const char *fname2 = line->files->info[lastfile].name; + if (is_basename) + lastmatch = strcmp (basename (fname2), fname) == 0; + else + lastmatch = strcmp (fname2, fname) == 0; + } + if (!lastmatch) + continue; + + /* See whether line and possibly column match. */ + if (lineno != 0 + && (lineno > line->line + || (column != 0 && column > line->column))) + /* Cannot match. */ + continue; + + /* Determine whether this is the best match so far. */ + size_t inner; + for (inner = 0; inner < cur_match; ++inner) + if (match[inner]->files == line->files + && match[inner]->file == line->file) + break; + if (inner < cur_match + && (match[inner]->line != line->line + || match[inner]->line != lineno + || (column != 0 + && (match[inner]->column != line->column + || match[inner]->column != column)))) + { + /* We know about this file already. If this is a better + match for the line number, use it. */ + if (match[inner]->line >= line->line + && (match[inner]->line != line->line + || match[inner]->column >= line->column)) + /* Use the new line. Otherwise the old one. */ + match[inner] = line; + continue; + } + + if (cur_match < max_match) + { + if (cur_match == act_match) + { + /* Enlarge the array for the results. */ + act_match += 10; + Dwarf_Line **newp = realloc (match, + act_match + * sizeof (Dwarf_Line *)); + if (newp == NULL) + { + free (match); + __libdw_seterrno (DWARF_E_NOMEM); + return -1; + } + match = newp; + } + + match[cur_match++] = line; + } + } + + /* If we managed to find as many matches as the user requested + already, there is no need to go on to the next CU. */ + if (cur_match == max_match) + break; + + off = noff; + } + + if (cur_match > 0) + { + assert (*nsrcs == 0 || *srcsp == match); + + *nsrcs = cur_match; + *srcsp = match; + + return 0; + } + + __libdw_seterrno (DWARF_E_NO_MATCH); + return -1; +} diff --git a/libdw/dwarf_getsrcdirs.c b/libdw/dwarf_getsrcdirs.c new file mode 100644 index 00000000..74786dd0 --- /dev/null +++ b/libdw/dwarf_getsrcdirs.c @@ -0,0 +1,69 @@ +/* Find include directories in source file information. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +int +dwarf_getsrcdirs (files, result, ndirs) + Dwarf_Files *files; + const char *const **result; + size_t *ndirs; +{ + if (files == NULL) + return -1; + + *result = (void *) &files->info[files->nfiles]; + *ndirs = files->ndirs; + return 0; +} diff --git a/libdw/dwarf_getsrcfiles.c b/libdw/dwarf_getsrcfiles.c index 1775168d..ee4de520 100644 --- a/libdw/dwarf_getsrcfiles.c +++ b/libdw/dwarf_getsrcfiles.c @@ -1,16 +1,52 @@ /* Return source file information of CU. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,7 +60,8 @@ int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) { - if (unlikely (cudie == NULL || dwarf_tag (cudie) != DW_TAG_compile_unit)) + if (unlikely (cudie == NULL + || INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit)) return -1; int res = -1; @@ -38,7 +75,7 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) /* Let the more generic function do the work. It'll create more data but that will be needed in an real program anyway. */ - res = dwarf_getsrclines (cudie, &lines, &nlines); + res = INTUSE(dwarf_getsrclines) (cudie, &lines, &nlines); } else if (cu->files != (void *) -1l) /* We already have the information. */ @@ -56,3 +93,4 @@ dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) return res; } +INTDEF (dwarf_getsrcfiles) diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c index a372af2f..9b3c97af 100644 --- a/libdw/dwarf_getsrclines.c +++ b/libdw/dwarf_getsrclines.c @@ -1,16 +1,52 @@ /* Return line number information of CU. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -36,7 +72,22 @@ struct linelist }; -/* Adds a new line to the matrix. We cannot definte a function because +/* Compare by Dwarf_Line.addr, given pointers into an array of pointers. */ +static int +compare_lines (const void *a, const void *b) +{ + Dwarf_Line *const *p1 = a; + Dwarf_Line *const *p2 = b; + + if ((*p1)->addr == (*p2)->addr) + /* An end_sequence marker precedes a normal record at the same address. */ + return (*p2)->end_sequence - (*p1)->end_sequence; + + return (*p1)->addr - (*p2)->addr; +} + + +/* Adds a new line to the matrix. We cannot define a function because we want to use alloca. */ #define NEW_LINE(end_seq) \ do { \ @@ -63,7 +114,8 @@ struct linelist int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) { - if (unlikely (cudie == NULL || dwarf_tag (cudie) != DW_TAG_compile_unit)) + if (unlikely (cudie == NULL + || INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit)) return -1; int res = -1; @@ -78,13 +130,13 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* The die must have a statement list associated. */ Dwarf_Attribute stmt_list_mem; - Dwarf_Attribute *stmt_list = dwarf_attr (cudie, DW_AT_stmt_list, - &stmt_list_mem); + Dwarf_Attribute *stmt_list = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, + &stmt_list_mem); /* Get the offset into the .debug_line section. NB: this call also checks whether the previous dwarf_attr call failed. */ Dwarf_Word offset; - if (dwarf_formudata (stmt_list, &offset) != 0) + if (INTUSE(dwarf_formudata) (stmt_list, &offset) != 0) goto out; Dwarf *dbg = cu->dbg; @@ -93,15 +145,16 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) __libdw_seterrno (DWARF_E_NO_DEBUG_LINE); goto out; } - uint8_t *linep = dbg->sectiondata[IDX_debug_line]->d_buf + offset; - uint8_t *lineendp = (dbg->sectiondata[IDX_debug_line]->d_buf - + dbg->sectiondata[IDX_debug_line]->d_size); + const uint8_t *linep = dbg->sectiondata[IDX_debug_line]->d_buf + offset; + const uint8_t *lineendp = (dbg->sectiondata[IDX_debug_line]->d_buf + + dbg->sectiondata[IDX_debug_line]->d_size); /* Get the compilation directory. */ Dwarf_Attribute compdir_attr_mem; - Dwarf_Attribute *compdir_attr = dwarf_attr (cudie, DW_AT_comp_dir, - &compdir_attr_mem); - const char *comp_dir = dwarf_formstring (compdir_attr); + Dwarf_Attribute *compdir_attr = INTUSE(dwarf_attr) (cudie, + DW_AT_comp_dir, + &compdir_attr_mem); + const char *comp_dir = INTUSE(dwarf_formstring) (compdir_attr); if (unlikely (linep + 4 > lineendp)) { @@ -111,7 +164,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) } Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep); unsigned int length = 4; - if (unlikely (unit_length == 0xffffffff)) + if (unlikely (unit_length == DWARF3_LENGTH_64_BIT)) { if (unlikely (linep + 8 > lineendp)) goto invalid_data; @@ -127,7 +180,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* The next element of the header is the version identifier. */ uint_fast16_t version = read_2ubyte_unaligned_inc (dbg, linep); - if (unlikely (version != DWARF_VERSION)) + if (unlikely (version > DWARF_VERSION)) { __libdw_seterrno (DWARF_E_VERSION); goto out; @@ -139,7 +192,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) header_length = read_4ubyte_unaligned_inc (dbg, linep); else header_length = read_8ubyte_unaligned_inc (dbg, linep); - unsigned char *header_start = linep; + const unsigned char *header_start = linep; /* Next the minimum instruction length. */ uint_fast8_t minimum_instr_len = *linep++; @@ -160,7 +213,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* Remember array with the standard opcode length (-1 to account for the opcode with value zero not being mentioned). */ - uint8_t *standard_opcode_lengths = linep - 1; + const uint8_t *standard_opcode_lengths = linep - 1; linep += opcode_base - 1; if (unlikely (linep >= lineendp)) goto invalid_data; @@ -203,13 +256,10 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* Rearrange the list in array form. */ struct dirlist **dirarray = (struct dirlist **) alloca (ndirlist * sizeof (*dirarray)); - while (ndirlist-- > 0) - { - dirarray[ndirlist] = dirlist; - dirlist = dirlist->next; - } + for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next) + dirarray[n] = dirlist; - /* Now read the files. */ + /* Now read the files. */ struct filelist null_file = { .info = @@ -437,7 +487,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) break; } } - else if (opcode <= DW_LNS_set_epilog_begin) + else if (opcode <= DW_LNS_set_epilogue_begin) { /* This is a known standard opcode. */ switch (opcode) @@ -540,7 +590,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) prologue_end = 1; break; - case DW_LNS_set_epilog_begin: + case DW_LNS_set_epilogue_begin: /* Takes no argument. */ if (unlikely (standard_opcode_lengths[opcode] != 0)) goto invalid_data; @@ -565,8 +615,11 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* Put all the files in an array. */ Dwarf_Files *files = libdw_alloc (dbg, Dwarf_Files, sizeof (Dwarf_Files) - + nfilelist * sizeof (Dwarf_Fileinfo), - 1); + + nfilelist * sizeof (Dwarf_Fileinfo) + + (ndirlist + 1) * sizeof (char *), + 1); + const char **dirs = (void *) &files->info[nfilelist]; + files->nfiles = nfilelist; while (nfilelist-- > 0) { @@ -575,24 +628,55 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) } assert (filelist == NULL); + /* Put all the directory strings in an array. */ + files->ndirs = ndirlist; + for (unsigned int i = 0; i < ndirlist; ++i) + dirs[i] = dirarray[i]->dir; + dirs[ndirlist] = NULL; + /* Remember the debugging descriptor. */ files->dbg = dbg; /* Make the file data structure available through the CU. */ cu->files = files; - cu->lines = libdw_alloc (dbg, Dwarf_Lines, (sizeof (Dwarf_Lines) + void *buf = libdw_alloc (dbg, Dwarf_Lines, (sizeof (Dwarf_Lines) + (sizeof (Dwarf_Line) * nlinelist)), 1); - cu->lines->nlines = nlinelist; - while (nlinelist-- > 0) + + /* First use the buffer for the pointers, and sort the entries. + We'll write the pointers in the end of the buffer, and then + copy into the buffer from the beginning so the overlap works. */ + assert (sizeof (Dwarf_Line) >= sizeof (Dwarf_Line *)); + Dwarf_Line **sortlines = (buf + sizeof (Dwarf_Lines) + + ((sizeof (Dwarf_Line) + - sizeof (Dwarf_Line *)) * nlinelist)); + + /* The list is in LIFO order and usually they come in clumps with + ascending addresses. So fill from the back to probably start with + runs already in order before we sort. */ + unsigned int i = nlinelist; + while (i-- > 0) { - cu->lines->info[nlinelist] = linelist->line; - cu->lines->info[nlinelist].files = files; + sortlines[i] = &linelist->line; linelist = linelist->next; } assert (linelist == NULL); + /* Sort by ascending address. */ + qsort (sortlines, nlinelist, sizeof sortlines[0], &compare_lines); + + /* Now that they are sorted, put them in the final array. + The buffers overlap, so we've clobbered the early elements + of SORTLINES by the time we're reading the later ones. */ + cu->lines = buf; + cu->lines->nlines = nlinelist; + for (i = 0; i < nlinelist; ++i) + { + cu->lines->info[i] = *sortlines[i]; + cu->lines->info[i].files = files; + } + /* Success. */ res = 0; } @@ -611,3 +695,4 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) return res; } +INTDEF(dwarf_getsrclines) diff --git a/libdw/dwarf_getstring.c b/libdw/dwarf_getstring.c index e4abe8cb..d5e7abfd 100644 --- a/libdw/dwarf_getstring.c +++ b/libdw/dwarf_getstring.c @@ -1,16 +1,52 @@ /* Get string. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_hasattr.c b/libdw/dwarf_hasattr.c index 15ad8daa..b1c4292a 100644 --- a/libdw/dwarf_hasattr.c +++ b/libdw/dwarf_hasattr.c @@ -1,16 +1,52 @@ /* Check whether given DIE has specific attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -34,3 +70,4 @@ dwarf_hasattr (die, search_name) return code == search_name; } +INTDEF (dwarf_hasattr) diff --git a/libdw/dwarf_hasattr_integrate.c b/libdw/dwarf_hasattr_integrate.c new file mode 100644 index 00000000..12b48631 --- /dev/null +++ b/libdw/dwarf_hasattr_integrate.c @@ -0,0 +1,78 @@ +/* Check whether DIE has specific attribute, integrating DW_AT_abstract_origin. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + +int +dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name) +{ + Dwarf_Die die_mem; + + do + { + if (INTUSE(dwarf_hasattr) (die, search_name)) + return 1; + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_abstract_origin, + &attr_mem); + if (attr == NULL) + break; + + die = INTUSE(dwarf_formref_die) (attr, &die_mem); + } + while (die != NULL); + + return 0; +} diff --git a/libdw/dwarf_haschildren.c b/libdw/dwarf_haschildren.c index 2a9fe5ff..fe431955 100644 --- a/libdw/dwarf_haschildren.c +++ b/libdw/dwarf_haschildren.c @@ -1,16 +1,52 @@ /* Return string associated with given attribute. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -26,9 +62,9 @@ dwarf_haschildren (die) { /* Find the abbreviation entry. */ Dwarf_Abbrev *abbrevp = die->abbrev; - if (abbrevp != (Dwarf_Abbrev *) -1l) + if (abbrevp != DWARF_END_ABBREV) { - unsigned char *readp = (unsigned char *) die->addr; + const unsigned char *readp = (unsigned char *) die->addr; /* First we have to get the abbreviation code so that we can decode the data in the DIE. */ @@ -36,9 +72,9 @@ dwarf_haschildren (die) get_uleb128 (abbrev_code, readp); abbrevp = __libdw_findabbrev (die->cu, abbrev_code); - die->abbrev = abbrevp ?: (Dwarf_Abbrev *) -1l; + die->abbrev = abbrevp ?: DWARF_END_ABBREV; } - if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l)) + if (unlikely (die->abbrev == DWARF_END_ABBREV)) { __libdw_seterrno (DWARF_E_INVALID_DWARF); return 0; @@ -46,3 +82,4 @@ dwarf_haschildren (die) return die->abbrev->has_children; } +INTDEF (dwarf_haschildren) diff --git a/libdw/dwarf_hasform.c b/libdw/dwarf_hasform.c index 392b1f13..66e0e746 100644 --- a/libdw/dwarf_hasform.c +++ b/libdw/dwarf_hasform.c @@ -1,16 +1,52 @@ /* Check whether given attribute has specific form. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_haspc.c b/libdw/dwarf_haspc.c new file mode 100644 index 00000000..58b87b65 --- /dev/null +++ b/libdw/dwarf_haspc.c @@ -0,0 +1,75 @@ +/* Determine whether a DIE covers a PC address. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" +#include <dwarf.h> + + +int +dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc) +{ + if (die == NULL) + return -1; + + Dwarf_Addr base; + Dwarf_Addr begin; + Dwarf_Addr end; + ptrdiff_t offset = 0; + while ((offset = INTUSE(dwarf_ranges) (die, offset, &base, + &begin, &end)) > 0) + if (pc >= begin && pc < end) + return 1; + + return offset; +} +INTDEF (dwarf_haspc) diff --git a/libdw/dwarf_highpc.c b/libdw/dwarf_highpc.c index 019cf141..c88e0721 100644 --- a/libdw/dwarf_highpc.c +++ b/libdw/dwarf_highpc.c @@ -1,16 +1,52 @@ /* Return high PC attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,8 @@ dwarf_highpc (die, return_addr) { Dwarf_Attribute attr_mem; - return dwarf_formaddr (dwarf_attr (die, DW_AT_high_pc, &attr_mem), - return_addr); + return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_high_pc, + &attr_mem), + return_addr); } +INTDEF(dwarf_highpc) diff --git a/libdw/dwarf_lineaddr.c b/libdw/dwarf_lineaddr.c index ddfc01ba..c59dd5d5 100644 --- a/libdw/dwarf_lineaddr.c +++ b/libdw/dwarf_lineaddr.c @@ -1,16 +1,52 @@ /* Return line address. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_linebeginstatement.c b/libdw/dwarf_linebeginstatement.c index d974d8f4..2a99e675 100644 --- a/libdw/dwarf_linebeginstatement.c +++ b/libdw/dwarf_linebeginstatement.c @@ -1,16 +1,52 @@ /* Return true if record is for beginning of a statement. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lineblock.c b/libdw/dwarf_lineblock.c index a6b8e0c2..5ad2bb57 100644 --- a/libdw/dwarf_lineblock.c +++ b/libdw/dwarf_lineblock.c @@ -1,16 +1,52 @@ /* Return true if record is for beginning of a basic block. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_linecol.c b/libdw/dwarf_linecol.c index 2430d372..8a1228c2 100644 --- a/libdw/dwarf_linecol.c +++ b/libdw/dwarf_linecol.c @@ -1,16 +1,52 @@ /* Return column in line. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lineendsequence.c b/libdw/dwarf_lineendsequence.c index c49fabe2..cea86aac 100644 --- a/libdw/dwarf_lineendsequence.c +++ b/libdw/dwarf_lineendsequence.c @@ -1,16 +1,52 @@ /* Return true if record is for end of sequence. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lineepiloguebegin.c b/libdw/dwarf_lineepiloguebegin.c index ee4f5bb7..9d806117 100644 --- a/libdw/dwarf_lineepiloguebegin.c +++ b/libdw/dwarf_lineepiloguebegin.c @@ -1,16 +1,52 @@ /* Return true if record is for beginning of epilogue. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lineno.c b/libdw/dwarf_lineno.c index 5ad24067..98840b15 100644 --- a/libdw/dwarf_lineno.c +++ b/libdw/dwarf_lineno.c @@ -1,16 +1,52 @@ /* Return line number. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lineprologueend.c b/libdw/dwarf_lineprologueend.c index e869025c..c7a05572 100644 --- a/libdw/dwarf_lineprologueend.c +++ b/libdw/dwarf_lineprologueend.c @@ -1,16 +1,52 @@ /* Return true if record is for end of prologue. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_linesrc.c b/libdw/dwarf_linesrc.c index 0aca1d6f..6ecce93f 100644 --- a/libdw/dwarf_linesrc.c +++ b/libdw/dwarf_linesrc.c @@ -1,16 +1,52 @@ /* Find line information for address. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_lowpc.c b/libdw/dwarf_lowpc.c index 95d29120..97ece031 100644 --- a/libdw/dwarf_lowpc.c +++ b/libdw/dwarf_lowpc.c @@ -1,16 +1,52 @@ /* Return low PC attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,8 @@ dwarf_lowpc (die, return_addr) { Dwarf_Attribute attr_mem; - return dwarf_formaddr (dwarf_attr (die, DW_AT_low_pc, &attr_mem), - return_addr); + return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_low_pc, + &attr_mem), + return_addr); } +INTDEF(dwarf_lowpc) diff --git a/libdw/dwarf_macro_opcode.c b/libdw/dwarf_macro_opcode.c new file mode 100644 index 00000000..c40ebc7c --- /dev/null +++ b/libdw/dwarf_macro_opcode.c @@ -0,0 +1,67 @@ +/* Return macro opcode. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +int +dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep) +{ + if (macro == NULL) + return -1; + + *opcodep = macro->opcode; + + return 0; +} diff --git a/libdw/dwarf_macro_param1.c b/libdw/dwarf_macro_param1.c new file mode 100644 index 00000000..409865f5 --- /dev/null +++ b/libdw/dwarf_macro_param1.c @@ -0,0 +1,67 @@ +/* Return first macro parameter. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +int +dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp) +{ + if (macro == NULL) + return -1; + + *paramp = macro->param1; + + return 0; +} diff --git a/libdw/dwarf_macro_param2.c b/libdw/dwarf_macro_param2.c new file mode 100644 index 00000000..c1eff939 --- /dev/null +++ b/libdw/dwarf_macro_param2.c @@ -0,0 +1,70 @@ +/* Return second macro parameter. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +int +dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp, const char **strp) +{ + if (macro == NULL) + return -1; + + if (paramp != NULL) + *paramp = macro->param2.u; + if (strp != NULL) + *strp = macro->param2.s; + + return 0; +} diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c index e674a66e..9e5a96bc 100644 --- a/libdw/dwarf_nextcu.c +++ b/libdw/dwarf_nextcu.c @@ -1,22 +1,59 @@ /* Advance to next CU header. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <libdwP.h> +#include <dwarf.h> int @@ -55,9 +92,9 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, of the .debug_info contribution for that compilation unit, not including the length field itself. In the 32-bit DWARF format, this is a 4-byte unsigned integer (which must be less than - 0xffffff00); in the 64-bit DWARF format, this consists of the + 0xfffffff0); in the 64-bit DWARF format, this consists of the 4-byte value 0xffffffff followed by an 8-byte unsigned integer - that gives the actual length (see Section 7.4). + that gives the actual length (see Section 7.2.2). 2. A 2-byte unsigned integer representing the version of the DWARF information for that compilation unit. For DWARF Version @@ -76,22 +113,27 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, offset portion of an address. */ uint64_t length = read_4ubyte_unaligned_inc (dwarf, bytes); size_t offset_size = 4; - if (length == 0xffffffffu) + /* Lengths of 0xfffffff0 - 0xffffffff are escape codes. Oxffffffff is + used to indicate that 64-bit dwarf information is being used, the + other values are currently reserved. */ + if (length == DWARF3_LENGTH_64_BIT) offset_size = 8; + else if (unlikely (length >= DWARF3_LENGTH_MIN_ESCAPE_CODE + && length <= DWARF3_LENGTH_MAX_ESCAPE_CODE)) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return -1; + } - /* Now we know how large the header is. Note the trick in the - computation. If the offset_size is 4 the '- 4' term undoes the - '2 *'. If offset_size is 8 this term computes the size of the - escape value plus the 8 byte offset. */ - if (unlikely (off + 2 * offset_size - 4 + sizeof (uint16_t) - + offset_size + sizeof (uint8_t) + /* Now we know how large the header is. */ + if (unlikely (DIE_OFFSET_FROM_CU_OFFSET (off, offset_size) >= dwarf->sectiondata[IDX_debug_info]->d_size)) { *next_off = -1; return 1; } - if (length == 0xffffffffu) + if (length == DWARF3_LENGTH_64_BIT) /* This is a 64-bit DWARF format. */ length = read_8ubyte_unaligned_inc (dwarf, bytes); @@ -124,8 +166,10 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, - ((char *) dwarf->sectiondata[IDX_debug_info]->d_buf + off)); - /* See above for an explanation of the trick in this formula. */ + /* See definition of DIE_OFFSET_FROM_CU_OFFSET macro + for an explanation of the trick in this expression. */ *next_off = off + 2 * offset_size - 4 + length; return 0; } +INTDEF(dwarf_nextcu) diff --git a/libdw/dwarf_offabbrev.c b/libdw/dwarf_offabbrev.c index 17978fbc..2cac2794 100644 --- a/libdw/dwarf_offabbrev.c +++ b/libdw/dwarf_offabbrev.c @@ -1,16 +1,52 @@ /* Get abbreviation at given offset. - Copyright (C) 2004 Red Hat, Inc. + Copyright (C) 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -26,5 +62,11 @@ dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp, if (dbg == NULL) return -1; - return __libdw_getabbrev (dbg, NULL, offset, lengthp, abbrevp) == NULL; + Dwarf_Abbrev *abbrev = __libdw_getabbrev (dbg, NULL, offset, lengthp, + abbrevp); + + if (abbrev == NULL) + return -1; + + return abbrev == DWARF_END_ABBREV ? 1 : 0; } diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c index 6ef5595c..a9886f2c 100644 --- a/libdw/dwarf_offdie.c +++ b/libdw/dwarf_offdie.c @@ -1,16 +1,52 @@ /* Return DIE at given offset. - Copyright (C) 2002, 2003 Red Hat, Inc. + Copyright (C) 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -52,3 +88,4 @@ dwarf_offdie (dbg, offset, result) return result; } +INTDEF(dwarf_offdie) diff --git a/libdw/dwarf_onearange.c b/libdw/dwarf_onearange.c index 0c372526..5a9b9f39 100644 --- a/libdw/dwarf_onearange.c +++ b/libdw/dwarf_onearange.c @@ -1,16 +1,52 @@ /* Return one of the address range entries. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_onesrcline.c b/libdw/dwarf_onesrcline.c index 9234ef9a..3e716304 100644 --- a/libdw/dwarf_onesrcline.c +++ b/libdw/dwarf_onesrcline.c @@ -1,16 +1,52 @@ /* Return one of the sources lines of a CU. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c new file mode 100644 index 00000000..89da0af4 --- /dev/null +++ b/libdw/dwarf_ranges.c @@ -0,0 +1,169 @@ +/* Enumerate the PC ranges covered by a DIE. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" +#include <dwarf.h> +#include <assert.h> + + +ptrdiff_t +dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, + Dwarf_Addr *startp, Dwarf_Addr *endp) +{ + if (die == NULL) + return -1; + + if (offset == 0 + /* Usually there is a single contiguous range. */ + && INTUSE(dwarf_highpc) (die, endp) == 0 + && INTUSE(dwarf_lowpc) (die, startp) == 0) + /* A offset into .debug_ranges will never be 1, it must be at least a + multiple of 4. So we can return 1 as a special case value to mark + there are no ranges to look for on the next call. */ + return 1; + + if (offset == 1) + return 0; + + /* We have to look for a noncontiguous range. */ + + const Elf_Data *d = die->cu->dbg->sectiondata[IDX_debug_ranges]; + if (d == NULL) + { + __libdw_seterrno (DWARF_E_NO_DEBUG_RANGES); + return -1; + } + + if (offset == 0) + { + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_ranges, + &attr_mem); + if (attr == NULL) + return -1; + + /* Must have the form data4 or data8 which act as an offset. */ + Dwarf_Word start_offset; + if (INTUSE(dwarf_formudata) (attr, &start_offset) != 0) + return -1; + + offset = start_offset; + assert ((Dwarf_Word) offset == start_offset); + + /* Fetch the CU's base address. */ + Dwarf_Die cudie = CUDIE (attr->cu); + + /* Find the base address of the compilation unit. It will + normally be specified by DW_AT_low_pc. In DWARF-3 draft 4, + the base address could be overridden by DW_AT_entry_pc. It's + been removed, but GCC emits DW_AT_entry_pc and not DW_AT_lowpc + for compilation units with discontinuous ranges. */ + if (unlikely (INTUSE(dwarf_lowpc) (&cudie, basep) != 0) + && INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (&cudie, + DW_AT_entry_pc, + &attr_mem), + basep) != 0) + { + if (INTUSE(dwarf_errno) () == 0) + { + invalid: + __libdw_seterrno (DWARF_E_INVALID_DWARF); + } + return -1; + } + } + else if (offset < 0 || (size_t) offset >= d->d_size) + { + __libdw_seterrno (DWARF_E_INVALID_OFFSET); + return -1l; + } + + unsigned char *readp = d->d_buf + offset; + + next: + if ((unsigned char *) d->d_buf + d->d_size - readp + < die->cu->address_size * 2) + goto invalid; + + Dwarf_Addr begin; + Dwarf_Addr end; + if (die->cu->address_size == 8) + { + begin = read_8ubyte_unaligned_inc (die->cu->dbg, readp); + end = read_8ubyte_unaligned_inc (die->cu->dbg, readp); + if (begin == (uint64_t) -1l) /* Base address entry. */ + { + *basep = end; + goto next; + } + } + else + { + begin = read_4ubyte_unaligned_inc (die->cu->dbg, readp); + end = read_4ubyte_unaligned_inc (die->cu->dbg, readp); + if (begin == (uint32_t) -1) /* Base address entry. */ + { + *basep = end; + goto next; + } + } + + if (begin == 0 && end == 0) /* End of list entry. */ + return 0; + + /* We have an address range entry. */ + *startp = *basep + begin; + *endp = *basep + end; + return readp - (unsigned char *) d->d_buf; +} +INTDEF (dwarf_ranges) diff --git a/libdw/dwarf_siblingof.c b/libdw/dwarf_siblingof.c index 90081c64..0d427175 100644 --- a/libdw/dwarf_siblingof.c +++ b/libdw/dwarf_siblingof.c @@ -1,16 +1,52 @@ /* Return sibling of given DIE. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -30,6 +66,12 @@ dwarf_siblingof (die, result) if (die == NULL) return -1; + if (result == NULL) + return -1; + + if (result != die) + result->addr = NULL; + unsigned int level = 0; /* Copy of the current DIE. */ @@ -40,6 +82,10 @@ dwarf_siblingof (die, result) sibattr.cu = this_die.cu; /* That's the address we start looking. */ unsigned char *addr = this_die.addr; + /* End of the buffer. */ + unsigned char *endp + = ((unsigned char *) sibattr.cu->dbg->sectiondata[IDX_debug_info]->d_buf + + sibattr.cu->end); /* Search for the beginning of the next die on this level. We must not return the dies for children of the given die. */ @@ -52,7 +98,7 @@ dwarf_siblingof (die, result) { Dwarf_Off offset; sibattr.valp = addr; - if (dwarf_formref (&sibattr, &offset) != 0) + if (unlikely (__libdw_formref (&sibattr, &offset) != 0)) /* Something went wrong. */ return -1; @@ -62,19 +108,31 @@ dwarf_siblingof (die, result) + sibattr.cu->start + offset); } else if (unlikely (addr == NULL) - || unlikely (this_die.abbrev == (Dwarf_Abbrev *) -1l)) + || unlikely (this_die.abbrev == DWARF_END_ABBREV)) return -1; else if (this_die.abbrev->has_children) /* This abbreviation has children. */ ++level; - /* Check that we are not yet at the end. */ - while (*addr == '\0') + + while (1) { - if (level-- == 0) - /* No more sibling at all. */ + /* Make sure we are still in range. Some producers might skip + the trailing NUL bytes. */ + if (addr >= endp) return 1; + if (*addr != '\0') + break; + + if (level-- == 0) + { + if (result != die) + result->addr = addr; + /* No more sibling at all. */ + return 1; + } + ++addr; } @@ -85,9 +143,7 @@ dwarf_siblingof (die, result) while (level > 0); /* Maybe we reached the end of the CU. */ - if (addr - >= ((unsigned char *) sibattr.cu->dbg->sectiondata[IDX_debug_info]->d_buf - + sibattr.cu->end)) + if (addr >= endp) return 1; /* Clear the entire DIE structure. This signals we have not yet @@ -102,3 +158,4 @@ dwarf_siblingof (die, result) return 0; } +INTDEF(dwarf_siblingof) diff --git a/libdw/dwarf_srclang.c b/libdw/dwarf_srclang.c index fc256321..2efa0954 100644 --- a/libdw/dwarf_srclang.c +++ b/libdw/dwarf_srclang.c @@ -1,16 +1,52 @@ /* Return source language attribute of DIE. - Copyright (C) 2003 Red Hat, Inc. + Copyright (C) 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,6 +63,7 @@ dwarf_srclang (die) Dwarf_Attribute attr_mem; Dwarf_Word value; - return dwarf_formudata (dwarf_attr (die, DW_AT_language, &attr_mem), - &value) == 0 ? (int) value : -1; + return INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (die, DW_AT_language, + &attr_mem), + &value) == 0 ? (int) value : -1; } diff --git a/libdw/dwarf_tag.c b/libdw/dwarf_tag.c index 23814cbc..15183d2d 100644 --- a/libdw/dwarf_tag.c +++ b/libdw/dwarf_tag.c @@ -1,16 +1,52 @@ /* Return tag of given DIE. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -20,7 +56,7 @@ Dwarf_Abbrev * -internal_function_def +internal_function __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) { Dwarf_Abbrev *abb; @@ -36,12 +72,11 @@ __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) hash table. */ abb = __libdw_getabbrev (cu->dbg, cu, cu->last_abbrev_offset, &length, NULL); - if (abb == NULL) + if (abb == NULL || abb == DWARF_END_ABBREV) { /* Make sure we do not try to search for it again. */ cu->last_abbrev_offset = (size_t) -1l; - abb = (void *) -1l; - break; + return DWARF_END_ABBREV; } cu->last_abbrev_offset += length; @@ -64,14 +99,14 @@ dwarf_tag (die) { /* Get the abbreviation code. */ unsigned int u128; - unsigned char *addr = die->addr; + const unsigned char *addr = die->addr; get_uleb128 (u128, addr); /* Find the abbreviation. */ die->abbrev = __libdw_findabbrev (die->cu, u128); } - if (die->abbrev == (Dwarf_Abbrev *) -1l) + if (unlikely (die->abbrev == DWARF_END_ABBREV)) { __libdw_seterrno (DWARF_E_INVALID_DWARF); return DW_TAG_invalid; @@ -79,3 +114,4 @@ dwarf_tag (die) return die->abbrev->tag; } +INTDEF(dwarf_tag) diff --git a/libdw/dwarf_whatattr.c b/libdw/dwarf_whatattr.c index ad5d868f..9b8bddf1 100644 --- a/libdw/dwarf_whatattr.c +++ b/libdw/dwarf_whatattr.c @@ -1,16 +1,52 @@ /* Return attribute code of given attribute. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/dwarf_whatform.c b/libdw/dwarf_whatform.c index 99da1c97..8a9076b8 100644 --- a/libdw/dwarf_whatform.c +++ b/libdw/dwarf_whatform.c @@ -1,16 +1,52 @@ /* Return form code of given attribute. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libdw/libdw.h b/libdw/libdw.h index eee986ff..3f3e5a09 100644 --- a/libdw/libdw.h +++ b/libdw/libdw.h @@ -1,16 +1,51 @@ /* Interfaces for libdw. - Copyright (C) 2002, 2004 Red Hat, Inc. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBDW_H #define _LIBDW_H 1 @@ -22,8 +57,17 @@ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__))) +# define __deprecated_attribute__ __attribute__ ((__deprecated__)) #else # define __nonnull_attribute__(args...) +# define __deprecated_attribute__ +#endif + + +#ifdef __GNUC_STDC_INLINE__ +# define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__)) +#else +# define __libdw_extern_inline extern __inline #endif @@ -69,6 +113,9 @@ typedef GElf_Half Dwarf_Half; /* DWARF abbreviation record. */ typedef struct Dwarf_Abbrev Dwarf_Abbrev; +/* Returned to show the last DIE has be returned. */ +#define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l) + /* Source code line information for CU. */ typedef struct Dwarf_Lines_s Dwarf_Lines; @@ -87,6 +134,9 @@ typedef struct Dwarf_Aranges_s Dwarf_Aranges; /* CU representation. */ struct Dwarf_CU; +/* Macro information. */ +typedef struct Dwarf_Macro_s Dwarf_Macro; + /* Attribute representation. */ typedef struct { @@ -105,19 +155,6 @@ typedef struct } Dwarf_Block; -/* Macro information. */ -typedef struct -{ - unsigned int opcode; - Dwarf_Word param1; - union - { - Dwarf_Word u; - const char *s; - } param2; -} Dwarf_Macro; - - /* DIE information. */ typedef struct { @@ -126,6 +163,7 @@ typedef struct struct Dwarf_CU *cu; Dwarf_Abbrev *abbrev; // XXX We'll see what other information will be needed. + long int padding__; } Dwarf_Die; /* Returned to show the last DIE has be returned. */ @@ -141,15 +179,15 @@ typedef struct } Dwarf_Global; -// XXX It remains to be seen whether the next two need to be exported. -/* Location record. */ +/* One operation in a DWARF location expression. + A location expression is an array of these. */ typedef struct { uint8_t atom; /* Operation */ Dwarf_Word number; /* Operand */ Dwarf_Word number2; /* Possible second operand */ Dwarf_Word offset; /* Offset in location expression */ -} Dwarf_Loc; +} Dwarf_Op; /* Handle for debug sessions. */ @@ -157,9 +195,17 @@ typedef struct Dwarf Dwarf; /* Out-Of-Memory handler. */ +#if __GNUC__ < 4 +typedef void (*Dwarf_OOM) (void); +#else typedef void (*__attribute__ ((noreturn)) Dwarf_OOM) (void); +#endif +#ifdef __cplusplus +extern "C" { +#endif + /* Create a handle for a new debug session. */ extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd); @@ -193,24 +239,44 @@ extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die); /* Return offset of DIE in CU. */ extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die); -/* Return vhild of current DIE. */ +/* Return CU DIE containing given DIE. */ +extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result, + uint8_t *address_sizep, uint8_t *offset_sizep) + __nonnull_attribute__ (2); + +/* Return CU DIE containing given address. */ +extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr, + Dwarf_Die *result) __nonnull_attribute__ (3); + +/* Return child of current DIE. */ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); -/* Return sibling of given DIE. */ +/* Locates the first sibling of DIE and places it in RESULT. + Returns 0 if a sibling was found, -1 if something went wrong. + Returns 1 if no sibling could be found and, if RESULT is not + the same as DIE, it sets RESULT->addr to the address of the + (non-sibling) DIE that follows this one, or NULL if this DIE + was the last one in the cokmpilation unit. */ extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); /* Check whether the DIE has children. */ -extern int dwarf_haschildren (Dwarf_Die *die); - -/* Get attributes of the DIE. */ +extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1); + +/* Walks the attributes of DIE, starting at the one OFFSET bytes in, + calling the CALLBACK function for each one. Stops if the callback + function ever returns a value other than DWARF_CB_OK and returns the + offset of the offending attribute. If the end of the attributes + is reached 1 is returned. If something goes wrong -1 is returned and + the dwarf error number is set. */ extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), - void *arg, ptrdiff_t offset); + void *arg, ptrdiff_t offset) + __nonnull_attribute__ (2); /* Return tag of given DIE. */ -extern int dwarf_tag (Dwarf_Die *die); +extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1); /* Return specific attribute of DIE. */ @@ -221,6 +287,16 @@ extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name, /* Check whether given DIE has specific attribute. */ extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name); +/* These are the same as dwarf_attr and dwarf_hasattr, respectively, + but they resolve an indirect attribute through DW_AT_abstract_origin. */ +extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die, + unsigned int search_name, + Dwarf_Attribute *result) + __nonnull_attribute__ (3); +extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name); + + + /* Check whether given attribute has specific form. */ extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form); @@ -247,8 +323,13 @@ extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval) extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); -/* Return reference offset represented by attribute. */ +/* This function is deprecated. Always use dwarf_formref_die instead. + Return reference offset represented by attribute. */ extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset) + __nonnull_attribute__ (2) __deprecated_attribute__; + +/* Look up the DIE in a reference-form attribute. */ +extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem) __nonnull_attribute__ (2); /* Return block represented by attribute. */ @@ -273,6 +354,26 @@ extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr) extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); +/* Return entry_pc or low_pc attribute of DIE. */ +extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr) + __nonnull_attribute__ (2); + +/* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address, + 0 if not, or -1 for errors. */ +extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc); + +/* Enumerate the PC address ranges covered by this DIE, covering all + addresses where dwarf_haspc returns true. In the first call OFFSET + should be zero and *BASEP need not be initialized. Returns -1 for + errors, zero when there are no more address ranges to report, or a + nonzero OFFSET value to pass to the next call. Each subsequent call + must preserve *BASEP from the prior call. Successful calls fill in + *STARTP and *ENDP with a contiguous address range. */ +extern ptrdiff_t dwarf_ranges (Dwarf_Die *die, + ptrdiff_t offset, Dwarf_Addr *basep, + Dwarf_Addr *startp, Dwarf_Addr *endp); + + /* Return byte size attribute of DIE. */ extern int dwarf_bytesize (Dwarf_Die *die); @@ -346,6 +447,12 @@ extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, /* Get source for address in CU. */ extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr); +/* Get source for file and line number. */ +extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col, + Dwarf_Line ***srcsp, size_t *nsrcs) + __nonnull_attribute__ (2, 5, 6); + + /* Return line address. */ extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp); @@ -386,10 +493,64 @@ extern const char *dwarf_linesrc (Dwarf_Line *line, extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx, Dwarf_Word *mtime, Dwarf_Word *length); - -/* Return location expression list. */ -extern int dwarf_getloclist (Dwarf_Attribute *attr, Dwarf_Loc **llbuf, - size_t *listlen) __nonnull_attribute__ (2, 3); +/* Return the directory list used in the file information extracted. + (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null. + (*RESULT)[0..*NDIRS-1] are the compile-time include directory path + encoded by the compiler. */ +extern int dwarf_getsrcdirs (Dwarf_Files *files, + const char *const **result, size_t *ndirs) + __nonnull_attribute__ (2, 3); + + +/* Return location expression, decoded as a list of operations. */ +extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr, + size_t *exprlen) __nonnull_attribute__ (2, 3); + +/* Return location expressions. If the attribute uses a location list, + ADDRESS selects the relevant location expressions from the list. + There can be multiple matches, resulting in multiple expressions to + return. EXPRS and EXPRLENS are parallel arrays of NLOCS slots to + fill in. Returns the number of locations filled in, or -1 for + errors. If EXPRS is a null pointer, stores nothing and returns the + total number of locations. A return value of zero means that the + location list indicated no value is accessible. */ +extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address, + Dwarf_Op **exprs, size_t *exprlens, + size_t nlocs); + + +/* Return scope DIEs containing PC address. + Sets *SCOPES to a malloc'd array of Dwarf_Die structures, + and returns the number of elements in the array. + (*SCOPES)[0] is the DIE for the innermost scope containing PC, + (*SCOPES)[1] is the DIE for the scope containing that scope, and so on. + Returns -1 for errors or 0 if no scopes match PC. */ +extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, + Dwarf_Die **scopes); + +/* Return scope DIEs containing the given DIE. + Sets *SCOPES to a malloc'd array of Dwarf_Die structures, + and returns the number of elements in the array. + (*SCOPES)[0] is a copy of DIE. + (*SCOPES)[1] is the DIE for the scope containing that scope, and so on. + Returns -1 for errors or 0 if DIE is not found in any scope entry. */ +extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes); + + +/* Search SCOPES[0..NSCOPES-1] for a variable called NAME. + Ignore the first SKIP_SHADOWS scopes that match the name. + If MATCH_FILE is not null, accept only declaration in that source file; + if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration + at that line and column. + + If successful, fill in *RESULT with the DIE of the variable found, + and return N where SCOPES[N] is the scope defining the variable. + Return -1 for errors or -2 for no matching variable found. */ +extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes, + const char *name, int skip_shadows, + const char *match_file, + int match_lineno, int match_linecol, + Dwarf_Die *result); @@ -410,6 +571,41 @@ extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges, Dwarf_Addr addr); + +/* Get functions in CUDIE. */ +extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie, + int (*callback) (Dwarf_Die *, void *), + void *arg, ptrdiff_t offset); + + +/* Return file name containing definition of the given declaration. */ +extern const char *dwarf_decl_file (Dwarf_Die *decl); + +/* Get line number of beginning of given declaration. */ +extern int dwarf_decl_line (Dwarf_Die *decl, int *linep) + __nonnull_attribute__ (2); + +/* Get column number of beginning of given declaration. */ +extern int dwarf_decl_column (Dwarf_Die *decl, int *colp) + __nonnull_attribute__ (2); + + +/* Return nonzero if given function is an abstract inline definition. */ +extern int dwarf_func_inline (Dwarf_Die *func); + +/* Find each concrete inlined instance of the abstract inline definition. */ +extern int dwarf_func_inline_instances (Dwarf_Die *func, + int (*callback) (Dwarf_Die *, void *), + void *arg); + + +/* Find the appropriate PC location or locations for function entry + breakpoints for the given DW_TAG_subprogram DIE. Returns -1 for errors. + On success, returns the number of breakpoint locations (never zero) + and sets *BKPTS to a malloc'd vector of addresses. */ +extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts); + + /* Call callback function for each of the macro information entry for the CU. */ extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie, @@ -417,6 +613,18 @@ extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie, void *arg, ptrdiff_t offset) __nonnull_attribute__ (2); +/* Return macro opcode. */ +extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep) + __nonnull_attribute__ (2); + +/* Return first macro parameter. */ +extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp) + __nonnull_attribute__ (2); + +/* Return second macro parameter. */ +extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp, + const char **strp); + /* Return error code of last failing function call. This value is kept separately for each thread. */ @@ -436,18 +644,22 @@ extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler); /* Inline optimizations. */ #ifdef __OPTIMIZE__ /* Return attribute code of given attribute. */ -extern inline unsigned int +__libdw_extern_inline unsigned int dwarf_whatattr (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->code; } /* Return attribute code of given attribute. */ -extern inline unsigned int +__libdw_extern_inline unsigned int dwarf_whatform (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->form; } #endif /* Optimize. */ +#ifdef __cplusplus +} +#endif + #endif /* libdw.h */ diff --git a/libdw/libdw.map b/libdw/libdw.map index e9ae2b9b..eb3abc28 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -1,8 +1,11 @@ -ELFUTILS_1.0 { +ELFUTILS_0 { }; +ELFUTILS_0.122 { global: dwarf_abbrevhaschildren; - dwarf_attr; + dwarf_addrdie; dwarf_arrayorder; + dwarf_attr; + dwarf_attr_integrate; dwarf_begin; dwarf_begin_elf; dwarf_bitoffset; @@ -10,9 +13,15 @@ ELFUTILS_1.0 { dwarf_bytesize; dwarf_child; dwarf_cuoffset; + dwarf_decl_column; + dwarf_decl_file; + dwarf_decl_line; + dwarf_diecu; dwarf_diename; dwarf_dieoffset; dwarf_end; + dwarf_entry_breakpoints; + dwarf_entrypc; dwarf_errmsg; dwarf_errno; dwarf_filesrc; @@ -20,9 +29,12 @@ ELFUTILS_1.0 { dwarf_formblock; dwarf_formflag; dwarf_formref; + dwarf_formref_die; dwarf_formsdata; dwarf_formstring; dwarf_formudata; + dwarf_func_inline; + dwarf_func_inline_instances; dwarf_getabbrev; dwarf_getabbrevattr; dwarf_getabbrevcode; @@ -32,18 +44,25 @@ ELFUTILS_1.0 { dwarf_getaranges; dwarf_getattrcnt; dwarf_getattrs; - dwarf_getelf; - dwarf_getloclist; + dwarf_getfuncs; + dwarf_getlocation; + dwarf_getlocation_addr; dwarf_getmacros; dwarf_getpubnames; dwarf_getscn_info; + dwarf_getscopes; + dwarf_getscopes_die; + dwarf_getscopevar; dwarf_getsrc_die; + dwarf_getsrc_file; dwarf_getsrcfiles; dwarf_getsrclines; dwarf_getstring; dwarf_hasattr; + dwarf_hasattr_integrate; dwarf_haschildren; dwarf_hasform; + dwarf_haspc; dwarf_highpc; dwarf_lineaddr; dwarf_linebeginstatement; @@ -55,18 +74,123 @@ ELFUTILS_1.0 { dwarf_lineprologueend; dwarf_linesrc; dwarf_lowpc; + dwarf_macro_opcode; + dwarf_macro_param1; + dwarf_macro_param2; + dwarf_new_oom_handler; + dwarf_nextcu; dwarf_offabbrev; dwarf_offdie; dwarf_onearange; dwarf_onesrcline; - dwarf_nextcu; - dwarf_new_oom_handler; + dwarf_ranges; dwarf_siblingof; dwarf_srclang; dwarf_tag; dwarf_whatattr; dwarf_whatform; + # libdwfl_pic.a contributes these symbols. + dwfl_addrdie; + dwfl_addrdwarf; + dwfl_addrmodule; + dwfl_begin; + dwfl_cumodule; + dwfl_end; + dwfl_errmsg; + dwfl_errno; + dwfl_getdwarf; + dwfl_getmodules; + dwfl_getsrc; + dwfl_getsrclines; + dwfl_line_comp_dir; + dwfl_linecu; + dwfl_lineinfo; + dwfl_linemodule; + dwfl_linux_kernel_find_elf; + dwfl_linux_kernel_module_section_address; + dwfl_linux_kernel_report_kernel; + dwfl_linux_kernel_report_modules; + dwfl_linux_kernel_report_offline; + dwfl_linux_proc_find_elf; + dwfl_linux_proc_maps_report; + dwfl_linux_proc_report; + dwfl_module_addrdie; + dwfl_module_addrname; + dwfl_module_getdwarf; + dwfl_module_getelf; + dwfl_module_getsrc; + dwfl_module_getsrc_file; + dwfl_module_getsym; + dwfl_module_getsymtab; + dwfl_module_info; + dwfl_module_nextcu; + dwfl_module_register_names; + dwfl_module_relocate_address; + dwfl_module_relocation_info; + dwfl_module_relocations; + dwfl_module_return_value_location; + dwfl_nextcu; + dwfl_offline_section_address; + dwfl_onesrcline; + dwfl_report_begin; + dwfl_report_elf; + dwfl_report_end; + dwfl_report_module; + dwfl_report_offline; + dwfl_standard_argp; + dwfl_standard_find_debuginfo; + dwfl_version; + + local: + *; +} ELFUTILS_0; + +ELFUTILS_0.126 { + global: + dwarf_getelf; + + local: + *; +} ELFUTILS_0.122; + +ELFUTILS_0.127 { + global: + dwarf_getsrcdirs; + + dwfl_module_addrsym; + dwfl_report_begin_add; + dwfl_module_address_section; + + local: + *; +} ELFUTILS_0.126; + +ELFUTILS_0.130 { + global: + dwfl_build_id_find_elf; + dwfl_build_id_find_debuginfo; + dwfl_module_build_id; + dwfl_module_report_build_id; + + local: + *; +} ELFUTILS_0.127; + +ELFUTILS_0.136 { + global: + dwfl_addrsegment; + dwfl_report_segment; + + local: + *; +} ELFUTILS_0.130; + +ELFUTILS_0.138 { + global: + # Replaced ELFUTILS_0.130 version, which has bug-compatibility wrapper. + dwfl_module_build_id; + local: *; -}; +} ELFUTILS_0.136; diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 892ad513..f805295f 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -1,16 +1,52 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBDWP_H #define _LIBDWP_H 1 @@ -26,17 +62,17 @@ /* Version of the DWARF specification we support. */ -#define DWARF_VERSION 2 +#define DWARF_VERSION 3 /* Version of the CIE format. */ #define CIE_VERSION 1 -/* Known location lists. */ +/* Known location expressions already decoded. */ struct loc_s { void *addr; - Dwarf_Loc *loc; + Dwarf_Op *loc; size_t nloc; }; @@ -57,6 +93,7 @@ enum IDX_debug_varnames, IDX_debug_weaknames, IDX_debug_macinfo, + IDX_debug_ranges, IDX_last }; @@ -97,6 +134,8 @@ enum DWARF_E_INVALID_ARANGE_IDX, DWARF_E_NO_MATCH, DWARF_E_NO_FLAG, + DWARF_E_INVALID_OFFSET, + DWARF_E_NO_DEBUG_RANGES, }; @@ -170,6 +209,7 @@ struct Dwarf_Abbrev struct Dwarf_Files_s { Dwarf *dbg; + unsigned int ndirs; unsigned int nfiles; struct Dwarf_Fileinfo_s { @@ -177,6 +217,7 @@ struct Dwarf_Files_s Dwarf_Word mtime; Dwarf_Word length; } info[0]; + /* nfiles of those, followed by char *[ndirs]. */ }; typedef struct Dwarf_Fileinfo_s Dwarf_Fileinfo; @@ -226,6 +267,7 @@ struct Dwarf_CU Dwarf_Off end; uint8_t address_size; uint8_t offset_size; + uint16_t version; /* Hash table for the abbreviations. */ Dwarf_Abbrev_Hash abbrev_hash; @@ -244,6 +286,40 @@ struct Dwarf_CU void *locs; }; +/* Compute the offset of a CU's first DIE from its offset. This + is either: + LEN VER OFFSET ADDR + 4-bytes + 2-bytes + 4-bytes + 1-byte for 32-bit dwarf + 12-bytes + 2-bytes + 8-bytes + 1-byte for 64-bit dwarf + + Note the trick in the computation. If the offset_size is 4 + the '- 4' term changes the '3 *' into a '2 *'. If the + offset_size is 8 it accounts for the 4-byte escape value + used at the start of the length. */ +#define DIE_OFFSET_FROM_CU_OFFSET(cu_offset, offset_size) \ + ((cu_offset) + 3 * (offset_size) - 4 + 3) + +#define CUDIE(fromcu) \ + ((Dwarf_Die) \ + { \ + .cu = (fromcu), \ + .addr = ((char *) (fromcu)->dbg->sectiondata[IDX_debug_info]->d_buf \ + + (fromcu)->start + 3 * (fromcu)->offset_size - 4 + 3), \ + }) + + +/* Macro information. */ +struct Dwarf_Macro_s +{ + unsigned int opcode; + Dwarf_Word param1; + union + { + Dwarf_Word u; + const char *s; + } param2; +}; + /* We have to include the file at this point because the inline functions access internals of the Dwarf structure. */ @@ -263,23 +339,20 @@ extern void __libdw_seterrno (int value) internal_function; - ((uintptr_t) _result & (__alignof (type) - 1))) \ & (__alignof (type) - 1)); \ if (unlikely (_tail->remaining < _required + _padding)) \ - { \ - _result = (type *) __libdw_allocate (dbg, _required); \ - _tail = (dbg)->mem_tail; \ - } \ + _result = (type *) __libdw_allocate (dbg, _required, __alignof (type));\ else \ { \ _required += _padding; \ _result = (type *) ((char *) _result + _padding); \ + _tail->remaining -= _required; \ } \ - _tail->remaining -= _required; \ _result; }) #define libdw_typed_alloc(dbg, type) \ libdw_alloc (dbg, type, sizeof (type), 1) /* Callback to allocate more. */ -extern void *__libdw_allocate (Dwarf *dbg, size_t minsize) +extern void *__libdw_allocate (Dwarf *dbg, size_t minsize, size_t align) __attribute__ ((__malloc__)) __nonnull_attribute__ (1); /* Default OOM handler. */ @@ -302,9 +375,15 @@ extern Dwarf_Abbrev *__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, /* Helper functions for form handling. */ extern size_t __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, - unsigned int form, unsigned char *valp) + unsigned int form, + const unsigned char *valp) __nonnull_attribute__ (1, 2, 4) internal_function; +/* Helper function for DW_FORM_ref* handling. */ +extern int __libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset) + __nonnull_attribute__ (1, 2) internal_function; + + /* Helper function to locate attribute. */ extern unsigned char *__libdw_find_attr (Dwarf_Die *die, unsigned int search_name, @@ -312,4 +391,63 @@ extern unsigned char *__libdw_find_attr (Dwarf_Die *die, unsigned int *formp) __nonnull_attribute__ (1) internal_function; +/* Helper function to access integer attribute. */ +extern int __libdw_attr_intval (Dwarf_Die *die, int *valp, int attval) + __nonnull_attribute__ (1, 2) internal_function; + +/* Helper function to walk scopes. */ +struct Dwarf_Die_Chain +{ + Dwarf_Die die; + struct Dwarf_Die_Chain *parent; + bool prune; /* The PREVISIT function can set this. */ +}; +extern int __libdw_visit_scopes (unsigned int depth, + struct Dwarf_Die_Chain *root, + int (*previsit) (unsigned int depth, + struct Dwarf_Die_Chain *, + void *arg), + int (*postvisit) (unsigned int depth, + struct Dwarf_Die_Chain *, + void *arg), + void *arg) + __nonnull_attribute__ (2, 3) internal_function; + +/* Return error code of last failing function call. This value is kept + separately for each thread. */ +extern int __dwarf_errno_internal (void); + + +/* Aliases to avoid PLTs. */ +INTDECL (dwarf_attr) +INTDECL (dwarf_attr_integrate) +INTDECL (dwarf_begin_elf) +INTDECL (dwarf_child) +INTDECL (dwarf_dieoffset) +INTDECL (dwarf_diename) +INTDECL (dwarf_end) +INTDECL (dwarf_entrypc) +INTDECL (dwarf_errmsg) +INTDECL (dwarf_formaddr) +INTDECL (dwarf_formblock) +INTDECL (dwarf_formref_die) +INTDECL (dwarf_formsdata) +INTDECL (dwarf_formstring) +INTDECL (dwarf_formudata) +INTDECL (dwarf_getarange_addr) +INTDECL (dwarf_getarangeinfo) +INTDECL (dwarf_getaranges) +INTDECL (dwarf_getsrcfiles) +INTDECL (dwarf_getsrclines) +INTDECL (dwarf_hasattr) +INTDECL (dwarf_haschildren) +INTDECL (dwarf_haspc) +INTDECL (dwarf_highpc) +INTDECL (dwarf_lowpc) +INTDECL (dwarf_nextcu) +INTDECL (dwarf_offdie) +INTDECL (dwarf_ranges) +INTDECL (dwarf_siblingof) +INTDECL (dwarf_tag) + #endif /* libdwP.h */ diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c index 1c53d366..9ca6aa74 100644 --- a/libdw/libdw_alloc.c +++ b/libdw/libdw_alloc.c @@ -1,16 +1,52 @@ /* Memory handling for libdw. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -22,22 +58,29 @@ #include <sys/param.h> #include "libdwP.h" +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ void * -__libdw_allocate (Dwarf *dbg, size_t minsize) +__libdw_allocate (Dwarf *dbg, size_t minsize, size_t align) { size_t size = MAX (dbg->mem_default_size, - 2 * minsize + offsetof (struct libdw_memblock, mem)); + (align - 1 + + 2 * minsize + offsetof (struct libdw_memblock, mem))); struct libdw_memblock *newp = malloc (size); if (newp == NULL) dbg->oom_handler (); - newp->size = newp->remaining = size - offsetof (struct libdw_memblock, mem); + uintptr_t result = ((uintptr_t) newp->mem + align - 1) & ~(align - 1); + + newp->size = size - offsetof (struct libdw_memblock, mem); + newp->remaining = (uintptr_t) newp + size - (result + minsize); newp->prev = dbg->mem_tail; dbg->mem_tail = newp; - return newp->mem; + return (void *) result; } diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c index b8166572..afff6d3a 100644 --- a/libdw/libdw_findcu.c +++ b/libdw/libdw_findcu.c @@ -1,16 +1,52 @@ /* Find CU for given offset. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -61,6 +97,7 @@ __libdw_findcu (dbg, start) if (start < dbg->next_cu_offset) { + invalid: __libdw_seterrno (DWARF_E_INVALID_DWARF); return NULL; } @@ -73,11 +110,21 @@ __libdw_findcu (dbg, start) uint8_t offset_size; Dwarf_Off abbrev_offset; - if (dwarf_nextcu (dbg, oldoff, &dbg->next_cu_offset, NULL, - &abbrev_offset, &address_size, &offset_size) != 0) + if (INTUSE(dwarf_nextcu) (dbg, oldoff, &dbg->next_cu_offset, NULL, + &abbrev_offset, &address_size, &offset_size) + != 0) /* No more entries. */ return NULL; + /* XXX We need the version number but dwarf_nextcu swallows it. */ + const char *bytes = (dbg->sectiondata[IDX_debug_info]->d_buf + oldoff + + (2 * offset_size - 4)); + uint16_t version = read_2ubyte_unaligned (dbg, bytes); + + /* We only know how to handle the DWARF version 2 and 3 formats. */ + if (unlikely (version != 2) && unlikely (version != 3)) + goto invalid; + /* Create an entry for this CU. */ struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU); @@ -86,6 +133,7 @@ __libdw_findcu (dbg, start) newp->end = dbg->next_cu_offset; newp->address_size = address_size; newp->offset_size = offset_size; + newp->version = version; Dwarf_Abbrev_Hash_init (&newp->abbrev_hash, 41); newp->orig_abbrev_offset = newp->last_abbrev_offset = abbrev_offset; newp->lines = NULL; diff --git a/libdw/libdw_form.c b/libdw/libdw_form.c index 2543f5a2..ad78f4b4 100644 --- a/libdw/libdw_form.c +++ b/libdw/libdw_form.c @@ -1,16 +1,52 @@ /* Helper functions for form handling. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -23,12 +59,12 @@ size_t -internal_function_def +internal_function __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, - unsigned char *valp) + const unsigned char *valp) { - unsigned char *saved; - unsigned int u128; + const unsigned char *saved; + Dwarf_Word u128; size_t result; switch (form) @@ -37,8 +73,11 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, result = cu->address_size; break; - case DW_FORM_strp: case DW_FORM_ref_addr: + result = cu->version == 2 ? cu->address_size : cu->offset_size; + break; + + case DW_FORM_strp: result = cu->offset_size; break; diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c new file mode 100644 index 00000000..9c7c3789 --- /dev/null +++ b/libdw/libdw_visit_scopes.c @@ -0,0 +1,177 @@ +/* Helper functions to descend DWARF scope trees. + Copyright (C) 2005,2006,2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" +#include <dwarf.h> + +enum die_class { ignore, match, match_inline, walk, imported }; + +static enum die_class +classify_die (Dwarf_Die *die) +{ + switch (INTUSE(dwarf_tag) (die)) + { + /* DIEs with addresses we can try to match. */ + case DW_TAG_compile_unit: + case DW_TAG_module: + case DW_TAG_lexical_block: + case DW_TAG_with_stmt: + case DW_TAG_catch_block: + case DW_TAG_try_block: + case DW_TAG_entry_point: + return match; + case DW_TAG_inlined_subroutine: + return match_inline; + case DW_TAG_subprogram: + /* This might be a concrete out-of-line instance of an inline, in + which case it is not guaranteed to be owned by the right scope and + we will search for its origin as for DW_TAG_inlined_subroutine. */ + return (INTUSE(dwarf_hasattr) (die, DW_AT_abstract_origin) + ? match_inline : match); + + /* DIEs without addresses that can own DIEs with addresses. */ + case DW_TAG_namespace: + case DW_TAG_class_type: + case DW_TAG_structure_type: + return walk; + + /* Special indirection required. */ + case DW_TAG_imported_unit: + return imported; + + /* Other DIEs we have no reason to descend. */ + default: + break; + } + return ignore; +} + +int +__libdw_visit_scopes (depth, root, previsit, postvisit, arg) + unsigned int depth; + struct Dwarf_Die_Chain *root; + int (*previsit) (unsigned int depth, struct Dwarf_Die_Chain *, void *); + int (*postvisit) (unsigned int depth, struct Dwarf_Die_Chain *, void *); + void *arg; +{ + struct Dwarf_Die_Chain child; + + child.parent = root; + if (INTUSE(dwarf_child) (&root->die, &child.die) != 0) + return -1; + + inline int recurse (void) + { + return __libdw_visit_scopes (depth + 1, &child, + previsit, postvisit, arg); + } + + do + { + child.prune = false; + + if (previsit != NULL) + { + int result = (*previsit) (depth + 1, &child, arg); + if (result != DWARF_CB_OK) + return result; + } + + if (!child.prune) + switch (classify_die (&child.die)) + { + case match: + case match_inline: + case walk: + if (INTUSE(dwarf_haschildren) (&child.die)) + { + int result = recurse (); + if (result != DWARF_CB_OK) + return result; + } + break; + + case imported: + { + /* This imports another compilation unit to appear + as part of this one, inside the current scope. + Recurse to search the referenced unit, but without + recording it as an inner scoping level. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child.die, + DW_AT_import, + &attr_mem); + if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL) + { + int result = recurse (); + if (result != DWARF_CB_OK) + return result; + } + } + break; + + default: + break; + } + + if (postvisit != NULL) + { + int result = (*postvisit) (depth + 1, &child, arg); + if (result != DWARF_CB_OK) + return result; + } + } + while (INTUSE(dwarf_siblingof) (&child.die, &child.die) == 0); + + return 0; +} diff --git a/libdw/memory-access.c b/libdw/memory-access.c new file mode 100644 index 00000000..c9a0ca76 --- /dev/null +++ b/libdw/memory-access.c @@ -0,0 +1,71 @@ +/* Out of line functions for memory-access.h macros. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include "libdwP.h" +#include "memory-access.h" + +uint64_t +internal_function +__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp) +{ + unsigned char __b; + get_uleb128_rest_return (acc, i, addrp); +} + +int64_t +internal_function +__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp) +{ + unsigned char __b; + int64_t _v = acc; + get_sleb128_rest_return (acc, i, addrp); +} diff --git a/libdw/memory-access.h b/libdw/memory-access.h index babe976f..52b41b5b 100644 --- a/libdw/memory-access.h +++ b/libdw/memory-access.h @@ -1,16 +1,52 @@ /* Unaligned memory access functionality. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _MEMORY_ACCESS_H #define _MEMORY_ACCESS_H 1 @@ -21,86 +57,88 @@ /* Number decoding macros. See 7.6 Variable Length Data. */ -#define get_uleb128(var, addr) \ + +#define get_uleb128_step(var, addr, nth, break) \ + __b = *(addr)++; \ + var |= (uintmax_t) (__b & 0x7f) << (nth * 7); \ + if (likely ((__b & 0x80) == 0)) \ + break + +#define get_uleb128(var, addr) \ do { \ - unsigned char __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - var = __b & 0x7f; \ - if (__b & 0x80) \ + unsigned char __b; \ + var = 0; \ + get_uleb128_step (var, addr, 0, break); \ + var = __libdw_get_uleb128 (var, 1, &(addr)); \ + } while (0) + +#define get_uleb128_rest_return(var, i, addrp) \ + do { \ + for (; i < 10; ++i) \ { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - var |= (__b & 0x7f) << 7; \ - if (__b & 0x80) \ - { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - var |= (__b & 0x7f) << 14; \ - if (__b & 0x80) \ - { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - var |= (__b & 0x7f) << 21; \ - if (__b & 0x80) \ - /* Other implementation set VALUE to UINT_MAX in this \ - case. So we better do this as well. */ \ - var = UINT_MAX; \ - } \ - } \ + get_uleb128_step (var, *addrp, i, return var); \ } \ + /* Other implementations set VALUE to UINT_MAX in this \ + case. So we better do this as well. */ \ + return UINT64_MAX; \ } while (0) -/* The signed case is a big more complicated. */ -#define get_sleb128(var, addr) \ - do { \ - unsigned char __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - int32_t __res = __b & 0x7f; \ - if ((__b & 0x80) == 0) \ +/* The signed case is similar, but we sign-extend the result. */ + +#define get_sleb128_step(var, addr, nth, break) \ + __b = *(addr)++; \ + _v |= (uint64_t) (__b & 0x7f) << (nth * 7); \ + if (likely ((__b & 0x80) == 0)) \ { \ - if (__b & 0x40) \ - __res |= 0xffffff80; \ + var = (_v << (64 - (nth * 7) - 7) >> (64 - (nth * 7) - 7)); \ + break; \ } \ - else \ + else do {} while (0) + +#define get_sleb128(var, addr) \ + do { \ + unsigned char __b; \ + int64_t _v = 0; \ + get_sleb128_step (var, addr, 0, break); \ + var = __libdw_get_sleb128 (_v, 1, &(addr)); \ + } while (0) + +#define get_sleb128_rest_return(var, i, addrp) \ + do { \ + for (; i < 9; ++i) \ { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - __res |= (__b & 0x7f) << 7; \ - if ((__b & 0x80) == 0) \ - { \ - if (__b & 0x40) \ - __res |= 0xffffc000; \ - } \ - else \ - { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - __res |= (__b & 0x7f) << 14; \ - if ((__b & 0x80) == 0) \ - { \ - if (__b & 0x40) \ - __res |= 0xffe00000; \ - } \ - else \ - { \ - __b = *((const unsigned char *) addr); \ - addr = (__typeof (addr)) (((uintptr_t) (addr)) + 1); \ - __res |= (__b & 0x7f) << 21; \ - if ((__b & 0x80) == 0) \ - { \ - if (__b & 0x40) \ - __res |= 0xf0000000; \ - } \ - else \ - /* Other implementation set VALUE to INT_MAX in this \ - case. So we better do this as well. */ \ - __res = INT_MAX; \ - } \ - } \ + get_sleb128_step (var, *addrp, i, return var); \ } \ - var = __res; \ + /* Other implementations set VALUE to INT_MAX in this \ + case. So we better do this as well. */ \ + return INT64_MAX; \ } while (0) +#ifdef IS_LIBDW +extern uint64_t __libdw_get_uleb128 (uint64_t acc, unsigned int i, + const unsigned char **addrp) + internal_function attribute_hidden; +extern int64_t __libdw_get_sleb128 (int64_t acc, unsigned int i, + const unsigned char **addrp) + internal_function attribute_hidden; +#else +static uint64_t +__attribute__ ((unused)) +__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp) +{ + unsigned char __b; + get_uleb128_rest_return (acc, i, addrp); +} +static int64_t +__attribute__ ((unused)) +__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp) +{ + unsigned char __b; + int64_t _v = acc; + get_sleb128_rest_return (acc, i, addrp); +} +#endif + /* We use simple memory access functions in case the hardware allows it. The caller has to make sure we don't have alias problems. */ diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog new file mode 100644 index 00000000..11aeafd9 --- /dev/null +++ b/libdwfl/ChangeLog @@ -0,0 +1,945 @@ +2008-12-16 Roland McGrath <roland@redhat.com> + + * dwfl_module_build_id.c (dwfl_module_build_id): Define with alias and + symver magic to bind to ELFUTILS_0.138. + (_BUG_COMPAT_dwfl_module_build_id): New function, bug compatible + wrapper for ELFUTILS_0.130 version set. + +2008-12-18 Roland McGrath <roland@redhat.com> + + * derelocate.c (dwfl_module_relocate_address): Fix last fix: ET_DYN + addresses are taken as relative to MOD->low_addr. + +2008-12-15 Roland McGrath <roland@redhat.com> + + * derelocate.c (dwfl_module_relocate_address): Apply main.bias, not + debug.bias. + +2008-12-11 Roland McGrath <roland@redhat.com> + + * offline.c (process_archive): Don't call elf_end and close if + returning NULL. Check first elf_begin call and set error code + specially for empty archive. + Fixes RHBZ#465878. + +2008-12-02 Roland McGrath <roland@redhat.com> + + * dwfl_getmodules.c (dwfl_getmodules): Typo fix in last change. + +2008-11-26 Roland McGrath <roland@redhat.com> + + * dwfl_getmodules.c (dwfl_getmodules): Encode iteration style in + return value, and interpret encoded OFFSET argument. + +2008-10-07 Roland McGrath <roland@redhat.com> + + * dwfl_module_build_id.c (check_notes): Fix typo in vaddr calculation. + +2008-09-29 Roland McGrath <roland@redhat.com> + + * segment.c (insert): Must realloc DWFL->lookup_module here too. + (dwfl_report_segment): Clear DWFL->lookup_module before insert calls. + +2008-08-28 Roland McGrath <roland@redhat.com> + + * segment.c (reify_segments): Fix last change. + +2008-08-27 Roland McGrath <roland@redhat.com> + + * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM + failure from pread64. + +2008-08-26 Roland McGrath <roland@redhat.com> + + * segment.c (reify_segments): Insert a trailing segment for a module + end that is above the highest current segment. + +2008-08-25 Roland McGrath <roland@redhat.com> + + * dwfl_module_getdwarf.c (open_elf): Extract elf_errno () for + coded return value, not plain DWFL_E_LIBELF. Return DWFL_E_BADELF + if FILE->elf is not ELF_K_ELF. + + * dwfl_segment_report_module.c: Add a cast. + +2008-08-21 Denys Vlasenko <dvlasenk@redhat.com> + + * dwfl_module_addrsym.c (dwfl_module_addrsym): Improve logic + which decides which symbol is "closest" to a given address. + +2008-08-15 Roland McGrath <roland@redhat.com> + + * argp-std.c (offline_callbacks): Use dwfl_build_id_find_elf. + (options, parse_opt): Handle --core. + + * core-file.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwflP.h (dwfl_core_file_report): Declare it. + + * link_map.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwflP.h (dwfl_link_map_report): Declare it. + + * libdwflP.h (MIN, MAX): New macros. + (Dwfl_Memory_Callback): New typedef. + (Dwfl_Module_Callback): New typedef. + (dwfl_segment_report_module): Declare it. + * dwfl_segment_report_module.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + + * derelocate.c (dwfl_module_address_section): Add INTDEF. + * libdwflP.h: Add INTDECL. + + * segment.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_addrsegment, dwfl_report_segment. + * libdwflP.h (struct Dwfl): New members lookup_elts, lookup_alloc, + lookup_addr, lookup_module, lookup_segndx, replace removed members + modules, nmodules. + (struct Dwfl_Module): New member segment. + * dwfl_end.c (dwfl_end): Free the new ones. Iterate via modulelist + to each free module. + * dwfl_module.c (dwfl_report_begin_add): Do nothing. + (dwfl_report_begin): Don't call it. Truncate the segment table instead. + (dwfl_report_module): Don't touch DWFL->nmodules. + (dwfl_report_end): Don't touch DWFL->modules and DWFL->nmodules. + (compare_modules): Function removed. + * dwfl_getmodules.c: Rewritten. + Add INTDEF. + * libdwflP.h: Add INTDECLs. + * dwfl_getdwarf.c: Rewritten to call dwfl_getmodules. + * dwfl_addrmodule.c: Rewritten to just call dwfl_addrsegment. + +2008-08-03 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c: Include <fts.h> before <config.h>. + +2008-07-17 Roland McGrath <roland@redhat.com> + + * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Set errno to + zero if the failure was only ENOENT. + +2008-06-03 Roland McGrath <roland@redhat.com> + + * dwfl_module_addrsym.c (dwfl_module_addrsym): Exclude undefined + symbols. + +2008-05-22 Petr Machata <pmachata@redhat.com> + + * dwfl_module_getdwarf.c (open_elf): Bias of ET_EXEC files is always 0. + +2008-05-06 Roland McGrath <roland@frob.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use + FTS_LOGICAL here too. + (dwfl_linux_kernel_find_elf): Likewise. + +2008-04-29 Roland McGrath <roland@redhat.com> + + * find-debuginfo.c (dwfl_standard_find_debuginfo): Try path search + based on canonicalize_file_name if it differs from the supplied name. + + * linux-kernel-modules.c (check_module_notes): Use FTS_LOGICAL so + we accept symlinks. + +2008-04-27 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (report_kernel): Fix crash when + dwfl_report_elf fails. + +2008-04-05 Roland McGrath <roland@redhat.com> + + * linux-proc-maps.c (proc_maps_report): Don't leak LAST_FILE. + + * dwfl_module_getdwarf.c (find_file): Always free build_id_bits. + Clear it after freeing. + * dwfl_module_report_build_id.c (dwfl_module_report_build_id): Likewise. + +2008-03-26 Roland McGrath <roland@redhat.com> + + * dwfl_module_getdwarf.c (load_symtab): Don't return success for + SHT_DYNSYM, just set *SYMSCN like the comment says. + + * dwfl_end.c (dwfl_end): Iterate on modulelist chain, not modules array. + + * argp-std.c (parse_opt): On failure, call dwfl_end before argp_failure. + +2008-03-19 Roland McGrath <roland@redhat.com> + + * dwfl_module_getsrc.c: Adjust address for module bias before search. + +2008-03-01 Roland McGrath <roland@redhat.com> + + * libdwflP.h (__libdwfl_seterrno): Remove parameter name from + prototype to avoid older compiler's complaint about reuse of the name. + (__libdwfl_canon_error): Likewise. + +2008-02-19 Roland McGrath <roland@redhat.com> + + * relocate.c (relocate_section): Check for an unhandled relocation + type before resolving a reloc's symbol. Lift DWFL_E_BADRELTYPE -> + DWFL_E_UNKNOWN_MACHINE check out of loops. + + * dwfl_module_getdwarf.c (load_dw): Skip relocation if + DEBUGFILE->relocated is already set. + +2008-01-26 Roland McGrath <roland@redhat.com> + + * dwfl_module_getdwarf.c (open_elf): Open FILE->name if it's non-null. + + * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Don't clear + incoming *FILE_NAME at the start. + +2008-01-08 Roland McGrath <roland@redhat.com> + + * Makefile.am (euinclude): Variable removed. + (pkginclude_HEADERS): Set this instead of euinclude_HEADERS. + +2007-10-23 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (report_kernel_archive): Reorder the kernel + module to appear first. + +2007-10-20 Roland McGrath <roland@redhat.com> + + * offline.c (process_archive_member): Take FD argument, pass it down + to process_file. Return Elf_Cmd, not bool. + Call elf_next here, always before elf_end. + (process_archive): Update caller. Don't close FD here unless there + are no member refs. + + * dwfl_module.c (free_file): Close fd only when elf_end returns zero. + + * libdwflP.h (struct dwfl_file): New bool member `relocated'. + * dwfl_module_getdwarf.c (dwfl_module_getelf): For ET_REL, apply + partial relocation to one or both files. + (dwfl_module_getdwarf): For ET_REL, make sure extra sections' + relocations have been applied to the debug file if dwfl_module_getelf + has been used before. + + * relocate.c (resolve_symbol): New function. + (relocate_section): Call it. + + * relocate.c (relocate_getsym): Handle null MOD->symfile. + (relocate_section): Take new bool arg, PARTIAL. If true, + no error for BADRELTYPE/RELUNDEF, instead just skip them + and leave only those skipped relocs behind the reloc section. + (__libdwfl_relocate_section): Take new arg, pass it down. + (__libdwfl_relocate): Take new bool arg, DEBUG. If false, + do partial relocation on all sections. + * dwfl_module_getdwarf.c (load_dw): Update caller. + * libdwflP.h: Update decls. + * derelocate.c (dwfl_module_address_section): Pass new argument + to __libdwfl_relocate_section, true. + + * derelocate.c (cache_sections): Don't cache reloc sections when + section_address callback is null. + +2007-10-19 Roland McGrath <roland@redhat.com> + + * relocate.c (relocate_section): Fix fencepost error in r_offset check. + + * derelocate.c (struct dwfl_relocation): Add member `relocs'. + (struct secref): Likewise. + (cache_sections): Cache the relocation section referring to each + section we cache, if any. + (dwfl_module_address_section): Use __libdwfl_relocate_section as + necessary. + + * relocate.c (struct reloc_symtab_cache): New type. + (relocate_getsym): Use it instead of four arguments. + (__libdwfl_relocate): Update caller. + (relocate_section): New function, broken out of ... + (__libdwfl_relocate): ... here. + (__libdwfl_relocate_section): New function. + * libdwflP.h: Declare it. + +2007-10-17 Roland McGrath <roland@redhat.com> + + * dwfl_module_getsym.c (dwfl_module_getsym): Apply MOD->symfile->bias + to relocated st_value. + + * dwfl_report_elf.c (__libdwfl_report_elf): Align initial BASE for + ET_REL to 0x100. + +2007-10-16 Roland McGrath <roland@redhat.com> + + * dwfl_report_elf.c (__libdwfl_report_elf): Readjust BASE when a later + section has larger alignment requirements not met by the original BASE, + rather than padding more between sections. + + * dwfl_report_elf.c (__libdwfl_report_elf): Fix bias calculation. + + * dwfl_module_build_id.c (__libdwfl_find_build_id): Apply module bias + to sh_addr value. + + * dwfl_report_elf.c (__libdwfl_report_elf): Don't be confused by BASE + at zero in ET_REL case. Adjust BASE to necessary alignment. + + * dwfl_module_build_id.c (check_notes): Take -1, not 0, as stub value + for DATA_VADDR. + (__libdwfl_find_build_id): Update caller. + + * relocate.c (__libdwfl_relocate_value): Don't use sh_offset. + * dwfl_report_elf.c (__libdwfl_report_elf): Likewise. + * offline.c (dwfl_offline_section_address): Bail early if there is + separate debug file. + + * relocate.c (__libdwfl_relocate): Don't return DWFL_E_NO_DWARF. + +2007-10-09 Roland McGrath <roland@redhat.com> + + * dwfl_report_elf.c (__libdwfl_report_elf): Clear SHDR->sh_offset when + caching SHDR->sh_addr = 0. + * offline.c (dwfl_offline_section_address): Never called for sh_addr + really at 0, don't check for it. Use MOD->debug directly, not symfile. + + * dwfl_module_getdwarf.c (load_symtab): Return success properly when + we've found SHT_SYMTAB. + + * relocate.c (relocate_getsym): New function. + (__libdwfl_relocate): Use it. + (__libdwfl_relocate_value): Take new Elf * argument. Make SYMSHSTRNDX + be a pointer instead of value; cache getshstrndx result there. + * libdwflP.h: Update decl. + * derelocate.c (cache_sections): Update caller. + Always work on the main file, not the symfile. + (dwfl_module_address_section): Likewise. + * dwfl_module_getsym.c (dwfl_module_getsym): Update caller. + +2007-10-07 Roland McGrath <roland@redhat.com> + + * offline.c (process_archive): Initialize MOD. + + * linux-kernel-modules.c (get_release): New function, broken out of ... + (report_kernel): ... here. Call it. + (try_kernel_name): Take new arg TRY_DEBUG, only try ".debug" if set. + (find_kernel_elf): Update caller. + (report_kernel_archive): New function. + (dwfl_linux_kernel_report_offline): Call it. + + * offline.c (process_file): Take new arg PREDICATE, pass it down. + (process_archive): Likewise. + (process_archive_member): Likewise. When nonnull, let the predicate + decide whether to use this member. + (__libdwfl_report_offline): New function, broken out of ... + (dwfl_report_offline): ... here. Call it. + * libdwflP.h: Declare it. + + * offline.c (process_archive, process_archive_member): New functions. + (process_elf, process_file): New functions, broken out of ... + (dwfl_report_offline): ... here. Call process_file, which recurses on + ELF_K_AR files. + + * dwfl_report_elf.c (__libdwfl_report_elf): New, broken out of ... + (dwfl_report_elf): ... here. Call it. + * libdwflP.h: Declare it. + +2007-10-06 Roland McGrath <roland@redhat.com> + + * derelocate.c (dwfl_module_relocations): Don't call + dwfl_module_getdwarf. + + * derelocate.c (find_section): Use __libdwfl_seterrno, not + __libdw_seterrno. + + * relocate.c (__libdwfl_relocate_value): Abuse sh_offset, not + SHF_ALLOC, to cache sh_addr resolved to 0. + + * dwfl_report_elf.c (dwfl_report_elf): When an ET_REL file has sh_addr + values nonzero already, just use its existing layout. + + * relocate.c (__libdwfl_relocate): Clear size of reloc section in its + in-core shdr after applying it. + +2007-10-04 Ulrich Drepper <drepper@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Fake + initialization of notes variable. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (intuit_kernel_bounds): Take new arg NOTES, + fill in with vaddr of "__start_notes" symbol if found. + (check_notes): New function. + (check_kernel_notes): New function. + (dwfl_linux_kernel_report_kernel): Call it. + (check_module_notes): New function. + (dwfl_linux_kernel_report_modules): Call it. + + * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): + Try dwfl_build_id_find_elf first. + + * linux-kernel-modules.c (report_kernel): Don't leak FD if !REPORT. + Set kernel module e_type to ET_DYN. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * find-debuginfo.c (validate): New function, broken out of ... + (find_debuginfo_in_path): ... here. New function, broken out of ... + (dwfl_standard_find_debuginfo): ... here. Call it, after trying + dwfl_build_id_find_debuginfo first. + + * dwfl_build_id_find_elf.c: New file. + * dwfl_build_id_find_debuginfo.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add them. + * libdwfl.h: Declare them. + * libdwflP.h: Add INTDECLs. + + * dwfl_module_build_id.c: New file. + * dwfl_module_report_build_id.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add them. + * libdwfl.h: Declare them. + * libdwflP.h (struct Dwfl_Module): New members build_id_bits, + build_id_len, build_id_vaddr. Declare __libdwfl_find_build_id. + * dwfl_module.c (__libdwfl_module_free): Free MOD->build_id_bits. + + * dwfl_module_getdwarf.c (find_offsets): New function. + (find_dynsym): New function, calls that. + (find_symtab): Call it. + +2007-09-11 Roland McGrath <roland@redhat.com> + + * dwfl_module_addrsym.c: Prefer a later global symbol at the same + address if its st_size is smaller. + +2007-08-13 Roland McGrath <roland@redhat.com> + + * dwfl_module_addrsym.c: Add dead initializer for stupid compiler. + +2007-08-12 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Don't use + FTS_LOGICAL. + + * elf-from-memory.c (elf_from_remote_memory): Don't reset LOADBASE on + a second phdr if it happens to match EHDR_VMA exactly. + +2007-08-08 Roland McGrath <roland@redhat.com> + + * dwfl_module_addrsym.c: Don't use STT_SECTION, STT_FILE symbols and + those with no names. Rewrite best symbol algorithm not to assume a + sorted table and to be smarter handling sizeless symbols. + +2007-07-16 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (dwfl_report_module): Increment DWFL->nmodules when + reviving an existing module. + +2007-06-08 Roland McGrath <roland@redhat.com> + + * libdwflP.h: Fix #ifndef for config.h to use PACKAGE_NAME. + +2007-05-17 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Look at + whole /lib/modules/VERSION tree, not just /lib/modules/VERSION/kernel. + (dwfl_linux_kernel_find_elf): Likewise. + + * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use + getline and sscanf instead of fscanf. + +2007-05-08 Roland McGrath <roland@redhat.com> + + * offline.c (dwfl_offline_section_address): Don't assume section + numbers match between stripped and debuginfo files. Instead, assume + only that the ordering among SHF_ALLOC sections matches. + + * linux-kernel-modules.c (report_kernel): Change RELEASE argument to + pointer to string. + (dwfl_linux_kernel_report_offline): Update caller. + (dwfl_linux_kernel_report_kernel): Likewise. + +2007-04-23 Roland McGrath <roland@redhat.com> + + * argp-std.c (options): Fix group title string. + + * argp-std.c (parse_opt): Handle ARGP_KEY_ERROR, free the Dwfl. + Update via STATE->input every time we set STATE->hook, not only at + ARGP_KEY_SUCCESS. + + * dwfl_module.c (free_file): Free FILE->name. + +2007-04-16 Roland McGrath <roland@redhat.com> + + * derelocate.c (cache_sections): Apply bias to sh_addr. + (compare_secrefs): Fix address comparison to avoid signed overflow. + (find_section): New function, broken out of ... + (dwfl_module_relocate_address): ... here, call it. + (check_module): New function, broken out of ... + (dwfl_module_relocate_address): ... here, call it. + (dwfl_module_address_section): New function. + * libdwfl.h: Declare it. + +2007-03-26 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (__libdwfl_module_free): Free MOD itself. + +2007-03-18 Roland McGrath <roland@redhat.com> + + * dwfl_module_getdwarf.c (find_debuglink): New function, broken out of + (find_debuginfo): ... here. Call it. + Don't return error for libelf errors finding .gnu_debuglink section. + +2007-03-12 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (dwfl_report_begin_add): New function broken out of ... + (dwfl_report_begin): ... here. Call it. + * libdwfl.h: Declare it. + * libdwflP.h: Add INTDECL. + + * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo. + + * offline.c: Comment typo fix. + +2007-03-04 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (KERNEL_MODNAME): New macro for "kernel". + (find_kernel_elf): New function, broken out of ... + (report_kernel): ... here. Call it. + (dwfl_linux_kernel_find_elf): Use it for module named KERNEL_MODNAME. + (intuit_kernel_bounds): New function, grovel /proc/kallsyms to guess + virtual address bounds of kernel from symbols rounded to page size. + (dwfl_linux_kernel_report_kernel): Use that if it works, before + resorting to report_kernel. + + * dwfl_module_getdwarf.c (open_elf): Set MOD->e_type to ET_DYN for an + ET_EXEC file with nonzero bias. + + * dwfl_module_addrname.c (dwfl_module_addrname): Just call + dwfl_module_addrsym. Guts moved to ... + * dwfl_module_addrsym.c: ... here; new file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_module_addrsym. + * libdwflP.h: Add INTDECL. + +2007-03-03 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (free_file): New function, broken out of ... + (__libdwfl_module_free): ... here. In it, close fd after elf_end. + + * dwfl_module_getdwarf.c (open_elf): Close fd and reset to -1 + on libelf failure. + +2007-03-02 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c: Fix bogus error test for asprintf call. + +2007-02-02 Roland McGrath <roland@redhat.com> + + * dwfl_addrmodule.c (dwfl_addrmodule): Match a module's high boundary + address exactly if it's no other module's low boundary. + + * dwfl_module_addrname.c (dwfl_module_addrname): If no symbol's value + and size cover the address, select the closest symbol with st_size==0 + that lies in the same section. + +2007-01-29 Roland McGrath <roland@redhat.com> + + * dwfl_version.c (dwfl_version): Return PACKAGE_VERSION, + not PACKAGE_STRING. + +2007-01-20 Roland McGrath <roland@redhat.com> + + * relocate.c (__libdwfl_relocate_value): Treat section_address of -1 + as omitted, not 0. + * libdwfl.h (Dwfl_Callbacks): Update comment. + * derelocate.c (cache_sections): Don't ignore sh_addr == 0 sections. + * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): + For ignored missing section, use -1 instead of 0. + * offline.c (dwfl_offline_section_address): Expect a call for 0. + +2007-01-19 Roland McGrath <roland@redhat.com> + + * argp-std.c (parse_opt): For -e, reset DWFL->offline_next_address to + zero so a lone -e foo.so is shown without address bias. + +2007-01-10 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (report_kernel): Check asprintf return value + directly instead of via side effect, to silence warn_unused_result. + (dwfl_linux_kernel_report_offline): Likewise. + (dwfl_linux_kernel_find_elf): Likewise. + (dwfl_linux_kernel_module_section_address): Likewise. + * find-debuginfo.c (try_open): Likewise. + * linux-proc-maps.c (find_sysinfo_ehdr): Likewise. + (dwfl_linux_proc_report): Likewise. + + * libdwfl.h (dwfl_begin): Require nonnull argument. + +2006-12-27 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (compare_modules): Fix address comparison to avoid + signed overflow. Patch by Frank Ch. Eigler <fche@redhat.com>. + +2006-10-30 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (dwfl_report_module): Comment typo fix. + +2006-09-05 Roland McGrath <roland@redhat.com> + + * derelocate.c (cache_sections): Use alloca instead of variable-sized + auto array, in function already alloca. + +2006-08-14 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (try_kernel_name): If the call to + dwfl_standard_find_debuginfo produces no results, try it again + with NULL as DEBUGLINK_FILE to try *FNAME with .debug suffix. + + * find-debuginfo.c (DEFAULT_DEBUGINFO_PATH): Macro moved ... + * libdwflP.h: ... to here. + * linux-kernel-modules.c (try_kernel_name): Skip manual open if it + repeats the first thing dwfl_standard_find_debuginfo will try. + + * linux-kernel-modules.c (MODULE_SECT_NAME_LEN): New macro. + (dwfl_linux_kernel_module_section_address): If a /sys file is missing + and the section name is >= MODULE_SECT_NAME_LEN, try truncating the + section name. + +2006-07-12 Ulrich Drepper <drepper@redhat.com> + + * cu.c: Adjust for internal_function_def removal. + * dwfl_error.c: Likewise. + * dwfl_module.c: Likewise. + * dwfl_module_getdwarf.c: Likewise. + * lines.c: Likewise. + * relocate.c: Likewise. + +2006-07-11 Ulrich Drepper <drepper@redhat.com> + + * dwfl_module.c (compare_modules): Don't return GElf_Sxword value, + it can overflow the return value type. + Patch by Tim Moore <timoore@redhat.com>. + +2006-06-28 Roland McGrath <roland@redhat.com> + + * libdwfl.h: Cosmetic changes. + + * dwfl_line_comp_dir.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_line_comp_dir. + + * dwfl_lineinfo.c (dwfl_lineinfo): Remove stray extern in defn. + + * dwfl_linecu.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_linecu. + + * libdwflP.h (dwfl_linecu_inline): Function renamed from dwfl_linecu. + (dwfl_linecu): Define as macro. + + * relocate.c (__libdwfl_relocate): Use dwfl_module_getsym. + + * dwfl_module_getdwarf.c (dwfl_module_getsymtab): New function. + (dwfl_module_addrname): Function moved ... + * dwfl_module_addrname.c: ... here, new file. + * dwfl_module_getsym.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add them. + * libdwfl.h: Declare dwfl_module_getsymtab, dwfl_module_getsym. + * libdwflP.h: Add INTDECLs. + +2006-06-27 Roland McGrath <roland@redhat.com> + + * dwfl_module.c (dwfl_report_end): Whitespace fix. + +2006-06-13 Roland McGrath <roland@redhat.com> + + * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo. + Use __libdwfl_seterrno for elf_memory failure. + +2006-05-22 Roland McGrath <roland@redhat.com> + + * dwfl_module_return_value_location.c + (dwfl_module_return_value_location): Use __libdwfl_module_getebl. + +2006-05-27 Ulrich Drepper <drepper@redhat.com> + + * libdwfl.h: Add extern "C". + +2006-05-22 Ulrich Drepper <drepper@redhat.com> + + * cu.c (addrarange): Handle files without aranges information. + +2006-05-16 Ulrich Drepper <drepper@redhat.com> + + * dwfl_addrmodule.c (dwfl_addrmodule): Also return NULL of + ->modules is NULL. + +2006-02-26 Roland McGrath <roland@redhat.com> + + * dwfl_version.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_version. + + * offline.c (dwfl_report_offline): Account for dwfl_report_elf having + aligned up from DWFL->offline_next_address when checking for overlap. + +2005-12-22 Roland McGrath <roland@redhat.com> + + * argp-std.c (parse_opt): Call dwfl_end in failure cases. + + * linux-proc-maps.c (proc_maps_report): New function, broken out of ... + (dwfl_linux_proc_report): ... here. Call it. + (dwfl_linux_proc_maps_report): New function. + * libdwfl.h: Declare it. + * libdwflP.h: Add INTDECL. + * argp-std.c (options, parse_opt): Grok -M/--linux-process-map. + + * dwfl_nextcu.c (dwfl_nextcu): Don't fail when dwfl_module_getdwarf + failed with DWFL_E_NO_DWARF. + +2005-11-26 Roland McGrath <roland@redhat.com> + + * dwfl_end.c (dwfl_end): Free the DWFL itself. + +2005-11-25 Roland McGrath <roland@redhat.com> + + * dwfl_module_getdwarf.c (__libdwfl_module_getebl): New function. + (load_dw): Use it. + * dwfl_module_register_names.c (dwfl_module_register_names): Likewise. + * libdwflP.h: Declare it. + + * dwfl_module_register_names.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_module_register_names. + +2005-11-21 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): + Don't leak malloc'd file name. + If a /sys/.../sections file is missing and starts with ".init", + try the variant with "_init" too; catches PPC64 kernel braindamage. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * libdwfl.h: Comment fixes. + + * dwfl_module_return_value_location.c: Add unlikely for error case. + +2005-11-13 Roland McGrath <roland@redhat.com> + + * dwfl_return_value_location.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_module_return_value_location. + * libdwflP.h (DWFL_ERRORS): Add DWFL_E_WEIRD_TYPE. + +2005-10-20 Roland McGrath <roland@redhat.com> + + * libdwflP.h (DWFL_ERRORS): New error UNKNOWN_MACHINE. + * relocate.c (__libdwfl_relocate): Return DWFL_E_UNKNOWN_MACHINE + instead of DWFL_E_BADRELTYPE if ebl_get_elfmachine yields EM_NONE. + +2005-10-01 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (report_kernel): Return ENOENT if we fail + with errno 0. + +2005-09-19 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use + PRIx64 instead of PRIi64, lest addresses with high bits set overflow + the signed integer reading; they will just have to be in hexadecimal. + (dwfl_linux_kernel_module_section_address): Likewise. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (%.os): Use COMPILE.os. + (COMPILE.os): Filter out gconv options. + +2005-08-25 Roland McGrath <roland@redhat.com> + + * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end. + * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info. + +2005-08-24 Roland McGrath <roland@redhat.com> + + * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it. + + * argp-std.c [_MUDFLAP] (__libdwfl_argp_mudflap_options): New function, + magic initializer to set -heur-stack-bound option. + +2005-08-22 Roland McGrath <roland@redhat.com> + + * dwfl_validate_address.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_validate_address. + + * derelocate.c (dwfl_module_relocate_address): Add INTDEF. + * libdwflP.h: Add INTDECL. + + * dwfl_module_getdwarf.c (find_symtab): Use elf_getdata instead of + elf_rawdata for symbol-related sections. + + * offline.c (dwfl_report_offline): Move offline_next_address outside + module's range, in case it's an ET_EXEC using fixed segment locations. + * libdwfl.h: Update comment. + + * dwfl_report_elf.c (dwfl_report_elf): Align BASE to first segment's + required alignment. + +2005-08-20 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (report_kernel): Take new argument PREDICATE, + function to choose whether to report. + (dwfl_linux_kernel_report_offline): Likewise. + * libdwfl.h: Update decl. + * argp-std.c (parse_opt): Update caller. + + * dwfl_getsrclines.c: New file. + * dwfl_onesrcline.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add them. + * libdwfl.h: Declare dwfl_getsrclines, dwfl_onesrcline. + + * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Don't leak + MODULESDIR[0]. Call fts_close on failure. + + * dwfl_module_getdwarf.c (load_dw): Take dwfl_file * instead of Elf *. + Close ET_REL file descriptors after relocation. + (find_dw): Update caller. + * offline.c (dwfl_report_offline): Get the file into memory and close + the file descriptor. + + * dwfl_module_getdwarf.c (find_debuginfo): Do nothing when + MOD->debug.elf is already set. + + * find-debuginfo.c (try_open): Use TEMP_FAILURE_RETRY. + (dwfl_standard_find_debuginfo): Fail on errors not ENOENT or ENOTDIR. + + * argp-std.c (options, parse_opt): Grok -K/--offline-kernel, use + dwfl_linux_kernel_report_offline with offline_callbacks. + + * linux-kernel-modules.c (report_kernel): New function, broken out of + ... + (dwfl_linux_kernel_report_kernel): ... here. Use it. + (dwfl_linux_kernel_report_offline): New function. + * libdwfl.h: Declare it. + * libdwflP.h: Add INTDECL. + +2005-08-19 Roland McGrath <roland@redhat.com> + + Use standard debuginfo search path to look for vmlinux. + * find-debuginfo.c (dwfl_standard_find_debuginfo): Don't check CRC if + passed zero. + * linux-kernel-modules.c (try_kernel_name): New function, broken out + of ... + (dwfl_linux_kernel_report_kernel): ... here. Use it. + + * argp-std.c (offline_callbacks): New variable. + (parse_opt): Use it for -e. Allow multiple -e options. + + * offline.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwfl.h: Declare dwfl_offline_section_address, dwfl_report_offline. + * libdwflP.h: Add INTDECLs. + (OFFLINE_REDZONE): New macro. + (struct Dwfl): New member `offline_next_address'. + * dwfl_begin.c (dwfl_begin): Initialize it. + * dwfl_module.c (dwfl_report_begin): Likewise. + + * dwfl_report_elf.c (dwfl_report_elf): Accept all types. When ET_REL, + do a nominal absolute section layout starting at BASE. + * libdwfl.h: Update comment. + +2005-08-18 Roland McGrath <roland@redhat.com> + + * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Do + dwfl_module_getdwarf if necessary. + + * dwfl_report_elf.c (dwfl_report_elf): Permit ET_REL with BASE==0. + * libdwfl.h: Update comment. + + * derelocate.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + + * libdwflP.h (struct Dwfl_Module): isrel -> e_type. + * dwfl_report_elf.c (dwfl_report_elf): Initialize it. + * dwfl_module_getdwarf.c (open_elf): Update initialization. + (load_dw, dwfl_module_addrname): Update uses. + * relocate.c (__libdwfl_relocate): Likewise. + +2005-08-04 Roland McGrath <roland@redhat.com> + + * libdwfl.h (Dwfl_Callbacks.section_address): Take additional + arguments SHNDX, SHDR. + (dwfl_linux_kernel_module_section_address): Update prototype. + * relocate.c (__libdwfl_relocate_value): Update caller. + * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): + Take the new arguments. + +2005-08-10 Roland McGrath <roland@redhat.com> + + * relocate.c (__libdwfl_relocate): Take argument DEBUGFILE, + use it instead of MOD->debug.file. + * libdwflP.h: Update decl. + * dwfl_module_getdwarf.c (load_dw): Update caller. + Fixes bug #165598. + +2005-08-09 Roland McGrath <roland@redhat.com> + + * libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs. + * cu.c: Use INTUSE on dwarf_* calls. + * dwfl_error.c: Likewise. + * dwfl_module.c: Likewise. + * dwfl_module_getdwarf.c: Likewise. + * dwfl_module_getsrc_file.c: Likewise. + * lines.c: Likewise. + +2005-08-07 Roland McGrath <roland@redhat.com> + + * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): When module + names contain '_' or '-', look for files named either "foo-bar.ko" + or "foo_bar.ko". + +2005-07-29 Roland McGrath <roland@redhat.com> + + * loc2c.c: File removed. + * loc2c.h: File removed. + * loc2c-runtime.h: File removed. + * test2.c: File removed. + * Makefile.am (EXTRA_DIST): Variable removed. + (noinst_HEADERS): Remove loc2c.h from here. + +2005-07-28 Ulrich Drepper <drepper@redhat.com> + + * libdwfl.h: Add a few missing extern for function prototypes. + + * libdwfl_crc32.c: New file. + * libdwfl_crc32_file.c: New file. + * libdwflP.h: Declare the new functions. + * Makefile.am (libdwfl_a_SOURCES): Add libdwfl_crc32.c and + libdwfl_crc32_file.c. + * libdwfl/find-debuginfo.c (check_crc): Use __libdwfl_crc32_file + instead of crc32_file. + +2005-07-28 Roland McGrath <roland@redhat.com> + + * ptest.c: Moved to ../tests/dwflmodtest.c. + + * Makefile.am (noinst_PROGRAMS): Variable removed. + (libdwfl_so_SOURCES, libdwfl_LIBS, libdwfl_so_LDADD): Likewise. + (EXTRA_DIST, ptest_LDADD, test2_LDADD): Likewise. + (libdwfl): Don't use libdwfl.so any more. + (libdwfl.so, install, uninstall): Targets removed. + (test2_SOURCES): Define EXTRA_DIST instead of this. + * libdwfl.map: File removed. + + * libdwfl.h: Use "" for libdw.h #include. + +2005-07-27 Roland McGrath <roland@redhat.com> + + * libdwfl.map: Add dwfl_getmodules. + +2005-07-23 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Fix rules to allow building with mudflap. + +2005-07-21 Roland McGrath <roland@redhat.com> + + * Makefile.am (noinst_HEADERS): Add loc2c.c. + + * test2.c (main): Check sscanf result to quiet warning. + +2005-07-20 Roland McGrath <roland@redhat.com> + + * libdwfl-branch merged, creating this direcotry. diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am new file mode 100644 index 00000000..db14db2a --- /dev/null +++ b/libdwfl/Makefile.am @@ -0,0 +1,108 @@ +## Makefile.am for libdwfl library subdirectory in elfutils. +## +## Process this file with automake to create Makefile.in +## +## Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. +## +## Red Hat elfutils 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; version 2 of the License. +## +## Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +if MUDFLAP +AM_CFLAGS = -fmudflap +else +AM_CFLAGS = +endif +AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib +VERSION = 1 + +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + +noinst_LIBRARIES = libdwfl.a +if !MUDFLAP +noinst_LIBRARIES += libdwfl_pic.a +endif + +pkginclude_HEADERS = libdwfl.h + +libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ + dwfl_module.c dwfl_report_elf.c relocate.c \ + dwfl_module_build_id.c dwfl_module_report_build_id.c \ + derelocate.c offline.c segment.c \ + dwfl_module_info.c dwfl_getmodules.c \ + dwfl_module_getdwarf.c dwfl_getdwarf.c \ + dwfl_validate_address.c \ + argp-std.c find-debuginfo.c \ + dwfl_build_id_find_elf.c \ + dwfl_build_id_find_debuginfo.c \ + linux-kernel-modules.c linux-proc-maps.c \ + dwfl_addrmodule.c dwfl_addrdwarf.c \ + cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ + dwfl_module_addrdie.c dwfl_addrdie.c \ + lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \ + dwfl_linemodule.c dwfl_linecu.c \ + dwfl_getsrclines.c dwfl_onesrcline.c \ + dwfl_module_getsrc.c dwfl_getsrc.c \ + dwfl_module_getsrc_file.c \ + libdwfl_crc32.c libdwfl_crc32_file.c \ + elf-from-memory.c \ + dwfl_module_getsym.c \ + dwfl_module_addrname.c dwfl_module_addrsym.c \ + dwfl_module_return_value_location.c \ + dwfl_module_register_names.c \ + dwfl_segment_report_module.c \ + link_map.c core-file.c + + +if MUDFLAP +libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu) +libdw = ../libdw/libdw.a +libelf = ../libelf/libelf.a +libmudflap = -lmudflap +else +libdwfl = $(libdw) +libdw = ../libdw/libdw.so +libelf = ../libelf/libelf.so +endif +libebl = ../libebl/libebl.a +libeu = ../lib/libeu.a + + +if !MUDFLAP +libdwfl_pic_a_SOURCES = +am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os) + +%.os: %.c %.o + if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ + rm -f "$(DEPDIR)/$*.Tpo"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi +endif + +noinst_HEADERS = libdwflP.h + +CLEANFILES = $(am_libdwfl_pic_a_OBJECTS) diff --git a/libdwfl/Makefile.in b/libdwfl/Makefile.in new file mode 100644 index 00000000..dd61566e --- /dev/null +++ b/libdwfl/Makefile.in @@ -0,0 +1,594 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 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@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@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@ +@MUDFLAP_FALSE@am__append_1 = libdwfl_pic.a +@MUDFLAP_TRUE@am_libdwfl_pic_a_OBJECTS = +subdir = libdwfl +DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libdwfl_a_AR = $(AR) $(ARFLAGS) +libdwfl_a_LIBADD = +am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJEXT) dwfl_end.$(OBJEXT) \ + dwfl_error.$(OBJEXT) dwfl_version.$(OBJEXT) \ + dwfl_module.$(OBJEXT) dwfl_report_elf.$(OBJEXT) \ + relocate.$(OBJEXT) dwfl_module_build_id.$(OBJEXT) \ + dwfl_module_report_build_id.$(OBJEXT) derelocate.$(OBJEXT) \ + offline.$(OBJEXT) segment.$(OBJEXT) dwfl_module_info.$(OBJEXT) \ + dwfl_getmodules.$(OBJEXT) dwfl_module_getdwarf.$(OBJEXT) \ + dwfl_getdwarf.$(OBJEXT) dwfl_validate_address.$(OBJEXT) \ + argp-std.$(OBJEXT) find-debuginfo.$(OBJEXT) \ + dwfl_build_id_find_elf.$(OBJEXT) \ + dwfl_build_id_find_debuginfo.$(OBJEXT) \ + linux-kernel-modules.$(OBJEXT) linux-proc-maps.$(OBJEXT) \ + dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \ + cu.$(OBJEXT) dwfl_module_nextcu.$(OBJEXT) \ + dwfl_nextcu.$(OBJEXT) dwfl_cumodule.$(OBJEXT) \ + dwfl_module_addrdie.$(OBJEXT) dwfl_addrdie.$(OBJEXT) \ + lines.$(OBJEXT) dwfl_lineinfo.$(OBJEXT) \ + dwfl_line_comp_dir.$(OBJEXT) dwfl_linemodule.$(OBJEXT) \ + dwfl_linecu.$(OBJEXT) dwfl_getsrclines.$(OBJEXT) \ + dwfl_onesrcline.$(OBJEXT) dwfl_module_getsrc.$(OBJEXT) \ + dwfl_getsrc.$(OBJEXT) dwfl_module_getsrc_file.$(OBJEXT) \ + libdwfl_crc32.$(OBJEXT) libdwfl_crc32_file.$(OBJEXT) \ + elf-from-memory.$(OBJEXT) dwfl_module_getsym.$(OBJEXT) \ + dwfl_module_addrname.$(OBJEXT) dwfl_module_addrsym.$(OBJEXT) \ + dwfl_module_return_value_location.$(OBJEXT) \ + dwfl_module_register_names.$(OBJEXT) \ + dwfl_segment_report_module.$(OBJEXT) link_map.$(OBJEXT) \ + core-file.$(OBJEXT) +libdwfl_a_OBJECTS = $(am_libdwfl_a_OBJECTS) +libdwfl_pic_a_AR = $(AR) $(ARFLAGS) +libdwfl_pic_a_LIBADD = +libdwfl_pic_a_OBJECTS = $(am_libdwfl_pic_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libdwfl_a_SOURCES) $(libdwfl_pic_a_SOURCES) +DIST_SOURCES = $(libdwfl_a_SOURCES) $(libdwfl_pic_a_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgincludedir)" +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LOCALEDIR = @LOCALEDIR@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = 1 +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +base_cpu = @base_cpu@ +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@ +eu_version = @eu_version@ +exec_prefix = @exec_prefix@ +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@ +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@ +@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -Wunused -Wformat=2 \ +@MUDFLAP_FALSE@ -Wextra -std=gnu99 +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Werror -Wshadow -Wunused \ +@MUDFLAP_TRUE@ -Wformat=2 -Wextra -std=gnu99 +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib + +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + +noinst_LIBRARIES = libdwfl.a $(am__append_1) +pkginclude_HEADERS = libdwfl.h +libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ + dwfl_module.c dwfl_report_elf.c relocate.c \ + dwfl_module_build_id.c dwfl_module_report_build_id.c \ + derelocate.c offline.c segment.c \ + dwfl_module_info.c dwfl_getmodules.c \ + dwfl_module_getdwarf.c dwfl_getdwarf.c \ + dwfl_validate_address.c \ + argp-std.c find-debuginfo.c \ + dwfl_build_id_find_elf.c \ + dwfl_build_id_find_debuginfo.c \ + linux-kernel-modules.c linux-proc-maps.c \ + dwfl_addrmodule.c dwfl_addrdwarf.c \ + cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ + dwfl_module_addrdie.c dwfl_addrdie.c \ + lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \ + dwfl_linemodule.c dwfl_linecu.c \ + dwfl_getsrclines.c dwfl_onesrcline.c \ + dwfl_module_getsrc.c dwfl_getsrc.c \ + dwfl_module_getsrc_file.c \ + libdwfl_crc32.c libdwfl_crc32_file.c \ + elf-from-memory.c \ + dwfl_module_getsym.c \ + dwfl_module_addrname.c dwfl_module_addrsym.c \ + dwfl_module_return_value_location.c \ + dwfl_module_register_names.c \ + dwfl_segment_report_module.c \ + link_map.c core-file.c + +@MUDFLAP_FALSE@libdwfl = $(libdw) +@MUDFLAP_TRUE@libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu) +@MUDFLAP_FALSE@libdw = ../libdw/libdw.so +@MUDFLAP_TRUE@libdw = ../libdw/libdw.a +@MUDFLAP_FALSE@libelf = ../libelf/libelf.so +@MUDFLAP_TRUE@libelf = ../libelf/libelf.a +@MUDFLAP_TRUE@libmudflap = -lmudflap +libebl = ../libebl/libebl.a +libeu = ../lib/libeu.a +@MUDFLAP_FALSE@libdwfl_pic_a_SOURCES = +@MUDFLAP_FALSE@am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os) +noinst_HEADERS = libdwflP.h +CLEANFILES = $(am_libdwfl_pic_a_OBJECTS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libdwfl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits libdwfl/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdwfl.a: $(libdwfl_a_OBJECTS) $(libdwfl_a_DEPENDENCIES) + -rm -f libdwfl.a + $(libdwfl_a_AR) libdwfl.a $(libdwfl_a_OBJECTS) $(libdwfl_a_LIBADD) + $(RANLIB) libdwfl.a +libdwfl_pic.a: $(libdwfl_pic_a_OBJECTS) $(libdwfl_pic_a_DEPENDENCIES) + -rm -f libdwfl_pic.a + $(libdwfl_pic_a_AR) libdwfl_pic.a $(libdwfl_pic_a_OBJECTS) $(libdwfl_pic_a_LIBADD) + $(RANLIB) libdwfl_pic.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argp-std.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core-file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/derelocate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_addrdie.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_addrdwarf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_addrmodule.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_begin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_build_id_find_debuginfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_build_id_find_elf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_cumodule.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_end.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getdwarf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getmodules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getsrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_getsrclines.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_line_comp_dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_linecu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_lineinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_linemodule.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrdie.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrsym.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_build_id.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getdwarf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsym.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_nextcu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_register_names.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_report_build_id.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_return_value_location.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_nextcu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_onesrcline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_report_elf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_segment_report_module.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_validate_address.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_version.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-from-memory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find-debuginfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdwfl_crc32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdwfl_crc32_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link_map.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-kernel-modules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-proc-maps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relocate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/segment.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(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 $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pkgincludeHEADERS + +install-dvi: install-dvi-am + +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 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic 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-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-pkgincludeHEADERS + + +@MUDFLAP_FALSE@%.os: %.c %.o +@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ +@MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ +@MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ +@MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \ +@MUDFLAP_FALSE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@MUDFLAP_FALSE@ fi +# 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/libdwfl/argp-std.c b/libdwfl/argp-std.c new file mode 100644 index 00000000..0a0f7ebf --- /dev/null +++ b/libdwfl/argp-std.c @@ -0,0 +1,336 @@ +/* Standard argp argument parsers for tools using libdwfl. + Copyright (C) 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <argp.h> +#include <stdlib.h> +#include <assert.h> +#include <libintl.h> +#include <fcntl.h> +#include <unistd.h> + +/* gettext helper macros. */ +#define _(Str) dgettext ("elfutils", Str) + + +#define OPT_DEBUGINFO 0x100 +#define OPT_COREFILE 0x101 + +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Input selection options:"), 0 }, + { "executable", 'e', "FILE", 0, N_("Find addresses in FILE"), 0 }, + { "core", OPT_COREFILE, "COREFILE", 0, + N_("Find addresses from signatures found in COREFILE"), 0 }, + { "pid", 'p', "PID", 0, + N_("Find addresses in files mapped into process PID"), 0 }, + { "linux-process-map", 'M', "FILE", 0, + N_("Find addresses in files mapped as read from FILE" + " in Linux /proc/PID/maps format"), 0 }, + { "kernel", 'k', NULL, 0, N_("Find addresses in the running kernel"), 0 }, + { "offline-kernel", 'K', "RELEASE", OPTION_ARG_OPTIONAL, + N_("Kernel with all modules"), 0 }, + { "debuginfo-path", OPT_DEBUGINFO, "PATH", 0, + N_("Search path for separate debuginfo files"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +static char *debuginfo_path; + +static const Dwfl_Callbacks offline_callbacks = + { + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), + .debuginfo_path = &debuginfo_path, + + .section_address = INTUSE(dwfl_offline_section_address), + + /* We use this table for core files too. */ + .find_elf = INTUSE(dwfl_build_id_find_elf), + }; + +static const Dwfl_Callbacks proc_callbacks = + { + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), + .debuginfo_path = &debuginfo_path, + + .find_elf = INTUSE(dwfl_linux_proc_find_elf), + }; + +static const Dwfl_Callbacks kernel_callbacks = + { + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), + .debuginfo_path = &debuginfo_path, + + .find_elf = INTUSE(dwfl_linux_kernel_find_elf), + .section_address = INTUSE(dwfl_linux_kernel_module_section_address), + }; + +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + inline void failure (Dwfl *dwfl, int errnum, const char *msg) + { + if (dwfl != NULL) + dwfl_end (dwfl); + if (errnum == -1) + argp_failure (state, EXIT_FAILURE, 0, "%s: %s", + msg, INTUSE(dwfl_errmsg) (-1)); + else + argp_failure (state, EXIT_FAILURE, errnum, "%s", msg); + } + inline error_t fail (Dwfl *dwfl, int errnum, const char *msg) + { + failure (dwfl, errnum, msg); + return errnum == -1 ? EIO : errnum; + } + + switch (key) + { + case OPT_DEBUGINFO: + debuginfo_path = arg; + break; + + case 'e': + { + Dwfl *dwfl = state->hook; + if (dwfl == NULL) + { + dwfl = INTUSE(dwfl_begin) (&offline_callbacks); + if (dwfl == NULL) + return fail (dwfl, -1, arg); + state->hook = dwfl; + + /* Start at zero so if there is just one -e foo.so, + the DSO is shown without address bias. */ + dwfl->offline_next_address = 0; + } + if (dwfl->callbacks == &offline_callbacks) + { + if (INTUSE(dwfl_report_offline) (dwfl, "", arg, -1) == NULL) + return fail (dwfl, -1, arg); + state->hook = dwfl; + } + else + { + toomany: + argp_error (state, "%s", + _("only one of -e, -p, -k, -K, or --core allowed")); + return EINVAL; + } + } + break; + + case 'p': + if (state->hook == NULL) + { + Dwfl *dwfl = INTUSE(dwfl_begin) (&proc_callbacks); + int result = INTUSE(dwfl_linux_proc_report) (dwfl, atoi (arg)); + if (result != 0) + return fail (dwfl, result, arg); + state->hook = dwfl; + } + else + goto toomany; + break; + + case 'M': + if (state->hook == NULL) + { + FILE *f = fopen (arg, "r"); + if (f == NULL) + nofile: + { + int code = errno; + argp_failure (state, EXIT_FAILURE, code, + "cannot open '%s'", arg); + return code; + } + Dwfl *dwfl = INTUSE(dwfl_begin) (&proc_callbacks); + int result = INTUSE(dwfl_linux_proc_maps_report) (dwfl, f); + fclose (f); + if (result != 0) + return fail (dwfl, result, arg); + state->hook = dwfl; + } + else + goto toomany; + break; + + case OPT_COREFILE: + { + Dwfl *dwfl = state->hook; + if (dwfl == NULL) + state->hook = dwfl = INTUSE(dwfl_begin) (&offline_callbacks); + /* Permit -e and --core together. */ + else if (dwfl->callbacks != &offline_callbacks) + goto toomany; + + int fd = open64 (arg, O_RDONLY); + if (fd < 0) + goto nofile; + + Elf *core = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + if (core == NULL) + { + close (fd); + argp_failure (state, EXIT_FAILURE, 0, + _("cannot read ELF core file: %s"), + elf_errmsg (-1)); + return EIO; + } + + GElf_Ehdr ehdr; + int result = INTUSE(dwfl_core_file_report) (dwfl, core, + gelf_getehdr (core, &ehdr)); + if (result < 0) + { + elf_end (core); + close (fd); + return fail (dwfl, result, arg); + } + + /* From now we leak FD and CORE. */ + + if (result == 0) + { + argp_failure (state, EXIT_FAILURE, 0, + _("No modules recognized in core file")); + return ENOENT; + } + } + break; + + case 'k': + if (state->hook == NULL) + { + Dwfl *dwfl = INTUSE(dwfl_begin) (&kernel_callbacks); + int result = INTUSE(dwfl_linux_kernel_report_kernel) (dwfl); + if (result != 0) + return fail (dwfl, result, _("cannot load kernel symbols")); + result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl); + if (result != 0) + /* Non-fatal to have no modules since we do have the kernel. */ + failure (dwfl, result, _("cannot find kernel modules")); + state->hook = dwfl; + } + else + goto toomany; + break; + + case 'K': + if (state->hook == NULL) + { + Dwfl *dwfl = INTUSE(dwfl_begin) (&offline_callbacks); + int result = INTUSE(dwfl_linux_kernel_report_offline) (dwfl, arg, + NULL); + if (result != 0) + return fail (dwfl, result, _("cannot find kernel or modules")); + state->hook = dwfl; + } + else + goto toomany; + break; + + case ARGP_KEY_SUCCESS: + { + Dwfl *dwfl = state->hook; + + if (dwfl == NULL) + { + /* Default if no -e, -p, or -k, is "-e a.out". */ + arg = "a.out"; + dwfl = INTUSE(dwfl_begin) (&offline_callbacks); + if (INTUSE(dwfl_report_offline) (dwfl, "", arg, -1) == NULL) + return fail (dwfl, -1, arg); + state->hook = dwfl; + } + + /* One of the three flavors has done dwfl_begin and some reporting + if we got here. Tie up the Dwfl and return it to the caller of + argp_parse. */ + + int result = INTUSE(dwfl_report_end) (dwfl, NULL, NULL); + assert (result == 0); + } + break; + + case ARGP_KEY_ERROR: + dwfl_end (state->hook); + state->hook = NULL; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + + /* Update the input all along, so a parent parser can see it. */ + *(Dwfl **) state->input = state->hook; + return 0; +} + +static const struct argp libdwfl_argp = + { .options = options, .parser = parse_opt }; + +const struct argp * +dwfl_standard_argp (void) +{ + return &libdwfl_argp; +} + +#ifdef _MUDFLAP +/* In the absence of a mudflap wrapper for argp_parse, or a libc compiled + with -fmudflap, we'll see spurious errors for using the struct argp_state + on argp_parse's stack. */ + +void __attribute__ ((constructor)) +__libdwfl_argp_mudflap_options (void) +{ + __mf_set_options ("-heur-stack-bound"); +} +#endif diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c new file mode 100644 index 00000000..bc881eb9 --- /dev/null +++ b/libdwfl/core-file.c @@ -0,0 +1,456 @@ +/* Core file handling. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include "../libelf/libelfP.h" /* For NOTE_ALIGN. */ +#undef _ +#include "libdwflP.h" +#include <gelf.h> + +#include <sys/param.h> +#include <unistd.h> +#include <endian.h> +#include <byteswap.h> +#include "system.h" + + +/* This is a prototype of what a new libelf interface might be. + This implementation is pessimal for non-mmap cases and should + be replaced by more diddling inside libelf internals. */ +static Elf * +elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next) +{ + if (parent == NULL) + return NULL; + + /* On failure return, we update *NEXT to point back at OFFSET. */ + inline Elf *fail (int error) + { + if (next != NULL) + *next = offset; + //__libelf_seterrno (error); + __libdwfl_seterrno (DWFL_E (LIBELF, error)); + return NULL; + } + + loff_t min = (parent->kind == ELF_K_ELF ? + (parent->class == ELFCLASS32 + ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr)) + : parent->kind == ELF_K_AR ? SARMAG + : 0); + + if (unlikely (offset < min) + || unlikely (offset >= (loff_t) parent->maximum_size)) + return fail (ELF_E_RANGE); + + /* For an archive, fetch just the size field + from the archive header to override SIZE. */ + if (parent->kind == ELF_K_AR) + { + struct ar_hdr h = { .ar_size = "" }; + + if (unlikely (parent->maximum_size - offset < sizeof h)) + return fail (ELF_E_RANGE); + + if (parent->map_address != NULL) + memcpy (h.ar_size, parent->map_address + parent->start_offset + offset, + sizeof h.ar_size); + else if (unlikely (pread_retry (parent->fildes, + h.ar_size, sizeof (h.ar_size), + parent->start_offset + offset + + offsetof (struct ar_hdr, ar_size)) + != sizeof (h.ar_size))) + return fail (ELF_E_READ_ERROR); + + offset += sizeof h; + + char *endp; + size = strtoll (h.ar_size, &endp, 10); + if (unlikely (endp == h.ar_size) + || unlikely ((loff_t) parent->maximum_size - offset < size)) + return fail (ELF_E_INVALID_ARCHIVE); + } + + if (unlikely ((loff_t) parent->maximum_size - offset < size)) + return fail (ELF_E_RANGE); + + /* Even if we fail at this point, update *NEXT to point past the file. */ + if (next != NULL) + *next = offset + size; + + if (unlikely (offset == 0) + && unlikely (size == (loff_t) parent->maximum_size)) + return elf_clone (parent, parent->cmd); + + /* Note the image is guaranteed live only as long as PARENT + lives. Using elf_memory is quite suboptimal if the whole + file is not mmap'd. We really should have something like + a generalization of the archive support. */ + Elf_Data *data = elf_getdata_rawchunk (parent, offset, size, ELF_T_BYTE); + if (data == NULL) + return NULL; + assert ((loff_t) data->d_size == size); + return elf_memory (data->d_buf, size); +} + + +int +dwfl_report_core_segments (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr, + GElf_Phdr *notes) +{ + if (unlikely (dwfl == NULL)) + return -1; + + if (unlikely (elf == NULL) || unlikely (ehdr == NULL)) + { + __libdw_seterrno (DWFL_E_LIBELF); + return -1; + } + + int result = 0; + + if (notes != NULL) + notes->p_type = PT_NULL; + + for (int ndx = 0; result >= 0 && ndx < ehdr->e_phnum; ++ndx) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (elf, ndx, &phdr_mem); + if (unlikely (phdr == NULL)) + { + __libdwfl_seterrno (DWFL_E_LIBELF); + return -1; + } + switch (phdr->p_type) + { + case PT_LOAD: + result = dwfl_report_segment (dwfl, ndx, phdr, 0, NULL); + break; + + case PT_NOTE: + if (notes != NULL) + { + *notes = *phdr; + notes = NULL; + } + break; + } + } + + return result; +} + +/* Never read more than this much without mmap. */ +#define MAX_EAGER_COST 8192 + +static bool +core_file_read_eagerly (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr start __attribute__ ((unused)), + void **buffer, size_t *buffer_available, + GElf_Off cost, GElf_Off worthwhile, + GElf_Off whole, + GElf_Off contiguous __attribute__ ((unused)), + void *arg, Elf **elfp) +{ + Elf *core = arg; + + if (whole <= *buffer_available) + { + /* All there ever was, we already have on hand. */ + + if (core->map_address == NULL) + { + /* We already malloc'd the buffer. */ + *elfp = elf_memory (*buffer, whole); + if (unlikely (*elfp == NULL)) + return false; + + (*elfp)->flags |= ELF_F_MALLOCED; + *buffer = NULL; + *buffer_available = 0; + return true; + } + + /* We can use the image inside the core file directly. */ + *elfp = elf_begin_rand (core, *buffer - core->map_address, whole, NULL); + *buffer = NULL; + *buffer_available = 0; + return *elfp != NULL; + } + + /* We don't have the whole file. + Figure out if this is better than nothing. */ + + if (worthwhile == 0) + /* Caller doesn't think so. */ + return false; + + /* + XXX would like to fall back to partial file via memory + when build id find_elf fails + also, link_map name may give file name from disk better than partial here + requires find_elf hook re-doing the magic to fall back if no file found + */ + + if (mod->build_id_len > 0) + /* There is a build ID that could help us find the whole file, + which might be more useful than what we have. + We'll just rely on that. */ + return false; + + if (core->map_address != NULL) + /* It's cheap to get, so get it. */ + return true; + + /* Only use it if there isn't too much to be read. */ + return cost <= MAX_EAGER_COST; +} + +bool +dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, + void **buffer, size_t *buffer_available, + GElf_Addr vaddr, + size_t minread, + void *arg) +{ + Elf *elf = arg; + + if (ndx == -1) + { + /* Called for cleanup. */ + if (elf->map_address == NULL) + free (*buffer); + *buffer = NULL; + *buffer_available = 0; + return false; + } + + const GElf_Off align = dwfl->segment_align ?: 1; + GElf_Phdr phdr; + + do + if (unlikely (gelf_getphdr (elf, ndx++, &phdr) == NULL)) + return true; + while (phdr.p_type != PT_LOAD + || ((phdr.p_vaddr + phdr.p_memsz + align - 1) & -align) <= vaddr); + + GElf_Off start = vaddr - phdr.p_vaddr + phdr.p_offset; + GElf_Off end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + + /* Use following contiguous segments to get towards SIZE. */ + inline bool more (size_t size) + { + while (end <= start || end - start < size) + { + if (phdr.p_filesz < phdr.p_memsz) + /* This segment is truncated, so no following one helps us. */ + return false; + + if (unlikely (gelf_getphdr (elf, ndx++, &phdr) == NULL)) + return false; + + if (phdr.p_type == PT_LOAD) + { + if (phdr.p_offset > end) + /* It's discontiguous! */ + return false; + + end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + } + } + return true; + } + + /* We need at least this much. */ + if (! more (minread)) + return false; + + /* See how much more we can get of what the caller wants. */ + (void) more (*buffer_available); + + /* If it's already on hand anyway, use as much as there is. */ + if (elf->map_address != NULL) + (void) more (elf->maximum_size - start); + + if (unlikely (end - start > elf->maximum_size)) + end = start + elf->maximum_size; + + if (elf->map_address != NULL) + { + void *contents = elf->map_address + elf->start_offset + start; + size_t size = end - start; + + if (minread == 0) /* String mode. */ + { + const void *eos = memchr (contents, '\0', size); + if (unlikely (eos == NULL) || unlikely (eos == contents)) + return false; + size = eos + 1 - contents; + } + + if (*buffer == NULL) + { + *buffer = contents; + *buffer_available = size; + } + else + { + *buffer_available = MIN (size, *buffer_available); + memcpy (*buffer, contents, *buffer_available); + } + } + else + { + void *into = *buffer; + if (*buffer == NULL) + { + *buffer_available = MIN (minread ?: 512, + MAX (4096, MIN (end - start, + *buffer_available))); + into = malloc (*buffer_available); + if (unlikely (into == NULL)) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return false; + } + } + + ssize_t nread = pread_retry (elf->fildes, into, *buffer_available, start); + if (nread < (ssize_t) minread) + { + if (into != *buffer) + free (into); + if (nread < 0) + __libdwfl_seterrno (DWFL_E_ERRNO); + return false; + } + + if (minread == 0) /* String mode. */ + { + const void *eos = memchr (into, '\0', nread); + if (unlikely (eos == NULL) || unlikely (eos == into)) + { + if (*buffer == NULL) + free (into); + return false; + } + nread = eos + 1 - into; + } + + if (*buffer == NULL) + *buffer = into; + *buffer_available = nread; + } + + return true; +} + +int +dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr) +{ + GElf_Phdr notes_phdr; + + /* First report each PT_LOAD segment. */ + int ndx = dwfl_report_core_segments (dwfl, elf, ehdr, ¬es_phdr); + if (unlikely (ndx <= 0)) + return ndx; + + /* Now sniff segment contents for modules. */ + ndx = 0; + do + { + int seg = dwfl_segment_report_module (dwfl, ndx, NULL, + &dwfl_elf_phdr_memory_callback, elf, + core_file_read_eagerly, elf); + if (unlikely (seg < 0)) + return seg; + ndx = seg > ndx ? seg : ndx + 1; + } + while (ndx < ehdr->e_phnum); + + /* Next, we should follow the chain from DT_DEBUG. */ + + const void *auxv = NULL; + size_t auxv_size = 0; + if (likely (notes_phdr.p_type == PT_NOTE)) + { + /* PT_NOTE -> NT_AUXV -> AT_PHDR -> PT_DYNAMIC -> DT_DEBUG */ + + Elf_Data *notes = elf_getdata_rawchunk (elf, + notes_phdr.p_offset, + notes_phdr.p_filesz, + ELF_T_NHDR); + if (likely (notes != NULL)) + { + size_t pos = 0; + GElf_Nhdr nhdr; + size_t name_pos; + size_t desc_pos; + while ((pos = gelf_getnote (notes, pos, &nhdr, + &name_pos, &desc_pos)) > 0) + if (nhdr.n_type == NT_AUXV + && nhdr.n_namesz == sizeof "CORE" + && !memcmp (notes->d_buf + name_pos, "CORE", sizeof "CORE")) + { + auxv = notes->d_buf + desc_pos; + auxv_size = nhdr.n_descsz; + break; + } + } + } + + /* Now we have NT_AUXV contents. From here on this processing could be + used for a live process with auxv read from /proc. */ + + return dwfl_link_map_report (dwfl, auxv, auxv_size, + dwfl_elf_phdr_memory_callback, elf); +} +INTDEF (dwfl_core_file_report) diff --git a/libdwfl/cu.c b/libdwfl/cu.c new file mode 100644 index 00000000..8f01ea6b --- /dev/null +++ b/libdwfl/cu.c @@ -0,0 +1,323 @@ +/* Keeping track of DWARF compilation units in libdwfl. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include "../libdw/libdwP.h" +#include "../libdw/memory-access.h" +#include <search.h> + + +static inline Dwarf_Arange * +dwar (Dwfl_Module *mod, unsigned int idx) +{ + return &mod->dw->aranges->info[mod->aranges[idx].arange]; +} + + +static Dwfl_Error +addrarange (Dwfl_Module *mod, Dwarf_Addr addr, struct dwfl_arange **arange) +{ + if (mod->aranges == NULL) + { + struct dwfl_arange *aranges = NULL; + Dwarf_Aranges *dwaranges = NULL; + size_t naranges; + if (INTUSE(dwarf_getaranges) (mod->dw, &dwaranges, &naranges) != 0) + return DWFL_E_LIBDW; + + /* If the module has no aranges (when no code is included) we + allocate nothing. */ + if (naranges != 0) + { + aranges = malloc (naranges * sizeof *aranges); + if (unlikely (aranges == NULL)) + return DWFL_E_NOMEM; + + /* libdw has sorted its list by address, which is how we want it. + But the sorted list is full of not-quite-contiguous runs pointing + to the same CU. We don't care about the little gaps inside the + module, we'll consider them part of the surrounding CU anyway. + Collect our own array with just one record for each run of ranges + pointing to one CU. */ + + naranges = 0; + Dwarf_Off lastcu = 0; + for (size_t i = 0; i < dwaranges->naranges; ++i) + if (i == 0 || dwaranges->info[i].offset != lastcu) + { + aranges[naranges].arange = i; + aranges[naranges].cu = NULL; + ++naranges; + lastcu = dwaranges->info[i].offset; + } + } + + /* Store the final array, which is probably much smaller than before. */ + mod->naranges = naranges; + mod->aranges = (realloc (aranges, naranges * sizeof aranges[0]) + ?: aranges); + mod->lazycu += naranges; + } + + /* The address must be inside the module to begin with. */ + addr -= mod->debug.bias; + + /* The ranges are sorted by address, so we can use binary search. */ + size_t l = 0, u = mod->naranges; + while (l < u) + { + size_t idx = (l + u) / 2; + Dwarf_Addr start = dwar (mod, idx)->addr; + if (addr < start) + { + u = idx; + continue; + } + else if (addr > start) + { + if (idx + 1 < mod->naranges) + { + if (addr >= dwar (mod, idx + 1)->addr) + { + l = idx + 1; + continue; + } + } + else + { + /* It might be in the last range. */ + const Dwarf_Arange *last + = &mod->dw->aranges->info[mod->dw->aranges->naranges - 1]; + if (addr > last->addr + last->length) + break; + } + } + + *arange = &mod->aranges[idx]; + return DWFL_E_NOERROR; + } + + return DWFL_E_ADDR_OUTOFRANGE; +} + + +static void +nofree (void *arg) +{ + struct dwfl_cu *cu = arg; + if (cu == (void *) -1l) + return; + + assert (cu->mod->lazycu == 0); +} + +/* One reason fewer to keep the lazy lookup table for CUs. */ +static inline void +less_lazy (Dwfl_Module *mod) +{ + if (--mod->lazycu > 0) + return; + + /* We know about all the CUs now, we don't need this table. */ + tdestroy (mod->lazy_cu_root, nofree); + mod->lazy_cu_root = NULL; +} + +static inline Dwarf_Off +cudie_offset (const struct dwfl_cu *cu) +{ + return cu->die.cu->start + 3 * cu->die.cu->offset_size - 4 + 3; +} + +static int +compare_cukey (const void *a, const void *b) +{ + return cudie_offset (a) - cudie_offset (b); +} + +/* Intern the CU if necessary. */ +static Dwfl_Error +intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result) +{ + struct Dwarf_CU dwkey; + struct dwfl_cu key; + key.die.cu = &dwkey; + dwkey.offset_size = 0; + dwkey.start = cuoff - (3 * 0 - 4 + 3); + struct dwfl_cu **found = tsearch (&key, &mod->lazy_cu_root, &compare_cukey); + if (unlikely (found == NULL)) + return DWFL_E_NOMEM; + + if (*found == &key || *found == NULL) + { + if (unlikely (cuoff + 4 >= mod->dw->sectiondata[IDX_debug_info]->d_size)) + { + /* This is the EOF marker. Now we have interned all the CUs. + One increment in MOD->lazycu counts not having hit EOF yet. */ + *found = (void *) -1l; + less_lazy (mod); + } + else + { + /* This is a new entry, meaning we haven't looked at this CU. */ + + *found = NULL; + + struct dwfl_cu *cu = malloc (sizeof *cu); + if (unlikely (cu == NULL)) + return DWFL_E_NOMEM; + + cu->mod = mod; + cu->next = NULL; + cu->lines = NULL; + + /* XXX use non-searching lookup */ + Dwarf_Die *die = INTUSE(dwarf_offdie) (mod->dw, cuoff, &cu->die); + if (die == NULL) + return DWFL_E_LIBDW; + assert (die == &cu->die); + + struct dwfl_cu **newvec = realloc (mod->cu, ((mod->ncu + 1) + * sizeof (mod->cu[0]))); + if (newvec == NULL) + { + free (cu); + return DWFL_E_NOMEM; + } + mod->cu = newvec; + + mod->cu[mod->ncu++] = cu; + if (cu->die.cu->start == 0) + mod->first_cu = cu; + + *found = cu; + } + } + + *result = *found; + return DWFL_E_NOERROR; +} + + +/* Traverse all the CUs in the module. */ + +Dwfl_Error +internal_function +__libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu, + struct dwfl_cu **cu) +{ + Dwarf_Off cuoff; + struct dwfl_cu **nextp; + + if (lastcu == NULL) + { + /* Start the traversal. */ + cuoff = 0; + nextp = &mod->first_cu; + } + else + { + /* Continue following LASTCU. */ + cuoff = lastcu->die.cu->end; + nextp = &lastcu->next; + } + + if (*nextp == NULL) + { + size_t cuhdrsz; + Dwarf_Off nextoff; + int end = INTUSE(dwarf_nextcu) (mod->dw, cuoff, &nextoff, &cuhdrsz, + NULL, NULL, NULL); + if (end < 0) + return DWFL_E_LIBDW; + if (end > 0) + { + *cu = NULL; + return DWFL_E_NOERROR; + } + + Dwfl_Error result = intern_cu (mod, cuoff + cuhdrsz, nextp); + if (result != DWFL_E_NOERROR) + return result; + + if ((*nextp)->next == NULL && nextoff == (Dwarf_Off) -1l) + (*nextp)->next = (void *) -1l; + } + + *cu = *nextp == (void *) -1l ? NULL : *nextp; + return DWFL_E_NOERROR; +} + + +/* Intern the CU arange points to, if necessary. */ + +static Dwfl_Error +arangecu (Dwfl_Module *mod, struct dwfl_arange *arange, struct dwfl_cu **cu) +{ + if (arange->cu == NULL) + { + const Dwarf_Arange *dwarange = &mod->dw->aranges->info[arange->arange]; + Dwfl_Error result = intern_cu (mod, dwarange->offset, &arange->cu); + if (result != DWFL_E_NOERROR) + return result; + assert (arange->cu != NULL && arange->cu != (void *) -1l); + less_lazy (mod); /* Each arange with null ->cu counts once. */ + } + + *cu = arange->cu; + return DWFL_E_NOERROR; +} + +Dwfl_Error +internal_function +__libdwfl_addrcu (Dwfl_Module *mod, Dwarf_Addr addr, struct dwfl_cu **cu) +{ + struct dwfl_arange *arange; + return addrarange (mod, addr, &arange) ?: arangecu (mod, arange, cu); +} diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c new file mode 100644 index 00000000..f2a64675 --- /dev/null +++ b/libdwfl/derelocate.c @@ -0,0 +1,411 @@ +/* Recover relocatibility for addresses computed from debug information. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +struct dwfl_relocation +{ + size_t count; + struct + { + Elf_Scn *scn; + Elf_Scn *relocs; + const char *name; + GElf_Addr start, end; + } refs[0]; +}; + + +struct secref +{ + struct secref *next; + Elf_Scn *scn; + Elf_Scn *relocs; + const char *name; + GElf_Addr start, end; +}; + +static int +compare_secrefs (const void *a, const void *b) +{ + struct secref *const *p1 = a; + struct secref *const *p2 = b; + + /* No signed difference calculation is correct here, since the + terms are unsigned and could be more than INT64_MAX apart. */ + if ((*p1)->start < (*p2)->start) + return -1; + if ((*p1)->start > (*p2)->start) + return 1; + + return 0; +} + +static int +cache_sections (Dwfl_Module *mod) +{ + struct secref *refs = NULL; + size_t nrefs = 0; + + size_t shstrndx; + if (unlikely (elf_getshstrndx (mod->main.elf, &shstrndx) < 0)) + { + elf_error: + __libdwfl_seterrno (DWFL_E_LIBELF); + return -1; + } + + bool check_reloc_sections = false; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + goto elf_error; + + if ((shdr->sh_flags & SHF_ALLOC) && shdr->sh_addr == 0) + { + /* This section might not yet have been looked at. */ + if (__libdwfl_relocate_value (mod, mod->main.elf, &shstrndx, + elf_ndxscn (scn), + &shdr->sh_addr) != DWFL_E_NOERROR) + continue; + shdr = gelf_getshdr (scn, &shdr_mem); + if (unlikely (shdr == NULL)) + goto elf_error; + } + + if (shdr->sh_flags & SHF_ALLOC) + { + const char *name = elf_strptr (mod->main.elf, shstrndx, + shdr->sh_name); + if (unlikely (name == NULL)) + goto elf_error; + + struct secref *newref = alloca (sizeof *newref); + newref->scn = scn; + newref->relocs = NULL; + newref->name = name; + newref->start = shdr->sh_addr + mod->main.bias; + newref->end = newref->start + shdr->sh_size; + newref->next = refs; + refs = newref; + ++nrefs; + } + + if (mod->e_type == ET_REL + && shdr->sh_size != 0 + && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) + && mod->dwfl->callbacks->section_address != NULL) + { + if (shdr->sh_info < elf_ndxscn (scn)) + { + /* We've already looked at the section these relocs apply to. */ + Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); + if (likely (tscn != NULL)) + for (struct secref *sec = refs; sec != NULL; sec = sec->next) + if (sec->scn == tscn) + { + sec->relocs = scn; + break; + } + } + else + /* We'll have to do a second pass. */ + check_reloc_sections = true; + } + } + + mod->reloc_info = malloc (offsetof (struct dwfl_relocation, refs[nrefs])); + if (mod->reloc_info == NULL) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + + struct secref **sortrefs = alloca (nrefs * sizeof sortrefs[0]); + for (size_t i = nrefs; i-- > 0; refs = refs->next) + sortrefs[i] = refs; + assert (refs == NULL); + + qsort (sortrefs, nrefs, sizeof sortrefs[0], &compare_secrefs); + + mod->reloc_info->count = nrefs; + for (size_t i = 0; i < nrefs; ++i) + { + mod->reloc_info->refs[i].name = sortrefs[i]->name; + mod->reloc_info->refs[i].scn = sortrefs[i]->scn; + mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs; + mod->reloc_info->refs[i].start = sortrefs[i]->start; + mod->reloc_info->refs[i].end = sortrefs[i]->end; + } + + if (unlikely (check_reloc_sections)) + { + /* There was a reloc section that preceded its target section. + So we have to scan again now that we have cached all the + possible target sections we care about. */ + + scn = NULL; + while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + goto elf_error; + + if (shdr->sh_size != 0 + && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA)) + { + Elf_Scn *tscn = elf_getscn (mod->main.elf, shdr->sh_info); + if (likely (tscn != NULL)) + for (size_t i = 0; i < nrefs; ++i) + if (mod->reloc_info->refs[i].scn == tscn) + { + mod->reloc_info->refs[i].relocs = scn; + break; + } + } + } + } + + return nrefs; +} + + +int +dwfl_module_relocations (Dwfl_Module *mod) +{ + if (mod == NULL) + return -1; + + if (mod->reloc_info != NULL) + return mod->reloc_info->count; + + switch (mod->e_type) + { + case ET_REL: + return cache_sections (mod); + + case ET_DYN: + return 1; + + case ET_EXEC: + assert (mod->main.bias == 0); + assert (mod->debug.bias == 0); + break; + } + + return 0; +} + +const char * +dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx, + Elf32_Word *shndxp) +{ + if (mod == NULL) + return NULL; + + switch (mod->e_type) + { + case ET_REL: + break; + + case ET_DYN: + if (idx != 0) + return NULL; + if (shndxp) + *shndxp = SHN_ABS; + return ""; + + default: + return NULL; + } + + if (unlikely (mod->reloc_info == NULL) && cache_sections (mod) < 0) + return NULL; + + struct dwfl_relocation *sections = mod->reloc_info; + + if (idx >= sections->count) + return NULL; + + if (shndxp) + *shndxp = elf_ndxscn (sections->refs[idx].scn); + + return sections->refs[idx].name; +} + +/* Check that MOD is valid and make sure its relocation has been done. */ +static bool +check_module (Dwfl_Module *mod) +{ + if (INTUSE(dwfl_module_getsymtab) (mod) < 0) + { + Dwfl_Error error = dwfl_errno (); + if (error != DWFL_E_NO_SYMTAB) + { + __libdwfl_seterrno (error); + return true; + } + } + + if (mod->dw == NULL) + { + Dwarf_Addr bias; + if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL) + { + Dwfl_Error error = dwfl_errno (); + if (error != DWFL_E_NO_DWARF) + { + __libdwfl_seterrno (error); + return true; + } + } + } + + return false; +} + +/* Find the index in MOD->reloc_info.refs containing *ADDR. */ +static int +find_section (Dwfl_Module *mod, Dwarf_Addr *addr) +{ + if (unlikely (mod->reloc_info == NULL) && cache_sections (mod) < 0) + return -1; + + struct dwfl_relocation *sections = mod->reloc_info; + + /* The sections are sorted by address, so we can use binary search. */ + size_t l = 0, u = sections->count; + while (l < u) + { + size_t idx = (l + u) / 2; + if (*addr < sections->refs[idx].start) + u = idx; + else if (*addr > sections->refs[idx].end) + l = idx + 1; + else + { + /* Consider the limit of a section to be inside it, unless it's + inside the next one. A section limit address can appear in + line records. */ + if (*addr == sections->refs[idx].end + && idx < sections->count + && *addr == sections->refs[idx + 1].start) + ++idx; + + *addr -= sections->refs[idx].start; + return idx; + } + } + + __libdwfl_seterrno (DWFL_E (LIBDW, DWARF_E_NO_MATCH)); + return -1; +} + +int +dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr) +{ + if (unlikely (check_module (mod))) + return -1; + + switch (mod->e_type) + { + case ET_REL: + return find_section (mod, addr); + + case ET_DYN: + /* All relative to first and only relocation base: module start. */ + *addr -= mod->low_addr; + break; + + default: + /* Already absolute, dwfl_module_relocations returned zero. We + shouldn't really have been called, but it's a harmless no-op. */ + break; + } + + return 0; +} +INTDEF (dwfl_module_relocate_address) + +Elf_Scn * +dwfl_module_address_section (Dwfl_Module *mod, Dwarf_Addr *address, + Dwarf_Addr *bias) +{ + if (check_module (mod)) + return NULL; + + int idx = find_section (mod, address); + if (idx < 0) + return NULL; + + if (mod->reloc_info->refs[idx].relocs != NULL) + { + assert (mod->e_type == ET_REL); + + Elf_Scn *tscn = mod->reloc_info->refs[idx].scn; + Elf_Scn *relocscn = mod->reloc_info->refs[idx].relocs; + Dwfl_Error result = __libdwfl_relocate_section (mod, mod->main.elf, + relocscn, tscn, true); + if (likely (result == DWFL_E_NOERROR)) + mod->reloc_info->refs[idx].relocs = NULL; + else + { + __libdwfl_seterrno (result); + return NULL; + } + } + + *bias = mod->main.bias; + return mod->reloc_info->refs[idx].scn; +} +INTDEF (dwfl_module_address_section) diff --git a/libdwfl/dwfl_addrdie.c b/libdwfl/dwfl_addrdie.c new file mode 100644 index 00000000..20c15783 --- /dev/null +++ b/libdwfl/dwfl_addrdie.c @@ -0,0 +1,57 @@ +/* Fetch CU DIE from address. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwarf_Die * +dwfl_addrdie (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias) +{ + return INTUSE(dwfl_module_addrdie) (INTUSE(dwfl_addrmodule) (dwfl, addr), + addr, bias); +} diff --git a/libdwfl/dwfl_addrdwarf.c b/libdwfl/dwfl_addrdwarf.c new file mode 100644 index 00000000..365c69c5 --- /dev/null +++ b/libdwfl/dwfl_addrdwarf.c @@ -0,0 +1,58 @@ +/* Fetch libdw handle from address. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwarf * +dwfl_addrdwarf (Dwfl *dwfl, Dwarf_Addr address, Dwarf_Addr *bias) +{ + return INTUSE(dwfl_module_getdwarf) (INTUSE(dwfl_addrmodule) (dwfl, address), + bias); +} +INTDEF (dwfl_addrdwarf) diff --git a/libdwfl/dwfl_addrmodule.c b/libdwfl/dwfl_addrmodule.c new file mode 100644 index 00000000..64559436 --- /dev/null +++ b/libdwfl/dwfl_addrmodule.c @@ -0,0 +1,59 @@ +/* Find module containing address. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl_Module * +dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address) +{ + Dwfl_Module *mod; + (void) INTUSE(dwfl_addrsegment) (dwfl, address, &mod); + return mod; +} +INTDEF (dwfl_addrmodule) diff --git a/libdwfl/dwfl_begin.c b/libdwfl/dwfl_begin.c new file mode 100644 index 00000000..d388ee00 --- /dev/null +++ b/libdwfl/dwfl_begin.c @@ -0,0 +1,72 @@ +/* Set up a session using libdwfl. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl * +dwfl_begin (const Dwfl_Callbacks *callbacks) +{ + if (elf_version (EV_CURRENT) == EV_NONE) + { + __libdwfl_seterrno (DWFL_E_LIBELF); + return NULL; + } + + Dwfl *dwfl = calloc (1, sizeof *dwfl); + if (dwfl == NULL) + __libdwfl_seterrno (DWFL_E_NOMEM); + else + { + dwfl->callbacks = callbacks; + dwfl->offline_next_address = OFFLINE_REDZONE; + } + + return dwfl; +} +INTDEF (dwfl_begin) diff --git a/libdwfl/dwfl_build_id_find_debuginfo.c b/libdwfl/dwfl_build_id_find_debuginfo.c new file mode 100644 index 00000000..97def072 --- /dev/null +++ b/libdwfl/dwfl_build_id_find_debuginfo.c @@ -0,0 +1,92 @@ +/* Find the debuginfo file for a module from its build ID. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <unistd.h> + + +int +dwfl_build_id_find_debuginfo (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *modname __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + const char *file __attribute__ ((unused)), + const char *debuglink __attribute__ ((unused)), + GElf_Word crc __attribute__ ((unused)), + char **debuginfo_file_name) +{ + int fd = -1; + const unsigned char *bits; + GElf_Addr vaddr; + if (INTUSE(dwfl_module_build_id) (mod, &bits, &vaddr) > 0) + fd = __libdwfl_open_by_build_id (mod, true, debuginfo_file_name); + if (fd >= 0) + { + /* We need to open an Elf handle on the file so we can check its + build ID note for validation. Backdoor the handle into the + module data structure since we had to open it early anyway. */ + mod->debug.elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + if (likely (__libdwfl_find_build_id (mod, false, mod->debug.elf) == 2)) + /* Also backdoor the gratuitous flag. */ + mod->debug.valid = true; + else + { + /* A mismatch! */ + elf_end (mod->debug.elf); + mod->debug.elf = NULL; + close (fd); + fd = -1; + free (*debuginfo_file_name); + *debuginfo_file_name = NULL; + errno = 0; + } + } + return fd; +} +INTDEF (dwfl_build_id_find_debuginfo) diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c new file mode 100644 index 00000000..88aa8211 --- /dev/null +++ b/libdwfl/dwfl_build_id_find_elf.c @@ -0,0 +1,176 @@ +/* Find an ELF file for a module from its build ID. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <inttypes.h> +#include <fcntl.h> +#include <unistd.h> + +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ + +int +internal_function +__libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name) +{ + /* If *FILE_NAME was primed into the module, leave it there + as the fallback when we have nothing to offer. */ + errno = 0; + if (mod->build_id_len <= 0) + return -1; + + const size_t id_len = mod->build_id_len; + const uint8_t *id = mod->build_id_bits; + + /* Search debuginfo_path directories' .build-id/ subdirectories. */ + + char id_name[sizeof "/.build-id/" + 1 + id_len * 2 + sizeof ".debug" - 1]; + strcpy (id_name, "/.build-id/"); + int n = snprintf (&id_name[sizeof "/.build-id/" - 1], + 4, "%02" PRIx8 "/", (uint8_t) id[0]); + assert (n == 3); + for (size_t i = 1; i < id_len; ++i) + { + n = snprintf (&id_name[sizeof "/.build-id/" - 1 + 3 + (i - 1) * 2], + 3, "%02" PRIx8, (uint8_t) id[i]); + assert (n == 2); + } + if (debug) + strcpy (&id_name[sizeof "/.build-id/" - 1 + 3 + (id_len - 1) * 2], + ".debug"); + + const Dwfl_Callbacks *const cb = mod->dwfl->callbacks; + +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); +#else + char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); +#endif +/* ANDROID_CHANGE_END */ + + int fd = -1; + char *dir; + while (fd < 0 && (dir = strsep (&path, ":")) != NULL) + { + if (dir[0] == '+' || dir[0] == '-') + ++dir; + + /* Only absolute directory names are useful to us. */ + if (dir[0] != '/') + continue; + + size_t dirlen = strlen (dir); + char *name = malloc (dirlen + sizeof id_name); + if (unlikely (name == NULL)) + break; + memcpy (mempcpy (name, dir, dirlen), id_name, sizeof id_name); + fd = TEMP_FAILURE_RETRY (open64 (name, O_RDONLY)); + if (fd >= 0) + { + if (*file_name != NULL) + free (*file_name); + *file_name = canonicalize_file_name (name); + if (*file_name == NULL) + { + *file_name = name; + name = NULL; + } + } + free (name); + } + +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + free(path); +#endif +/* ANDROID_CHANGE_END */ + + /* If we simply found nothing, clear errno. If we had some other error + with the file, report that. Possibly this should treat other errors + like ENOENT too. But ignoring all errors could mask some that should + be reported. */ + if (fd < 0 && errno == ENOENT) + errno = 0; + + return fd; +} + +int +dwfl_build_id_find_elf (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *modname __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + char **file_name, Elf **elfp) +{ + *elfp = NULL; + int fd = __libdwfl_open_by_build_id (mod, false, file_name); + if (fd >= 0) + { + *elfp = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + if (__libdwfl_find_build_id (mod, false, *elfp) == 2) + /* This is a backdoor signal to short-circuit the ID refresh. */ + mod->main.valid = true; + else + { + /* This file does not contain the ID it should! */ + elf_end (*elfp); + *elfp = NULL; + close (fd); + fd = -1; + free (*file_name); + *file_name = NULL; + } + } + return fd; +} +INTDEF (dwfl_build_id_find_elf) diff --git a/libdwfl/dwfl_cumodule.c b/libdwfl/dwfl_cumodule.c new file mode 100644 index 00000000..787c098f --- /dev/null +++ b/libdwfl/dwfl_cumodule.c @@ -0,0 +1,57 @@ +/* Find the module for a CU DIE previously returned by libdwfl. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl_Module * +dwfl_cumodule (Dwarf_Die *cudie) +{ + struct dwfl_cu *cu = (struct dwfl_cu *) cudie; + return cu->mod; +} diff --git a/libdwfl/dwfl_end.c b/libdwfl/dwfl_end.c new file mode 100644 index 00000000..429abb13 --- /dev/null +++ b/libdwfl/dwfl_end.c @@ -0,0 +1,71 @@ +/* Finish a session using libdwfl. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +void +dwfl_end (Dwfl *dwfl) +{ + if (dwfl == NULL) + return; + + free (dwfl->lookup_addr); + free (dwfl->lookup_module); + free (dwfl->lookup_segndx); + + Dwfl_Module *next = dwfl->modulelist; + while (next != NULL) + { + Dwfl_Module *dead = next; + next = dead->next; + __libdwfl_module_free (dead); + } + + free (dwfl); +} diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c new file mode 100644 index 00000000..414fbaf4 --- /dev/null +++ b/libdwfl/dwfl_error.c @@ -0,0 +1,258 @@ +/* Error handling in libdwfl. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <libintl.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <errno.h> + +#include "libdwflP.h" + + +#ifdef USE_TLS +/* The error number. */ +static __thread int global_error; +#else +/* This is the key for the thread specific memory. */ +static tls_key_t key; + +/* The error number. Used in non-threaded programs. */ +static int global_error; +static bool threaded; +/* We need to initialize the thread-specific data. */ +once_define (static, once); + +/* The initialization and destruction functions. */ +static void init (void); +static void free_key_mem (void *mem); +#endif /* TLS */ + + +int +dwfl_errno (void) +{ + int result; + +#ifndef USE_TLS + /* If we have not yet initialized the buffer do it now. */ + once_execute (once, init); + + if (threaded) + { + /* We do not allocate memory for the data. It is only a word. + We can store it in place of the pointer. */ + result = (intptr_t) getspecific (key); + + setspecific (key, (void *) (intptr_t) DWFL_E_NOERROR); + return result; + } +#endif /* TLS */ + + result = global_error; + global_error = DWFL_E_NOERROR; + return result; +} + + +static const struct msgtable +{ +#define DWFL_ERROR(name, text) char msg_##name[sizeof text]; + DWFL_ERRORS +#undef DWFL_ERROR +} msgtable = + { +#define DWFL_ERROR(name, text) text, + DWFL_ERRORS +#undef DWFL_ERROR + }; +#define msgstr (&msgtable.msg_NOERROR[0]) + +static const uint_fast16_t msgidx[] = +{ +#define DWFL_ERROR(name, text) \ + [DWFL_E_##name] = offsetof (struct msgtable, msg_##name), + DWFL_ERRORS +#undef DWFL_ERROR +}; +#define nmsgidx (sizeof msgidx / sizeof msgidx[0]) + + +static inline int +canonicalize (Dwfl_Error error) +{ + unsigned int value; + + switch (error) + { + default: + value = error; + if ((value &~ 0xffff) != 0) + break; + assert (value < nmsgidx); + break; + case DWFL_E_ERRNO: + value = DWFL_E (ERRNO, errno); + break; + case DWFL_E_LIBELF: + value = DWFL_E (LIBELF, elf_errno ()); + break; + case DWFL_E_LIBDW: + value = DWFL_E (LIBDW, INTUSE(dwarf_errno) ()); + break; +#if 0 + DWFL_E_LIBEBL: + value = DWFL_E (LIBEBL, ebl_errno ()); + break; +#endif + } + + return value; +} + +int +internal_function +__libdwfl_canon_error (Dwfl_Error error) +{ + return canonicalize (error); +} + +void +internal_function +__libdwfl_seterrno (Dwfl_Error error) +{ + int value = canonicalize (error); + +#ifndef USE_TLS + /* If we have not yet initialized the buffer do it now. */ + once_execute (once, init); + + if (threaded) + /* We do not allocate memory for the data. It is only a word. + We can store it in place of the pointer. */ + setspecific (key, (void *) (intptr_t) value); +#endif /* TLS */ + + global_error = value; +} + + +const char * +dwfl_errmsg (error) + int error; +{ + if (error == 0 || error == -1) + { + int last_error; + +#ifndef USE_TLS + /* If we have not yet initialized the buffer do it now. */ + once_execute (once, init); + + if (threaded) + /* We do not allocate memory for the data. It is only a word. + We can store it in place of the pointer. */ + last_error = (intptr_t) getspecific (key); + else +#endif /* TLS */ + last_error = global_error; + + if (error == 0 && last_error == 0) + return NULL; + + error = last_error; + global_error = DWFL_E_NOERROR; + } + + switch (error &~ 0xffff) + { + case OTHER_ERROR (ERRNO): + return strerror_r (error & 0xffff, "bad", 0); + case OTHER_ERROR (LIBELF): + return elf_errmsg (error & 0xffff); + case OTHER_ERROR (LIBDW): + return INTUSE(dwarf_errmsg) (error & 0xffff); +#if 0 + case OTHER_ERROR (LIBEBL): + return ebl_errmsg (error & 0xffff); +#endif + } + + return _(&msgstr[msgidx[(unsigned int) error < nmsgidx + ? error : DWFL_E_UNKNOWN_ERROR]]); +} +INTDEF (dwfl_errmsg) + + +#ifndef USE_TLS +/* Free the thread specific data, this is done if a thread terminates. */ +static void +free_key_mem (void *mem __attribute__ ((unused))) +{ + setspecific (key, NULL); +} + + +/* Initialize the key for the global variable. */ +static void +init (void) +{ + // XXX Screw you, gcc4, the unused function attribute does not work. + __asm ("" :: "r" (free_key_mem)); + + if (key_create (&key, free_key_mem) == 0) + /* Creating the key succeeded. */ + threaded = true; +} +#endif /* TLS */ diff --git a/libdwfl/dwfl_getdwarf.c b/libdwfl/dwfl_getdwarf.c new file mode 100644 index 00000000..0a0656f7 --- /dev/null +++ b/libdwfl/dwfl_getdwarf.c @@ -0,0 +1,80 @@ +/* Iterate through modules to fetch Dwarf information. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +struct module_callback_info +{ + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + Dwarf *, Dwarf_Addr, void *); + void *arg; +}; + +static int +module_callback (Dwfl_Module *mod, void **userdata, + const char *name, Dwarf_Addr start, void *arg) +{ + const struct module_callback_info *info = arg; + Dwarf_Addr bias = 0; + Dwarf *dw = INTUSE(dwfl_module_getdwarf) (mod, &bias); + return (*info->callback) (mod, userdata, name, start, dw, bias, info->arg); +} + +ptrdiff_t +dwfl_getdwarf (Dwfl *dwfl, + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + Dwarf *, Dwarf_Addr, void *), + void *arg, + ptrdiff_t offset) +{ + struct module_callback_info info = { callback, arg }; + return INTUSE(dwfl_getmodules) (dwfl, &module_callback, &info, offset); +} diff --git a/libdwfl/dwfl_getmodules.c b/libdwfl/dwfl_getmodules.c new file mode 100644 index 00000000..7c6ab971 --- /dev/null +++ b/libdwfl/dwfl_getmodules.c @@ -0,0 +1,113 @@ +/* Iterate through modules. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +ptrdiff_t +dwfl_getmodules (Dwfl *dwfl, + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, void *), + void *arg, + ptrdiff_t offset) +{ + if (dwfl == NULL) + return -1; + + /* We iterate through the linked list when it's all we have. + But continuing from an offset is slow that way. So when + DWFL->lookup_module is populated, we can instead keep our + place by jumping directly into the array. Since the actions + of a callback could cause it to get populated, we must + choose the style of place-holder when we return an offset, + and we encode the choice in the low bits of that value. */ + + Dwfl_Module *m = dwfl->modulelist; + + if ((offset & 3) == 1) + { + offset >>= 2; + for (ptrdiff_t pos = 0; pos < offset; ++pos) + if (m == NULL) + return -1; + else + m = m->next; + } + else if (((offset & 3) == 2) && likely (dwfl->lookup_module != NULL)) + { + offset >>= 2; + + if ((size_t) offset - 1 == dwfl->lookup_elts) + return 0; + + if (unlikely ((size_t) offset - 1 > dwfl->lookup_elts)) + return -1; + + m = dwfl->lookup_module[offset - 1]; + if (unlikely (m == NULL)) + return -1; + } + else if (offset != 0) + { + __libdwfl_seterrno (DWFL_E_BADSTROFF); + return -1; + } + + while (m != NULL) + { + int ok = (*callback) (MODCB_ARGS (m), arg); + ++offset; + m = m->next; + if (ok != DWARF_CB_OK) + return ((dwfl->lookup_module == NULL) ? ((offset << 2) | 1) + : (((m == NULL ? (ptrdiff_t) dwfl->lookup_elts + 1 + : m->segment + 1) << 2) | 2)); + } + return 0; +} +INTDEF (dwfl_getmodules) diff --git a/libdwfl/dwfl_getsrc.c b/libdwfl/dwfl_getsrc.c new file mode 100644 index 00000000..1cc16953 --- /dev/null +++ b/libdwfl/dwfl_getsrc.c @@ -0,0 +1,57 @@ +/* Find source location for PC address. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl_Line * +dwfl_getsrc (Dwfl *dwfl, Dwarf_Addr addr) +{ + return INTUSE(dwfl_module_getsrc) (INTUSE(dwfl_addrmodule) (dwfl, addr), + addr); +} diff --git a/libdwfl/dwfl_getsrclines.c b/libdwfl/dwfl_getsrclines.c new file mode 100644 index 00000000..790481fd --- /dev/null +++ b/libdwfl/dwfl_getsrclines.c @@ -0,0 +1,69 @@ +/* Fetch source line information for CU. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +int +dwfl_getsrclines (Dwarf_Die *cudie, size_t *nlines) +{ + struct dwfl_cu *cu = (struct dwfl_cu *) cudie; + + if (cu->lines == NULL) + { + Dwfl_Error error = __libdwfl_cu_getsrclines (cu); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return -1; + } + } + + *nlines = cu->die.cu->lines->nlines; + return -1; +} diff --git a/libdwfl/dwfl_line_comp_dir.c b/libdwfl/dwfl_line_comp_dir.c new file mode 100644 index 00000000..a755524d --- /dev/null +++ b/libdwfl/dwfl_line_comp_dir.c @@ -0,0 +1,64 @@ +/* Get information from a source line record returned by libdwfl. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <dwarf.h> + +const char * +dwfl_line_comp_dir (Dwfl_Line *line) +{ + if (line == NULL) + return NULL; + + struct dwfl_cu *cu = dwfl_linecu (line); + Dwarf_Attribute attr_mem; + return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr) (&cu->die, + DW_AT_comp_dir, + &attr_mem)); +} diff --git a/libdwfl/dwfl_linecu.c b/libdwfl/dwfl_linecu.c new file mode 100644 index 00000000..34f5bb10 --- /dev/null +++ b/libdwfl/dwfl_linecu.c @@ -0,0 +1,62 @@ +/* Fetch the module containing a source line record returned by libdwfl. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +#undef dwfl_linecu + +Dwarf_Die * +dwfl_linecu (Dwfl_Line *line) +{ + if (line == NULL) + return NULL; + + struct dwfl_cu *cu = dwfl_linecu_inline (line); + return &cu->die; +} diff --git a/libdwfl/dwfl_lineinfo.c b/libdwfl/dwfl_lineinfo.c new file mode 100644 index 00000000..0d8a6887 --- /dev/null +++ b/libdwfl/dwfl_lineinfo.c @@ -0,0 +1,76 @@ +/* Get information from a source line record returned by libdwfl. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include "../libdw/libdwP.h" + +const char * +dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp, + Dwarf_Word *mtime, Dwarf_Word *length) +{ + if (line == NULL) + return NULL; + + struct dwfl_cu *cu = dwfl_linecu (line); + const Dwarf_Line *info = &cu->die.cu->lines->info[line->idx]; + + if (addr != NULL) + *addr = info->addr + cu->mod->debug.bias; + if (linep != NULL) + *linep = info->line; + if (colp != NULL) + *colp = info->column; + + struct Dwarf_Fileinfo_s *file = &info->files->info[info->file]; + if (mtime != NULL) + *mtime = file->mtime; + if (length != NULL) + *length = file->length; + return file->name; +} diff --git a/libdwfl/dwfl_linemodule.c b/libdwfl/dwfl_linemodule.c new file mode 100644 index 00000000..fb98f837 --- /dev/null +++ b/libdwfl/dwfl_linemodule.c @@ -0,0 +1,59 @@ +/* Fetch the module containing a source line record returned by libdwfl. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl_Module * +dwfl_linemodule (Dwfl_Line *line) +{ + if (line == NULL) + return NULL; + + return dwfl_linecu (line)->mod; +} diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c new file mode 100644 index 00000000..d7e54138 --- /dev/null +++ b/libdwfl/dwfl_module.c @@ -0,0 +1,226 @@ +/* Maintenance of module list in libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <search.h> +#include <unistd.h> + +static void +free_cu (struct dwfl_cu *cu) +{ + if (cu->lines != NULL) + free (cu->lines); + free (cu); +} + +static void +nofree (void *arg __attribute__ ((unused))) +{ +} + +static void +free_file (struct dwfl_file *file) +{ + free (file->name); + + /* Close the fd only on the last reference. */ + if (file->elf != NULL && elf_end (file->elf) == 0 && file->fd != -1) + close (file->fd); +} + +void +internal_function +__libdwfl_module_free (Dwfl_Module *mod) +{ + if (mod->lazy_cu_root != NULL) + tdestroy (mod->lazy_cu_root, nofree); + + if (mod->aranges != NULL) + free (mod->aranges); + + if (mod->cu != NULL) + { + for (size_t i = 0; i < mod->ncu; ++i) + free_cu (mod->cu[i]); + free (mod->cu); + } + + if (mod->dw != NULL) + INTUSE(dwarf_end) (mod->dw); + + if (mod->ebl != NULL) + ebl_closebackend (mod->ebl); + + if (mod->debug.elf != mod->main.elf) + free_file (&mod->debug); + free_file (&mod->main); + + if (mod->build_id_bits != NULL) + free (mod->build_id_bits); + + free (mod->name); + free (mod); +} + +void +dwfl_report_begin_add (Dwfl *dwfl __attribute__ ((unused))) +{ + /* The lookup table will be cleared on demand, there is nothing we need + to do here. */ +} +INTDEF (dwfl_report_begin_add) + +void +dwfl_report_begin (Dwfl *dwfl) +{ + /* Clear the segment lookup table. */ + dwfl->lookup_elts = 0; + + for (Dwfl_Module *m = dwfl->modulelist; m != NULL; m = m->next) + m->gc = true; + + dwfl->offline_next_address = OFFLINE_REDZONE; +} +INTDEF (dwfl_report_begin) + +/* Report that a module called NAME spans addresses [START, END). + Returns the module handle, either existing or newly allocated, + or returns a null pointer for an allocation error. */ +Dwfl_Module * +dwfl_report_module (Dwfl *dwfl, const char *name, + GElf_Addr start, GElf_Addr end) +{ + Dwfl_Module **tailp = &dwfl->modulelist, **prevp = tailp; + + inline Dwfl_Module *use (Dwfl_Module *mod) + { + mod->next = *tailp; + *tailp = mod; + + if (unlikely (dwfl->lookup_module != NULL)) + { + free (dwfl->lookup_module); + dwfl->lookup_module = NULL; + } + + return mod; + } + + for (Dwfl_Module *m = *prevp; m != NULL; m = *(prevp = &m->next)) + { + if (m->low_addr == start && m->high_addr == end + && !strcmp (m->name, name)) + { + /* This module is still here. Move it to the place in the list + after the last module already reported. */ + *prevp = m->next; + m->gc = false; + return use (m); + } + + if (! m->gc) + tailp = &m->next; + } + + Dwfl_Module *mod = calloc (1, sizeof *mod); + if (mod == NULL) + goto nomem; + + mod->name = strdup (name); + if (mod->name == NULL) + { + free (mod); + nomem: + __libdwfl_seterrno (DWFL_E_NOMEM); + return NULL; + } + + mod->low_addr = start; + mod->high_addr = end; + mod->dwfl = dwfl; + + return use (mod); +} +INTDEF (dwfl_report_module) + + +/* Finish reporting the current set of modules to the library. + If REMOVED is not null, it's called for each module that + existed before but was not included in the current report. + Returns a nonzero return value from the callback. + DWFL cannot be used until this function has returned zero. */ +int +dwfl_report_end (Dwfl *dwfl, + int (*removed) (Dwfl_Module *, void *, + const char *, Dwarf_Addr, + void *arg), + void *arg) +{ + Dwfl_Module **tailp = &dwfl->modulelist; + while (*tailp != NULL) + { + Dwfl_Module *m = *tailp; + if (m->gc && removed != NULL) + { + int result = (*removed) (MODCB_ARGS (m), arg); + if (result != 0) + return result; + } + if (m->gc) + { + *tailp = m->next; + __libdwfl_module_free (m); + } + else + tailp = &m->next; + } + + return 0; +} +INTDEF (dwfl_report_end) diff --git a/libdwfl/dwfl_module_addrdie.c b/libdwfl/dwfl_module_addrdie.c new file mode 100644 index 00000000..2733196f --- /dev/null +++ b/libdwfl/dwfl_module_addrdie.c @@ -0,0 +1,66 @@ +/* Fetch the CU DIE for a PC address in a given module. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwarf_Die * +dwfl_module_addrdie (Dwfl_Module *mod, Dwarf_Addr addr, Dwarf_Addr *bias) +{ + if (INTUSE(dwfl_module_getdwarf) (mod, bias) == NULL) + return NULL; + + struct dwfl_cu *cu; + Dwfl_Error error = __libdwfl_addrcu (mod, addr, &cu); + if (likely (error == DWFL_E_NOERROR)) + return &cu->die; + + __libdwfl_seterrno (error); + return NULL; +} +INTDEF (dwfl_module_addrdie) diff --git a/libdwfl/dwfl_module_addrname.c b/libdwfl/dwfl_module_addrname.c new file mode 100644 index 00000000..7d365fe2 --- /dev/null +++ b/libdwfl/dwfl_module_addrname.c @@ -0,0 +1,57 @@ +/* Find debugging and symbol information for a module in libdwfl. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +const char * +dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr addr) +{ + GElf_Sym sym; + return INTUSE(dwfl_module_addrsym) (mod, addr, &sym, NULL); +} diff --git a/libdwfl/dwfl_module_addrsym.c b/libdwfl/dwfl_module_addrsym.c new file mode 100644 index 00000000..72280d11 --- /dev/null +++ b/libdwfl/dwfl_module_addrsym.c @@ -0,0 +1,183 @@ +/* Find debugging and symbol information for a module in libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +/* Returns the name of the symbol "closest" to ADDR. + Never returns symbols at addresses above ADDR. */ + +const char * +dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, + GElf_Sym *closest_sym, GElf_Word *shndxp) +{ + int syments = INTUSE(dwfl_module_getsymtab) (mod); + if (syments < 0) + return NULL; + + /* Return true iff we consider ADDR to lie in the same section as SYM. */ + GElf_Word addr_shndx = SHN_UNDEF; + inline bool same_section (const GElf_Sym *sym, GElf_Word shndx) + { + /* For absolute symbols and the like, only match exactly. */ + if (shndx >= SHN_LORESERVE) + return sym->st_value == addr; + + /* Figure out what section ADDR lies in. */ + if (addr_shndx == SHN_UNDEF) + { + GElf_Addr mod_addr = addr - mod->symfile->bias; + Elf_Scn *scn = NULL; + addr_shndx = SHN_ABS; + while ((scn = elf_nextscn (mod->symfile->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (likely (shdr != NULL) + && mod_addr >= shdr->sh_addr + && mod_addr < shdr->sh_addr + shdr->sh_size) + { + addr_shndx = elf_ndxscn (scn); + break; + } + } + } + + return shndx == addr_shndx; + } + + /* Keep track of the closest symbol we have seen so far. + Here we store only symbols with nonzero st_size. */ + const char *closest_name = NULL; + GElf_Word closest_shndx = SHN_UNDEF; + + /* Keep track of an eligible symbol with st_size == 0 as a fallback. */ + const char *sizeless_name = NULL; + GElf_Sym sizeless_sym = { 0, 0, 0, 0, 0, SHN_UNDEF }; + GElf_Word sizeless_shndx = SHN_UNDEF; + + /* Keep track of the lowest address a relevant sizeless symbol could have. */ + GElf_Addr min_label = 0; + + /* Look through the symbol table for a matching symbol. */ + for (int i = 1; i < syments; ++i) + { + GElf_Sym sym; + GElf_Word shndx; + const char *name = INTUSE(dwfl_module_getsym) (mod, i, &sym, &shndx); + if (name != NULL && name[0] != '\0' + && sym.st_shndx != SHN_UNDEF + && sym.st_value <= addr + && GELF_ST_TYPE (sym.st_info) != STT_SECTION + && GELF_ST_TYPE (sym.st_info) != STT_FILE + && GELF_ST_TYPE (sym.st_info) != STT_TLS) + { + /* Even if we don't choose this symbol, its existence excludes + any sizeless symbol (assembly label) that is below its upper + bound. */ + if (sym.st_value + sym.st_size > min_label) + min_label = sym.st_value + sym.st_size; + + if (sym.st_size == 0 || addr - sym.st_value < sym.st_size) + { + /* This symbol is a better candidate than the current one + if it's closer to ADDR or is global when it was local. */ + if (closest_name == NULL + || closest_sym->st_value < sym.st_value + || (GELF_ST_BIND (closest_sym->st_info) + < GELF_ST_BIND (sym.st_info))) + { + if (sym.st_size != 0) + { + *closest_sym = sym; + closest_shndx = shndx; + closest_name = name; + } + else if (same_section (&sym, shndx)) + { + /* Handwritten assembly symbols sometimes have no + st_size. If no symbol with proper size includes + the address, we'll use the closest one that is in + the same section as ADDR. */ + sizeless_sym = sym; + sizeless_shndx = shndx; + sizeless_name = name; + } + } + /* When the beginning of its range is no closer, + the end of its range might be. But do not + replace a global symbol with a local! */ + else if (sym.st_size != 0 + && closest_sym->st_value == sym.st_value + && closest_sym->st_size > sym.st_size + && (GELF_ST_BIND (closest_sym->st_info) + <= GELF_ST_BIND (sym.st_info))) + { + *closest_sym = sym; + closest_shndx = shndx; + closest_name = name; + } + } + } + } + + /* If we found no proper sized symbol to use, fall back to the best + candidate sizeless symbol we found, if any. */ + if (closest_name == NULL + && sizeless_name != NULL && sizeless_sym.st_value >= min_label) + { + *closest_sym = sizeless_sym; + closest_shndx = sizeless_shndx; + closest_name = sizeless_name; + } + + if (shndxp != NULL) + *shndxp = closest_shndx; + return closest_name; +} +INTDEF (dwfl_module_addrsym) diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c new file mode 100644 index 00000000..17d8f9f7 --- /dev/null +++ b/libdwfl/dwfl_module_build_id.c @@ -0,0 +1,194 @@ +/* Return build ID information for a module. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +static int +found_build_id (Dwfl_Module *mod, bool set, + const void *bits, int len, GElf_Addr vaddr) +{ + if (!set) + /* When checking bits, we do not compare VADDR because the + address found in a debuginfo file may not match the main + file as modified by prelink. */ + return 1 + (mod->build_id_len == len + && !memcmp (bits, mod->build_id_bits, len)); + + void *copy = malloc (len); + if (unlikely (copy == NULL)) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + + mod->build_id_bits = memcpy (copy, bits, len); + mod->build_id_vaddr = vaddr; + mod->build_id_len = len; + return len; +} + +#define NO_VADDR ((GElf_Addr) -1l) + +static int +check_notes (Dwfl_Module *mod, bool set, Elf_Data *data, GElf_Addr data_vaddr) +{ + size_t pos = 0; + GElf_Nhdr nhdr; + size_t name_pos; + size_t desc_pos; + while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos, &desc_pos)) > 0) + if (nhdr.n_type == NT_GNU_BUILD_ID + && nhdr.n_namesz == sizeof "GNU" && !memcmp (data->d_buf + name_pos, + "GNU", sizeof "GNU")) + return found_build_id (mod, set, + data->d_buf + desc_pos, nhdr.n_descsz, + data_vaddr == NO_VADDR ? 0 + : data_vaddr + desc_pos); + return 0; +} + +int +internal_function +__libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) +{ + int result = 0; + + Elf_Scn *scn = elf_nextscn (elf, NULL); + + if (scn == NULL) + { + /* No sections, have to look for phdrs. */ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (unlikely (ehdr == NULL)) + { + __libdwfl_seterrno (DWFL_E_LIBELF); + return -1; + } + for (uint_fast16_t i = 0; result == 0 && i < ehdr_mem.e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); + if (likely (phdr != NULL) && phdr->p_type == PT_NOTE) + result = check_notes (mod, set, + elf_getdata_rawchunk (elf, + phdr->p_offset, + phdr->p_filesz, + ELF_T_NHDR), + phdr->p_vaddr + mod->main.bias); + } + } + else + do + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE) + result = check_notes (mod, set, elf_getdata (scn, NULL), + (shdr->sh_flags & SHF_ALLOC) + ? shdr->sh_addr + mod->main.bias : NO_VADDR); + } + while (result == 0 && (scn = elf_nextscn (elf, scn)) != NULL); + + return result; +} + +/* ANDROID_CHANGE_BEGIN */ +#if 0 +int +__dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) +#else +dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) +#endif +/* ANDROID_CHANGE_END */ +{ + if (mod == NULL) + return -1; + + if (mod->build_id_len == 0 && mod->main.elf != NULL) + { + /* We have the file, but have not examined it yet. */ + int result = __libdwfl_find_build_id (mod, true, mod->main.elf); + if (result <= 0) + { + mod->build_id_len = -1; /* Cache negative result. */ + return result; + } + } + + if (mod->build_id_len <= 0) + return 0; + + *bits = mod->build_id_bits; + *vaddr = mod->build_id_vaddr; + return mod->build_id_len; +} + +/* ANDROID_CHANGE_BEGIN */ +#if 0 +extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id) + __attribute__ ((alias ("__dwfl_module_build_id"))); +asm (".symver " + "__dwfl_module_build_id, dwfl_module_build_id@@ELFUTILS_0.138"); + +int +_BUG_COMPAT_dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) +{ + int result = INTUSE(dwfl_module_build_id) (mod, bits, vaddr); + if (result > 0) + *vaddr += (result + 3) & -4; + return result; +} +asm (".symver " + "_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130"); +#endif +/* ANDROID_CHANGE_END */ diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c new file mode 100644 index 00000000..9206dbb4 --- /dev/null +++ b/libdwfl/dwfl_module_getdwarf.c @@ -0,0 +1,787 @@ +/* Find debugging and symbol information for a module in libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include "../libdw/libdwP.h" /* DWARF_E_* values are here. */ + +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ + +/* Open libelf FILE->fd and compute the load base of ELF as loaded in MOD. + When we return success, FILE->elf and FILE->bias are set up. */ +static inline Dwfl_Error +open_elf (Dwfl_Module *mod, struct dwfl_file *file) +{ + if (file->elf == NULL) + { + /* If there was a pre-primed file name left that the callback left + behind, try to open that file name. */ + if (file->fd < 0 && file->name != NULL) + file->fd = TEMP_FAILURE_RETRY (open64 (file->name, O_RDONLY)); + + if (file->fd < 0) + return CBFAIL; + + file->elf = elf_begin (file->fd, ELF_C_READ_MMAP_PRIVATE, NULL); + } + + if (unlikely (elf_kind (file->elf) != ELF_K_ELF)) + { + close (file->fd); + file->fd = -1; + return DWFL_E_BADELF; + } + + GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (file->elf, &ehdr_mem); + if (ehdr == NULL) + { + elf_error: + close (file->fd); + file->fd = -1; + return DWFL_E (LIBELF, elf_errno ()); + } + + /* The addresses in an ET_EXEC file are absolute. The lowest p_vaddr of + the main file can differ from that of the debug file due to prelink. + But that doesn't not change addresses that symbols, debuginfo, or + sh_addr of any program sections refer to. */ + file->bias = 0; + if (mod->e_type != ET_EXEC) + for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr ph_mem; + GElf_Phdr *ph = gelf_getphdr (file->elf, i, &ph_mem); + if (ph == NULL) + goto elf_error; + if (ph->p_type == PT_LOAD) + { + file->bias = ((mod->low_addr & -ph->p_align) + - (ph->p_vaddr & -ph->p_align)); + break; + } + } + + mod->e_type = ehdr->e_type; + + /* Relocatable Linux kernels are ET_EXEC but act like ET_DYN. */ + if (mod->e_type == ET_EXEC && file->bias != 0) + mod->e_type = ET_DYN; + + return DWFL_E_NOERROR; +} + +/* Find the main ELF file for this module and open libelf on it. + When we return success, MOD->main.elf and MOD->main.bias are set up. */ +static void +find_file (Dwfl_Module *mod) +{ + if (mod->main.elf != NULL /* Already done. */ + || mod->elferr != DWFL_E_NOERROR) /* Cached failure. */ + return; + + mod->main.fd = (*mod->dwfl->callbacks->find_elf) (MODCB_ARGS (mod), + &mod->main.name, + &mod->main.elf); + mod->elferr = open_elf (mod, &mod->main); + + if (mod->elferr == DWFL_E_NOERROR && !mod->main.valid) + { + /* Clear any explicitly reported build ID, just in case it was wrong. + We'll fetch it from the file when asked. */ + free (mod->build_id_bits); + mod->build_id_bits = NULL; + mod->build_id_len = 0; + } +} + +/* Search an ELF file for a ".gnu_debuglink" section. */ +static const char * +find_debuglink (Elf *elf, GElf_Word *crc) +{ + size_t shstrndx; + if (elf_getshstrndx (elf, &shstrndx) < 0) + return NULL; + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + return NULL; + + const char *name = elf_strptr (elf, shstrndx, shdr->sh_name); + if (name == NULL) + return NULL; + + if (!strcmp (name, ".gnu_debuglink")) + break; + } + + if (scn == NULL) + return NULL; + + /* Found the .gnu_debuglink section. Extract its contents. */ + Elf_Data *rawdata = elf_rawdata (scn, NULL); + if (rawdata == NULL) + return NULL; + + Elf_Data crcdata = + { + .d_type = ELF_T_WORD, + .d_buf = crc, + .d_size = sizeof *crc, + .d_version = EV_CURRENT, + }; + Elf_Data conv = + { + .d_type = ELF_T_WORD, + .d_buf = rawdata->d_buf + rawdata->d_size - sizeof *crc, + .d_size = sizeof *crc, + .d_version = EV_CURRENT, + }; + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + return NULL; + + Elf_Data *d = gelf_xlatetom (elf, &crcdata, &conv, ehdr->e_ident[EI_DATA]); + if (d == NULL) + return NULL; + assert (d == &crcdata); + + return rawdata->d_buf; +} + + +/* Find the separate debuginfo file for this module and open libelf on it. + When we return success, MOD->debug is set up. */ +static Dwfl_Error +find_debuginfo (Dwfl_Module *mod) +{ + if (mod->debug.elf != NULL) + return DWFL_E_NOERROR; + + GElf_Word debuglink_crc = 0; + const char *debuglink_file = find_debuglink (mod->main.elf, &debuglink_crc); + + mod->debug.fd = (*mod->dwfl->callbacks->find_debuginfo) (MODCB_ARGS (mod), + mod->main.name, + debuglink_file, + debuglink_crc, + &mod->debug.name); + return open_elf (mod, &mod->debug); +} + + +/* Try to find a symbol table in FILE. + Returns DWFL_E_NOERROR if a proper one is found. + Returns DWFL_E_NO_SYMTAB if not, but still sets results for SHT_DYNSYM. */ +static Dwfl_Error +load_symtab (struct dwfl_file *file, struct dwfl_file **symfile, + Elf_Scn **symscn, Elf_Scn **xndxscn, + size_t *syments, GElf_Word *strshndx) +{ + bool symtab = false; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (file->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem, *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL) + switch (shdr->sh_type) + { + case SHT_SYMTAB: + symtab = true; + *symscn = scn; + *symfile = file; + *strshndx = shdr->sh_link; + *syments = shdr->sh_size / shdr->sh_entsize; + if (*xndxscn != NULL) + return DWFL_E_NOERROR; + break; + + case SHT_DYNSYM: + if (symtab) + break; + /* Use this if need be, but keep looking for SHT_SYMTAB. */ + *symscn = scn; + *symfile = file; + *strshndx = shdr->sh_link; + *syments = shdr->sh_size / shdr->sh_entsize; + break; + + case SHT_SYMTAB_SHNDX: + *xndxscn = scn; + if (symtab) + return DWFL_E_NOERROR; + break; + + default: + break; + } + } + + if (symtab) + /* We found one, though no SHT_SYMTAB_SHNDX to go with it. */ + return DWFL_E_NOERROR; + + /* We found no SHT_SYMTAB, so any SHT_SYMTAB_SHNDX was bogus. + We might have found an SHT_DYNSYM and set *SYMSCN et al though. */ + *xndxscn = NULL; + return DWFL_E_NO_SYMTAB; +} + + +/* Translate addresses into file offsets. + OFFS[*] start out zero and remain zero if unresolved. */ +static void +find_offsets (Elf *elf, const GElf_Ehdr *ehdr, size_t n, + GElf_Addr addrs[n], GElf_Off offs[n]) +{ + size_t unsolved = n; + for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); + if (phdr != NULL && phdr->p_type == PT_LOAD && phdr->p_memsz > 0) + for (size_t j = 0; j < n; ++j) + if (offs[j] == 0 + && addrs[j] >= phdr->p_vaddr + && addrs[j] - phdr->p_vaddr < phdr->p_filesz) + { + offs[j] = addrs[j] - phdr->p_vaddr + phdr->p_offset; + if (--unsolved == 0) + break; + } + } +} + +/* Try to find a dynamic symbol table via phdrs. */ +static void +find_dynsym (Dwfl_Module *mod) +{ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (mod->main.elf, &ehdr_mem); + + for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (mod->main.elf, i, &phdr_mem); + if (phdr == NULL) + break; + + if (phdr->p_type == PT_DYNAMIC) + { + /* Examine the dynamic section for the pointers we need. */ + + Elf_Data *data = elf_getdata_rawchunk (mod->main.elf, + phdr->p_offset, phdr->p_filesz, + ELF_T_DYN); + if (data == NULL) + continue; + + enum + { + i_symtab, + i_strtab, + i_hash, + i_gnu_hash, + i_max + }; + GElf_Addr addrs[i_max] = { 0, }; + GElf_Xword strsz = 0; + size_t n = data->d_size / gelf_fsize (mod->main.elf, + ELF_T_DYN, 1, EV_CURRENT); + for (size_t j = 0; j < n; ++j) + { + GElf_Dyn dyn_mem; + GElf_Dyn *dyn = gelf_getdyn (data, j, &dyn_mem); + if (dyn != NULL) + switch (dyn->d_tag) + { + case DT_SYMTAB: + addrs[i_symtab] = dyn->d_un.d_ptr; + continue; + + case DT_HASH: + addrs[i_hash] = dyn->d_un.d_ptr; + continue; + + case DT_GNU_HASH: + addrs[i_gnu_hash] = dyn->d_un.d_ptr; + continue; + + case DT_STRTAB: + addrs[i_strtab] = dyn->d_un.d_ptr; + continue; + + case DT_STRSZ: + strsz = dyn->d_un.d_val; + continue; + + default: + continue; + + case DT_NULL: + break; + } + break; + } + + /* Translate pointers into file offsets. */ + GElf_Off offs[i_max] = { 0, }; + find_offsets (mod->main.elf, ehdr, i_max, addrs, offs); + + /* Figure out the size of the symbol table. */ + if (offs[i_hash] != 0) + { + /* In the original format, .hash says the size of .dynsym. */ + + size_t entsz = SH_ENTSIZE_HASH (ehdr); + data = elf_getdata_rawchunk (mod->main.elf, + offs[i_hash] + entsz, entsz, + entsz == 4 ? ELF_T_WORD + : ELF_T_XWORD); + if (data != NULL) + mod->syments = (entsz == 4 + ? *(const GElf_Word *) data->d_buf + : *(const GElf_Xword *) data->d_buf); + } + if (offs[i_gnu_hash] != 0 && mod->syments == 0) + { + /* In the new format, we can derive it with some work. */ + + const struct + { + Elf32_Word nbuckets; + Elf32_Word symndx; + Elf32_Word maskwords; + Elf32_Word shift2; + } *header; + + data = elf_getdata_rawchunk (mod->main.elf, offs[i_gnu_hash], + sizeof *header, ELF_T_WORD); + if (data != NULL) + { + header = data->d_buf; + Elf32_Word nbuckets = header->nbuckets; + Elf32_Word symndx = header->symndx; + GElf_Off buckets_at = (offs[i_gnu_hash] + sizeof *header + + (gelf_getclass (mod->main.elf) + * sizeof (Elf32_Word) + * header->maskwords)); + + data = elf_getdata_rawchunk (mod->main.elf, buckets_at, + nbuckets * sizeof (Elf32_Word), + ELF_T_WORD); + if (data != NULL && symndx < nbuckets) + { + const Elf32_Word *const buckets = data->d_buf; + Elf32_Word maxndx = symndx; + for (Elf32_Word bucket = 0; bucket < nbuckets; ++bucket) + if (buckets[bucket] > maxndx) + maxndx = buckets[bucket]; + + GElf_Off hasharr_at = (buckets_at + + nbuckets * sizeof (Elf32_Word)); + hasharr_at += (maxndx - symndx) * sizeof (Elf32_Word); + do + { + data = elf_getdata_rawchunk (mod->main.elf, + hasharr_at, + sizeof (Elf32_Word), + ELF_T_WORD); + if (data != NULL + && (*(const Elf32_Word *) data->d_buf & 1u)) + { + mod->syments = maxndx + 1; + break; + } + ++maxndx; + hasharr_at += sizeof (Elf32_Word); + } while (data != NULL); + } + } + } + if (offs[i_strtab] > offs[i_symtab] && mod->syments == 0) + mod->syments = ((offs[i_strtab] - offs[i_symtab]) + / gelf_fsize (mod->main.elf, + ELF_T_SYM, 1, EV_CURRENT)); + + if (mod->syments > 0) + { + mod->symdata = elf_getdata_rawchunk (mod->main.elf, + offs[i_symtab], + gelf_fsize (mod->main.elf, + ELF_T_SYM, + mod->syments, + EV_CURRENT), + ELF_T_SYM); + if (mod->symdata != NULL) + { + mod->symstrdata = elf_getdata_rawchunk (mod->main.elf, + offs[i_strtab], + strsz, + ELF_T_BYTE); + if (mod->symstrdata == NULL) + mod->symdata = NULL; + } + if (mod->symdata == NULL) + mod->symerr = DWFL_E (LIBELF, elf_errno ()); + else + { + mod->symfile = &mod->main; + mod->symerr = DWFL_E_NOERROR; + } + return; + } + } + } +} + +/* Try to find a symbol table in either MOD->main.elf or MOD->debug.elf. */ +static void +find_symtab (Dwfl_Module *mod) +{ + if (mod->symdata != NULL /* Already done. */ + || mod->symerr != DWFL_E_NOERROR) /* Cached previous failure. */ + return; + + find_file (mod); + mod->symerr = mod->elferr; + if (mod->symerr != DWFL_E_NOERROR) + return; + + /* First see if the main ELF file has the debugging information. */ + Elf_Scn *symscn = NULL, *xndxscn = NULL; + GElf_Word strshndx; + mod->symerr = load_symtab (&mod->main, &mod->symfile, &symscn, + &xndxscn, &mod->syments, &strshndx); + switch (mod->symerr) + { + default: + return; + + case DWFL_E_NOERROR: + break; + + case DWFL_E_NO_SYMTAB: + /* Now we have to look for a separate debuginfo file. */ + mod->symerr = find_debuginfo (mod); + switch (mod->symerr) + { + default: + return; + + case DWFL_E_NOERROR: + mod->symerr = load_symtab (&mod->debug, &mod->symfile, &symscn, + &xndxscn, &mod->syments, &strshndx); + break; + + case DWFL_E_CB: /* The find_debuginfo hook failed. */ + mod->symerr = DWFL_E_NO_SYMTAB; + break; + } + + switch (mod->symerr) + { + default: + return; + + case DWFL_E_NOERROR: + break; + + case DWFL_E_NO_SYMTAB: + if (symscn != NULL) + { + /* We still have the dynamic symbol table. */ + mod->symerr = DWFL_E_NOERROR; + break; + } + + /* Last ditch, look for dynamic symbols without section headers. */ + find_dynsym (mod); + return; + } + break; + } + + /* This does some sanity checks on the string table section. */ + if (elf_strptr (mod->symfile->elf, strshndx, 0) == NULL) + { + elferr: + mod->symerr = DWFL_E (LIBELF, elf_errno ()); + return; + } + + /* Cache the data; MOD->syments was set above. */ + + mod->symstrdata = elf_getdata (elf_getscn (mod->symfile->elf, strshndx), + NULL); + if (mod->symstrdata == NULL) + goto elferr; + + if (xndxscn == NULL) + mod->symxndxdata = NULL; + else + { + mod->symxndxdata = elf_getdata (xndxscn, NULL); + if (mod->symxndxdata == NULL) + goto elferr; + } + + mod->symdata = elf_getdata (symscn, NULL); + if (mod->symdata == NULL) + goto elferr; +} + + +/* Try to open a libebl backend for MOD. */ +Dwfl_Error +internal_function +__libdwfl_module_getebl (Dwfl_Module *mod) +{ + if (mod->ebl == NULL) + { + find_file (mod); + if (mod->elferr != DWFL_E_NOERROR) + return mod->elferr; + + mod->ebl = ebl_openbackend (mod->main.elf); + if (mod->ebl == NULL) + return DWFL_E_LIBEBL; + } + return DWFL_E_NOERROR; +} + +/* Try to start up libdw on DEBUGFILE. */ +static Dwfl_Error +load_dw (Dwfl_Module *mod, struct dwfl_file *debugfile) +{ + if (mod->e_type == ET_REL && !debugfile->relocated) + { + const Dwfl_Callbacks *const cb = mod->dwfl->callbacks; + + /* The debugging sections have to be relocated. */ + if (cb->section_address == NULL) + return DWFL_E_NOREL; + + Dwfl_Error error = __libdwfl_module_getebl (mod); + if (error != DWFL_E_NOERROR) + return error; + + find_symtab (mod); + Dwfl_Error result = mod->symerr; + if (result == DWFL_E_NOERROR) + result = __libdwfl_relocate (mod, debugfile->elf, true); + if (result != DWFL_E_NOERROR) + return result; + + /* Don't keep the file descriptors around. */ + if (mod->main.fd != -1 && elf_cntl (mod->main.elf, ELF_C_FDREAD) == 0) + { + close (mod->main.fd); + mod->main.fd = -1; + } + if (debugfile->fd != -1 && elf_cntl (debugfile->elf, ELF_C_FDREAD) == 0) + { + close (debugfile->fd); + debugfile->fd = -1; + } + } + + mod->dw = INTUSE(dwarf_begin_elf) (debugfile->elf, DWARF_C_READ, NULL); + if (mod->dw == NULL) + { + int err = INTUSE(dwarf_errno) (); + return err == DWARF_E_NO_DWARF ? DWFL_E_NO_DWARF : DWFL_E (LIBDW, err); + } + + /* Until we have iterated through all CU's, we might do lazy lookups. */ + mod->lazycu = 1; + + return DWFL_E_NOERROR; +} + +/* Try to start up libdw on either the main file or the debuginfo file. */ +static void +find_dw (Dwfl_Module *mod) +{ + if (mod->dw != NULL /* Already done. */ + || mod->dwerr != DWFL_E_NOERROR) /* Cached previous failure. */ + return; + + find_file (mod); + mod->dwerr = mod->elferr; + if (mod->dwerr != DWFL_E_NOERROR) + return; + + /* First see if the main ELF file has the debugging information. */ + mod->dwerr = load_dw (mod, &mod->main); + switch (mod->dwerr) + { + case DWFL_E_NOERROR: + mod->debug.elf = mod->main.elf; + mod->debug.bias = mod->main.bias; + return; + + case DWFL_E_NO_DWARF: + break; + + default: + goto canonicalize; + } + + /* Now we have to look for a separate debuginfo file. */ + mod->dwerr = find_debuginfo (mod); + switch (mod->dwerr) + { + case DWFL_E_NOERROR: + mod->dwerr = load_dw (mod, &mod->debug); + break; + + case DWFL_E_CB: /* The find_debuginfo hook failed. */ + mod->dwerr = DWFL_E_NO_DWARF; + return; + + default: + break; + } + + canonicalize: + mod->dwerr = __libdwfl_canon_error (mod->dwerr); +} + + +Elf * +dwfl_module_getelf (Dwfl_Module *mod, GElf_Addr *loadbase) +{ + if (mod == NULL) + return NULL; + + find_file (mod); + if (mod->elferr == DWFL_E_NOERROR) + { + if (mod->e_type == ET_REL && ! mod->main.relocated) + { + /* Before letting them get at the Elf handle, + apply all the relocations we know how to. */ + + mod->main.relocated = true; + if (likely (__libdwfl_module_getebl (mod) == DWFL_E_NOERROR)) + { + (void) __libdwfl_relocate (mod, mod->main.elf, false); + + if (mod->debug.elf == mod->main.elf) + mod->debug.relocated = true; + else if (mod->debug.elf != NULL && ! mod->debug.relocated) + { + mod->debug.relocated = true; + (void) __libdwfl_relocate (mod, mod->debug.elf, false); + } + } + } + + *loadbase = mod->main.bias; + return mod->main.elf; + } + + __libdwfl_seterrno (mod->elferr); + return NULL; +} +INTDEF (dwfl_module_getelf) + + +Dwarf * +dwfl_module_getdwarf (Dwfl_Module *mod, Dwarf_Addr *bias) +{ + if (mod == NULL) + return NULL; + + find_dw (mod); + if (mod->dwerr == DWFL_E_NOERROR) + { + /* If dwfl_module_getelf was used previously, then partial apply + relocation to miscellaneous sections in the debug file too. */ + if (mod->e_type == ET_REL + && mod->main.relocated && ! mod->debug.relocated) + { + mod->debug.relocated = true; + if (mod->debug.elf != mod->main.elf) + (void) __libdwfl_relocate (mod, mod->debug.elf, false); + } + + *bias = mod->debug.bias; + return mod->dw; + } + + __libdwfl_seterrno (mod->dwerr); + return NULL; +} +INTDEF (dwfl_module_getdwarf) + +int +dwfl_module_getsymtab (Dwfl_Module *mod) +{ + if (mod == NULL) + return -1; + + find_symtab (mod); + if (mod->symerr == DWFL_E_NOERROR) + return mod->syments; + + __libdwfl_seterrno (mod->symerr); + return -1; +} +INTDEF (dwfl_module_getsymtab) diff --git a/libdwfl/dwfl_module_getsrc.c b/libdwfl/dwfl_module_getsrc.c new file mode 100644 index 00000000..be03055e --- /dev/null +++ b/libdwfl/dwfl_module_getsrc.c @@ -0,0 +1,99 @@ +/* Find source location for PC address in module. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include "../libdw/libdwP.h" + +Dwfl_Line * +dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr) +{ + Dwarf_Addr bias; + if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL) + return NULL; + + struct dwfl_cu *cu; + Dwfl_Error error = __libdwfl_addrcu (mod, addr, &cu); + if (likely (error == DWFL_E_NOERROR)) + error = __libdwfl_cu_getsrclines (cu); + if (likely (error == DWFL_E_NOERROR)) + { + /* Now we look at the module-relative address. */ + addr -= bias; + + /* The lines are sorted by address, so we can use binary search. */ + size_t l = 0, u = cu->die.cu->lines->nlines; + while (l < u) + { + size_t idx = (l + u) / 2; + if (addr < cu->die.cu->lines->info[idx].addr) + u = idx; + else if (addr > cu->die.cu->lines->info[idx].addr) + l = idx + 1; + else + return &cu->lines->idx[idx]; + } + + if (cu->die.cu->lines->nlines > 0) + assert (cu->die.cu->lines->info + [cu->die.cu->lines->nlines - 1].end_sequence); + + /* If none were equal, the closest one below is what we want. + We never want the last one, because it's the end-sequence + marker with an address at the high bound of the CU's code. */ + if (u > 0 && u < cu->die.cu->lines->nlines + && addr > cu->die.cu->lines->info[u - 1].addr) + return &cu->lines->idx[u - 1]; + + error = DWFL_E_ADDR_OUTOFRANGE; + } + + __libdwfl_seterrno (error); + return NULL; +} +INTDEF (dwfl_module_getsrc) diff --git a/libdwfl/dwfl_module_getsrc_file.c b/libdwfl/dwfl_module_getsrc_file.c new file mode 100644 index 00000000..9d0c786b --- /dev/null +++ b/libdwfl/dwfl_module_getsrc_file.c @@ -0,0 +1,188 @@ +/* Find matching source locations in a module. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include "../libdw/libdwP.h" + + +int +dwfl_module_getsrc_file (Dwfl_Module *mod, + const char *fname, int lineno, int column, + Dwfl_Line ***srcsp, size_t *nsrcs) +{ + if (mod == NULL) + return -1; + + if (mod->dw == NULL) + { + Dwarf_Addr bias; + if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL) + return -1; + } + + bool is_basename = strchr (fname, '/') == NULL; + + size_t max_match = *nsrcs ?: ~0u; + size_t act_match = *nsrcs; + size_t cur_match = 0; + Dwfl_Line **match = *nsrcs == 0 ? NULL : *srcsp; + + struct dwfl_cu *cu = NULL; + Dwfl_Error error; + while ((error = __libdwfl_nextcu (mod, cu, &cu)) == DWFL_E_NOERROR + && cu != NULL + && (error = __libdwfl_cu_getsrclines (cu)) == DWFL_E_NOERROR) + { + inline const char *INTUSE(dwarf_line_file) (const Dwarf_Line *line) + { + return line->files->info[line->file].name; + } + inline Dwarf_Line *dwfl_line (const Dwfl_Line *line) + { + return &dwfl_linecu (line)->die.cu->lines->info[line->idx]; + } + inline const char *dwfl_line_file (const Dwfl_Line *line) + { + return INTUSE(dwarf_line_file) (dwfl_line (line)); + } + + /* Search through all the line number records for a matching + file and line/column number. If any of the numbers is zero, + no match is performed. */ + const char *lastfile = NULL; + bool lastmatch = false; + for (size_t cnt = 0; cnt < cu->die.cu->lines->nlines; ++cnt) + { + Dwarf_Line *line = &cu->die.cu->lines->info[cnt]; + + if (unlikely (line->file >= line->files->nfiles)) + { + __libdwfl_seterrno (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF)); + return -1; + } + else + { + const char *file = INTUSE(dwarf_line_file) (line); + if (file != lastfile) + { + /* Match the name with the name the user provided. */ + lastfile = file; + lastmatch = !strcmp (is_basename ? basename (file) : file, + fname); + } + } + if (!lastmatch) + continue; + + /* See whether line and possibly column match. */ + if (lineno != 0 + && (lineno > line->line + || (column != 0 && column > line->column))) + /* Cannot match. */ + continue; + + /* Determine whether this is the best match so far. */ + size_t inner; + for (inner = 0; inner < cur_match; ++inner) + if (dwfl_line_file (match[inner]) + == INTUSE(dwarf_line_file) (line)) + break; + if (inner < cur_match + && (dwfl_line (match[inner])->line != line->line + || dwfl_line (match[inner])->line != lineno + || (column != 0 + && (dwfl_line (match[inner])->column != line->column + || dwfl_line (match[inner])->column != column)))) + { + /* We know about this file already. If this is a better + match for the line number, use it. */ + if (dwfl_line (match[inner])->line >= line->line + && (dwfl_line (match[inner])->line != line->line + || dwfl_line (match[inner])->column >= line->column)) + /* Use the new line. Otherwise the old one. */ + match[inner] = &cu->lines->idx[cnt]; + continue; + } + + if (cur_match < max_match) + { + if (cur_match == act_match) + { + /* Enlarge the array for the results. */ + act_match += 10; + Dwfl_Line **newp = realloc (match, + act_match + * sizeof (Dwfl_Line *)); + if (newp == NULL) + { + free (match); + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + match = newp; + } + + match[cur_match++] = &cu->lines->idx[cnt]; + } + } + } + + if (cur_match > 0) + { + assert (*nsrcs == 0 || *srcsp == match); + + *nsrcs = cur_match; + *srcsp = match; + + return 0; + } + + __libdwfl_seterrno (DWFL_E_NO_MATCH); + return -1; +} diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c new file mode 100644 index 00000000..5f289ccb --- /dev/null +++ b/libdwfl/dwfl_module_getsym.c @@ -0,0 +1,114 @@ +/* Find debugging and symbol information for a module in libdwfl. + Copyright (C) 2006,2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +const char * +dwfl_module_getsym (Dwfl_Module *mod, int ndx, + GElf_Sym *sym, GElf_Word *shndxp) +{ + if (unlikely (mod == NULL)) + return NULL; + + if (unlikely (mod->symdata == NULL)) + { + int result = INTUSE(dwfl_module_getsymtab) (mod); + if (result < 0) + return NULL; + } + + GElf_Word shndx; + sym = gelf_getsymshndx (mod->symdata, mod->symxndxdata, ndx, sym, &shndx); + if (unlikely (sym == NULL)) + { + __libdwfl_seterrno (DWFL_E_LIBELF); + return NULL; + } + + if (sym->st_shndx != SHN_XINDEX) + shndx = sym->st_shndx; + + if (shndxp != NULL) + *shndxp = shndx; + + switch (shndx) + { + case SHN_ABS: + case SHN_UNDEF: + case SHN_COMMON: + break; + + default: + if (mod->e_type == ET_REL) + { + /* In an ET_REL file, the symbol table values are relative + to the section, not to the module's load base. */ + size_t symshstrndx = SHN_UNDEF; + Dwfl_Error result = __libdwfl_relocate_value (mod, mod->symfile->elf, + &symshstrndx, + shndx, &sym->st_value); + if (unlikely (result != DWFL_E_NOERROR)) + { + __libdwfl_seterrno (result); + return NULL; + } + } + /* Apply the bias to the symbol value. */ + sym->st_value += mod->symfile->bias; + break; + } + + if (unlikely (sym->st_name >= mod->symstrdata->d_size)) + { + __libdwfl_seterrno (DWFL_E_BADSTROFF); + return NULL; + } + return (const char *) mod->symstrdata->d_buf + sym->st_name; +} +INTDEF (dwfl_module_getsym) diff --git a/libdwfl/dwfl_module_info.c b/libdwfl/dwfl_module_info.c new file mode 100644 index 00000000..759cb621 --- /dev/null +++ b/libdwfl/dwfl_module_info.c @@ -0,0 +1,80 @@ +/* Return information about a module. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +const char * +dwfl_module_info (Dwfl_Module *mod, void ***userdata, + Dwarf_Addr *start, Dwarf_Addr *end, + Dwarf_Addr *dwbias, Dwarf_Addr *symbias, + const char **mainfile, const char **debugfile) +{ + if (mod == NULL) + return NULL; + + if (userdata) + *userdata = &mod->userdata; + if (start) + *start = mod->low_addr; + if (end) + *end = mod->high_addr; + + if (dwbias) + *dwbias = mod->debug.elf == NULL ? (Dwarf_Addr) -1 : mod->debug.bias; + if (symbias) + *symbias = mod->symfile == NULL ? (Dwarf_Addr) -1 : mod->symfile->bias; + + if (mainfile) + *mainfile = mod->main.name; + + if (debugfile) + *debugfile = mod->debug.name; + + return mod->name; +} diff --git a/libdwfl/dwfl_module_nextcu.c b/libdwfl/dwfl_module_nextcu.c new file mode 100644 index 00000000..1b37d299 --- /dev/null +++ b/libdwfl/dwfl_module_nextcu.c @@ -0,0 +1,65 @@ +/* Iterate through DWARF compilation units in a module. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwarf_Die * +dwfl_module_nextcu (Dwfl_Module *mod, Dwarf_Die *lastcu, Dwarf_Addr *bias) +{ + if (INTUSE(dwfl_module_getdwarf) (mod, bias) == NULL) + return NULL; + + struct dwfl_cu *cu; + Dwfl_Error error = __libdwfl_nextcu (mod, (struct dwfl_cu *) lastcu, &cu); + if (likely (error == DWFL_E_NOERROR)) + return &cu->die; /* Same as a cast, so ok for null too. */ + + __libdwfl_seterrno (error); + return NULL; +} diff --git a/libdwfl/dwfl_module_register_names.c b/libdwfl/dwfl_module_register_names.c new file mode 100644 index 00000000..79a874a8 --- /dev/null +++ b/libdwfl/dwfl_module_register_names.c @@ -0,0 +1,100 @@ +/* Enumerate DWARF register numbers and their names. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + + +int +dwfl_module_register_names (mod, func, arg) + Dwfl_Module *mod; + int (*func) (void *, int regno, const char *setname, + const char *prefix, const char *regname, + int bits, int type); + void *arg; +{ + if (unlikely (mod == NULL)) + return -1; + + if (unlikely (mod->ebl == NULL)) + { + Dwfl_Error error = __libdwfl_module_getebl (mod); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return -1; + } + } + + int nregs = ebl_register_info (mod->ebl, -1, NULL, 0, + NULL, NULL, NULL, NULL); + int result = 0; + for (int regno = 0; regno < nregs && likely (result == 0); ++regno) + { + char name[32]; + const char *setname = NULL; + const char *prefix = NULL; + int bits = -1; + int type = -1; + ssize_t len = ebl_register_info (mod->ebl, regno, name, sizeof name, + &prefix, &setname, &bits, &type); + if (unlikely (len < 0)) + { + __libdwfl_seterrno (DWFL_E_LIBEBL); + result = -1; + break; + } + if (likely (len > 0)) + { + assert (len > 1); /* Backend should never yield "". */ + result = (*func) (arg, regno, setname, prefix, name, bits, type); + } + } + + return result; +} diff --git a/libdwfl/dwfl_module_report_build_id.c b/libdwfl/dwfl_module_report_build_id.c new file mode 100644 index 00000000..9a1b14f7 --- /dev/null +++ b/libdwfl/dwfl_module_report_build_id.c @@ -0,0 +1,101 @@ +/* Report build ID information for a module. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +// XXX vs report changed module: punting old file +int +dwfl_module_report_build_id (Dwfl_Module *mod, + const unsigned char *bits, size_t len, + GElf_Addr vaddr) +{ + if (mod == NULL) + return -1; + + if (mod->main.elf != NULL) + { + /* Once we know about a file, we won't take any lies about + its contents. The only permissible call is a no-op. */ + + if ((size_t) mod->build_id_len == len + && (mod->build_id_vaddr == vaddr || vaddr == 0) + && !memcmp (bits, mod->build_id_bits, len)) + return 0; + + __libdwfl_seterrno (DWFL_E_ALREADY_ELF); + return -1; + } + + if (vaddr != 0 && (vaddr < mod->low_addr || vaddr + len > mod->high_addr)) + { + __libdwfl_seterrno (DWFL_E_ADDR_OUTOFRANGE); + return -1; + } + + void *copy = NULL; + if (len > 0) + { + copy = malloc (len); + if (unlikely (copy == NULL)) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + memcpy (copy, bits, len); + } + + free (mod->build_id_bits); + + mod->build_id_bits = copy; + mod->build_id_len = len; + mod->build_id_vaddr = vaddr; + + return 0; +} +INTDEF (dwfl_module_report_build_id) diff --git a/libdwfl/dwfl_module_return_value_location.c b/libdwfl/dwfl_module_return_value_location.c new file mode 100644 index 00000000..3d5154e2 --- /dev/null +++ b/libdwfl/dwfl_module_return_value_location.c @@ -0,0 +1,85 @@ +/* Return location expression to find return value given a function type DIE. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + + +int +dwfl_module_return_value_location (mod, functypedie, locops) + Dwfl_Module *mod; + Dwarf_Die *functypedie; + const Dwarf_Op **locops; +{ + if (mod == NULL) + return -1; + + if (mod->ebl == NULL) + { + Dwfl_Error error = __libdwfl_module_getebl (mod); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return -1; + } + } + + int nops = ebl_return_value_location (mod->ebl, functypedie, locops); + if (unlikely (nops < 0)) + { + if (nops == -1) + __libdwfl_seterrno (DWFL_E_LIBDW); + else if (nops == -2) + __libdwfl_seterrno (DWFL_E_WEIRD_TYPE); + else + __libdwfl_seterrno (DWFL_E_LIBEBL); + nops = -1; + } + + return nops; +} diff --git a/libdwfl/dwfl_nextcu.c b/libdwfl/dwfl_nextcu.c new file mode 100644 index 00000000..6db3e0f1 --- /dev/null +++ b/libdwfl/dwfl_nextcu.c @@ -0,0 +1,103 @@ +/* Iterate through DWARF compilation units across all modules. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwarf_Die * +dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias) +{ + if (dwfl == NULL) + return NULL; + + struct dwfl_cu *cu = (struct dwfl_cu *) lastcu; + Dwfl_Module *mod; + + if (cu == NULL) + { + mod = dwfl->modulelist; + goto nextmod; + } + else + mod = cu->mod; + + Dwfl_Error error; + do + { + error = __libdwfl_nextcu (mod, cu, &cu); + if (error != DWFL_E_NOERROR) + break; + + if (cu != NULL) + { + *bias = mod->debug.bias; + return &cu->die; + } + + do + { + mod = mod->next; + + nextmod: + if (mod == NULL) + return NULL; + + if (mod->dwerr == DWFL_E_NOERROR + && (mod->dw != NULL + || INTUSE(dwfl_module_getdwarf) (mod, bias) != NULL)) + break; + } + while (mod->dwerr == DWFL_E_NO_DWARF); + error = mod->dwerr; + } + while (error == DWFL_E_NOERROR); + + __libdwfl_seterrno (error); + return NULL; +} +INTDEF (dwfl_nextcu) diff --git a/libdwfl/dwfl_onesrcline.c b/libdwfl/dwfl_onesrcline.c new file mode 100644 index 00000000..558d2408 --- /dev/null +++ b/libdwfl/dwfl_onesrcline.c @@ -0,0 +1,77 @@ +/* Return one of the sources lines of a CU. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +Dwfl_Line * +dwfl_onesrcline (Dwarf_Die *cudie, size_t idx) +{ + struct dwfl_cu *cu = (struct dwfl_cu *) cudie; + + if (cudie == NULL) + return NULL; + + if (cu->lines == NULL) + { + Dwfl_Error error = __libdwfl_cu_getsrclines (cu); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return NULL; + } + } + + if (idx >= cu->die.cu->lines->nlines) + { + __libdwfl_seterrno (DWFL_E (LIBDW, DWARF_E_INVALID_LINE_IDX)); + return NULL; + } + + return &cu->lines->idx[idx]; +} diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c new file mode 100644 index 00000000..0e5d09bc --- /dev/null +++ b/libdwfl/dwfl_report_elf.c @@ -0,0 +1,289 @@ +/* Report a module to libdwfl based on ELF program headers. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <fcntl.h> +#include <unistd.h> + + +/* We start every ET_REL module at a moderately aligned boundary. + This keeps the low addresses easy to read compared to a layout + starting at 0 (as when using -e). It also makes it unlikely + that a middle section will have a larger alignment and require + rejiggering (see below). */ +#define REL_MIN_ALIGN ((GElf_Xword) 0x100) + +Dwfl_Module * +internal_function +__libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, + int fd, Elf *elf, GElf_Addr base) +{ + GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + elf_error: + __libdwfl_seterrno (DWFL_E_LIBELF); + return NULL; + } + + GElf_Addr start = 0, end = 0, bias = 0; + switch (ehdr->e_type) + { + case ET_REL: + /* For a relocatable object, we do an arbitrary section layout. + By updating the section header in place, we leave the layout + information to be found by relocation. */ + + start = end = base = (base + REL_MIN_ALIGN - 1) & -REL_MIN_ALIGN; + + bool first = true; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (unlikely (shdr == NULL)) + goto elf_error; + + if (shdr->sh_flags & SHF_ALLOC) + { + const GElf_Xword align = shdr->sh_addralign ?: 1; + const GElf_Addr next = (end + align - 1) & -align; + if (shdr->sh_addr == 0 + /* Once we've started doing layout we have to do it all, + unless we just layed out the first section at 0 when + it already was at 0. */ + || (bias == 0 && end > start && end != next)) + { + shdr->sh_addr = next; + if (end == base) + /* This is the first section assigned a location. + Use its aligned address as the module's base. */ + start = base = shdr->sh_addr; + else if (unlikely (base & (align - 1))) + { + /* If BASE has less than the maximum alignment of + any section, we eat more than the optimal amount + of padding and so make the module's apparent + size come out larger than it would when placed + at zero. So reset the layout with a better base. */ + + start = end = base = (base + align - 1) & -align; + Elf_Scn *prev_scn = NULL; + do + { + prev_scn = elf_nextscn (elf, prev_scn); + GElf_Shdr prev_shdr_mem; + GElf_Shdr *prev_shdr = gelf_getshdr (prev_scn, + &prev_shdr_mem); + if (unlikely (prev_shdr == NULL)) + goto elf_error; + if (prev_shdr->sh_flags & SHF_ALLOC) + { + const GElf_Xword prev_align + = prev_shdr->sh_addralign ?: 1; + + prev_shdr->sh_addr + = (end + prev_align - 1) & -prev_align; + end = prev_shdr->sh_addr + prev_shdr->sh_size; + + if (unlikely (! gelf_update_shdr (prev_scn, + prev_shdr))) + goto elf_error; + } + } + while (prev_scn != scn); + continue; + } + + end = shdr->sh_addr + shdr->sh_size; + if (likely (shdr->sh_addr != 0) + && unlikely (! gelf_update_shdr (scn, shdr))) + goto elf_error; + } + else + { + /* The address is already assigned. Just track it. */ + if (first || end < shdr->sh_addr + shdr->sh_size) + end = shdr->sh_addr + shdr->sh_size; + if (first || bias > shdr->sh_addr) + /* This is the lowest address in the module. */ + bias = shdr->sh_addr; + + if ((shdr->sh_addr - bias + base) & (align - 1)) + /* This section winds up misaligned using BASE. + Adjust BASE upwards to make it congruent to + the lowest section address in the file modulo ALIGN. */ + base = (((base + align - 1) & -align) + + (bias & (align - 1))); + } + + first = false; + } + } + + if (bias != 0) + { + /* The section headers had nonzero sh_addr values. The layout + was already done. We've just collected the total span. + Now just compute the bias from the requested base. */ + start = base; + end = end - bias + start; + bias = start - bias; + } + break; + + /* Everything else has to have program headers. */ + + case ET_EXEC: + case ET_CORE: + /* An assigned base address is meaningless for these. */ + base = 0; + + case ET_DYN: + default: + for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); + if (unlikely (ph == NULL)) + goto elf_error; + if (ph->p_type == PT_LOAD) + { + if ((base & (ph->p_align - 1)) != 0) + base = (base + ph->p_align - 1) & -ph->p_align; + start = base + (ph->p_vaddr & -ph->p_align); + break; + } + } + bias = base; + + for (uint_fast16_t i = ehdr->e_phnum; i-- > 0;) + { + GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); + if (unlikely (ph == NULL)) + goto elf_error; + if (ph->p_type == PT_LOAD) + { + end = base + (ph->p_vaddr + ph->p_memsz); + break; + } + } + + if (end == 0) + { + __libdwfl_seterrno (DWFL_E_NO_PHDR); + return NULL; + } + break; + } + + Dwfl_Module *m = INTUSE(dwfl_report_module) (dwfl, name, start, end); + if (m != NULL) + { + if (m->main.name == NULL) + { + m->main.name = strdup (file_name); + m->main.fd = fd; + } + else if ((fd >= 0 && m->main.fd != fd) + || strcmp (m->main.name, file_name)) + { + elf_end (elf); + overlap: + m->gc = true; + __libdwfl_seterrno (DWFL_E_OVERLAP); + m = NULL; + } + + /* Preinstall the open ELF handle for the module. */ + if (m->main.elf == NULL) + { + m->main.elf = elf; + m->main.bias = bias; + m->e_type = ehdr->e_type; + } + else + { + elf_end (elf); + if (m->main.bias != base) + goto overlap; + } + } + return m; +} + +Dwfl_Module * +dwfl_report_elf (Dwfl *dwfl, const char *name, + const char *file_name, int fd, GElf_Addr base) +{ + bool closefd = false; + if (fd < 0) + { + closefd = true; + fd = open64 (file_name, O_RDONLY); + if (fd < 0) + { + __libdwfl_seterrno (DWFL_E_ERRNO); + return NULL; + } + } + + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, + fd, elf, base); + if (mod == NULL) + { + elf_end (elf); + if (closefd) + close (fd); + } + + return mod; +} +INTDEF (dwfl_report_elf) diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c new file mode 100644 index 00000000..50ed140e --- /dev/null +++ b/libdwfl/dwfl_segment_report_module.c @@ -0,0 +1,646 @@ +/* Sniff out modules from ELF headers visible in memory segments. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include "../libelf/libelfP.h" /* For NOTE_ALIGN. */ +#undef _ +#include "libdwflP.h" + +#include <elf.h> +#include <gelf.h> +#include <inttypes.h> +#include <sys/param.h> +#include <alloca.h> +#include <endian.h> + + +/* A good size for the initial read from memory, if it's not too costly. + This more than covers the phdrs and note segment in the average 64-bit + binary. */ + +#define INITIAL_READ 1024 + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define MY_ELFDATA ELFDATA2LSB +#else +# define MY_ELFDATA ELFDATA2MSB +#endif + + +/* Return user segment index closest to ADDR but not above it. */ +static int +addr_segndx (Dwfl *dwfl, size_t segment, GElf_Addr addr) +{ + int ndx = dwfl->lookup_segndx[segment]; + do + { + if (dwfl->lookup_segndx[segment] >= 0) + ndx = dwfl->lookup_segndx[segment]; + ++segment; + } + while (segment < dwfl->lookup_elts - 1 + && dwfl->lookup_addr[segment] < addr); + + while (dwfl->lookup_segndx[segment] < 0 + && segment < dwfl->lookup_elts - 1) + ++segment; + + if (dwfl->lookup_segndx[segment] >= 0) + ndx = dwfl->lookup_segndx[segment]; + + return ndx; +} + +int +dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg, + Dwfl_Module_Callback *read_eagerly, + void *read_eagerly_arg) +{ + size_t segment = ndx; + + if (segment >= dwfl->lookup_elts) + segment = dwfl->lookup_elts - 1; + + while (segment > 0 && dwfl->lookup_segndx[segment] > ndx) + --segment; + + while (dwfl->lookup_segndx[segment] < ndx) + if (++segment == dwfl->lookup_elts) + return 0; + + GElf_Addr start = dwfl->lookup_addr[segment]; + + inline bool segment_read (int segndx, + void **buffer, size_t *buffer_available, + GElf_Addr addr, size_t minread) + { + return ! (*memory_callback) (dwfl, segndx, buffer, buffer_available, + addr, minread, memory_callback_arg); + } + + inline void release_buffer (void **buffer, size_t *buffer_available) + { + if (*buffer != NULL) + (void) segment_read (-1, buffer, buffer_available, 0, 0); + } + + /* First read in the file header and check its sanity. */ + + void *buffer = NULL; + size_t buffer_available = INITIAL_READ; + + inline int finish (void) + { + release_buffer (&buffer, &buffer_available); + return ndx; + } + + if (segment_read (ndx, &buffer, &buffer_available, + start, sizeof (Elf64_Ehdr)) + || memcmp (buffer, ELFMAG, SELFMAG) != 0) + return finish (); + + inline bool read_portion (void **data, size_t *data_size, + GElf_Addr vaddr, size_t filesz) + { + if (vaddr - start + filesz > buffer_available) + { + *data = NULL; + *data_size = filesz; + return segment_read (addr_segndx (dwfl, segment, vaddr), + data, data_size, vaddr, filesz); + } + + /* We already have this whole note segment from our initial read. */ + *data = vaddr - start + buffer; + *data_size = 0; + return false; + } + + inline void finish_portion (void **data, size_t *data_size) + { + if (*data_size != 0) + release_buffer (data, data_size); + } + + /* Extract the information we need from the file header. */ + union + { + Elf32_Ehdr e32; + Elf64_Ehdr e64; + } ehdr; + GElf_Off phoff; + uint_fast16_t phnum; + uint_fast16_t phentsize; + GElf_Off shdrs_end; + Elf_Data xlatefrom = + { + .d_type = ELF_T_EHDR, + .d_buf = (void *) buffer, + .d_version = EV_CURRENT, + }; + Elf_Data xlateto = + { + .d_type = ELF_T_EHDR, + .d_buf = &ehdr, + .d_size = sizeof ehdr, + .d_version = EV_CURRENT, + }; + switch (((const unsigned char *) buffer)[EI_CLASS]) + { + case ELFCLASS32: + xlatefrom.d_size = sizeof (Elf32_Ehdr); + if (elf32_xlatetom (&xlateto, &xlatefrom, + ((const unsigned char *) buffer)[EI_DATA]) == NULL) + return finish (); + phoff = ehdr.e32.e_phoff; + phnum = ehdr.e32.e_phnum; + phentsize = ehdr.e32.e_phentsize; + if (phentsize != sizeof (Elf32_Phdr)) + return finish (); + shdrs_end = ehdr.e32.e_shoff + ehdr.e32.e_shnum * ehdr.e32.e_shentsize; + break; + + case ELFCLASS64: + xlatefrom.d_size = sizeof (Elf64_Ehdr); + if (elf64_xlatetom (&xlateto, &xlatefrom, + ((const unsigned char *) buffer)[EI_DATA]) == NULL) + return finish (); + phoff = ehdr.e64.e_phoff; + phnum = ehdr.e64.e_phnum; + phentsize = ehdr.e64.e_phentsize; + if (phentsize != sizeof (Elf64_Phdr)) + return finish (); + shdrs_end = ehdr.e64.e_shoff + ehdr.e64.e_shnum * ehdr.e64.e_shentsize; + break; + + default: + return finish (); + } + + /* The file header tells where to find the program headers. + These are what we need to find the boundaries of the module. + Without them, we don't have a module to report. */ + + if (phnum == 0) + return finish (); + + xlatefrom.d_type = xlateto.d_type = ELF_T_PHDR; + xlatefrom.d_size = phnum * phentsize; + + void *ph_buffer = NULL; + size_t ph_buffer_size = 0; + if (read_portion (&ph_buffer, &ph_buffer_size, + start + phoff, xlatefrom.d_size)) + return finish (); + + xlatefrom.d_buf = ph_buffer; + + union + { + Elf32_Phdr p32[phnum]; + Elf64_Phdr p64[phnum]; + } phdrs; + + xlateto.d_buf = &phdrs; + xlateto.d_size = sizeof phdrs; + + /* Track the bounds of the file visible in memory. */ + GElf_Off file_trimmed_end = 0; /* Proper p_vaddr + p_filesz end. */ + GElf_Off file_end = 0; /* Rounded up to effective page size. */ + GElf_Off contiguous = 0; /* Visible as contiguous file from START. */ + GElf_Off total_filesz = 0; /* Total size of data to read. */ + + /* Collect the bias between START and the containing PT_LOAD's p_vaddr. */ + GElf_Addr bias = 0; + bool found_bias = false; + + /* Collect the unbiased bounds of the module here. */ + GElf_Addr module_start = -1l; + GElf_Addr module_end = 0; + + /* If we see PT_DYNAMIC, record it here. */ + GElf_Addr dyn_vaddr = 0; + GElf_Xword dyn_filesz = 0; + + /* Collect the build ID bits here. */ + void *build_id = NULL; + size_t build_id_len = 0; + GElf_Addr build_id_vaddr = 0; + + /* Consider a PT_NOTE we've found in the image. */ + inline void consider_notes (GElf_Addr vaddr, GElf_Xword filesz) + { + /* If we have already seen a build ID, we don't care any more. */ + if (build_id != NULL || filesz == 0) + return; + + void *data; + size_t data_size; + if (read_portion (&data, &data_size, vaddr, filesz)) + return; + + assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr)); + + void *notes; + if (ehdr.e32.e_ident[EI_DATA] == MY_ELFDATA) + notes = data; + else + { + notes = malloc (filesz); + if (unlikely (notes == NULL)) + return; + xlatefrom.d_type = xlateto.d_type = ELF_T_NHDR; + xlatefrom.d_buf = (void *) data; + xlatefrom.d_size = filesz; + xlateto.d_buf = notes; + xlateto.d_size = filesz; + if (elf32_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + goto done; + } + + const GElf_Nhdr *nh = notes; + while ((const void *) nh < (const void *) notes + filesz) + { + const void *note_name = nh + 1; + const void *note_desc = note_name + NOTE_ALIGN (nh->n_namesz); + if (unlikely ((size_t) ((const void *) notes + filesz + - note_desc) < nh->n_descsz)) + break; + + if (nh->n_type == NT_GNU_BUILD_ID + && nh->n_descsz > 0 + && nh->n_namesz == sizeof "GNU" + && !memcmp (note_name, "GNU", sizeof "GNU")) + { + build_id_vaddr = note_desc - (const void *) notes + vaddr; + build_id_len = nh->n_descsz; + build_id = malloc (nh->n_descsz); + if (likely (build_id != NULL)) + memcpy (build_id, note_desc, build_id_len); + break; + } + + nh = note_desc + NOTE_ALIGN (nh->n_descsz); + } + + done: + if (notes != data) + free (notes); + finish_portion (&data, &data_size); + } + + /* Consider each of the program headers we've read from the image. */ + inline void consider_phdr (GElf_Word type, + GElf_Addr vaddr, GElf_Xword memsz, + GElf_Off offset, GElf_Xword filesz, + GElf_Xword align) + { + switch (type) + { + case PT_DYNAMIC: + dyn_vaddr = vaddr; + dyn_filesz = filesz; + break; + + case PT_NOTE: + /* We calculate from the p_offset of the note segment, + because we don't yet know the bias for its p_vaddr. */ + consider_notes (start + offset, filesz); + break; + + case PT_LOAD: + align = dwfl->segment_align > 1 ? dwfl->segment_align : align ?: 1; + + GElf_Addr vaddr_end = (vaddr + memsz + align - 1) & -align; + GElf_Addr filesz_vaddr = filesz < memsz ? vaddr + filesz : vaddr_end; + GElf_Off filesz_offset = filesz_vaddr - vaddr + offset; + + if (file_trimmed_end < offset + filesz) + { + file_trimmed_end = offset + filesz; + + /* Trim the last segment so we don't bother with zeros + in the last page that are off the end of the file. + However, if the extra bit in that page includes the + section headers, keep them. */ + if (shdrs_end <= filesz_offset && shdrs_end > file_trimmed_end) + { + filesz += shdrs_end - file_trimmed_end; + file_trimmed_end = shdrs_end; + } + } + + total_filesz += filesz; + + if (file_end < filesz_offset) + { + file_end = filesz_offset; + if (filesz_vaddr - start == filesz_offset) + contiguous = file_end; + } + + if (!found_bias && (offset & -align) == 0 + && likely (filesz_offset >= phoff + phnum * phentsize)) + { + bias = start - vaddr; + found_bias = true; + } + + vaddr &= -align; + if (vaddr < module_start) + module_start = vaddr; + + if (module_end < vaddr_end) + module_end = vaddr_end; + break; + } + } + if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32) + { + if (elf32_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + found_bias = false; /* Trigger error check. */ + else + for (uint_fast16_t i = 0; i < phnum; ++i) + consider_phdr (phdrs.p32[i].p_type, + phdrs.p32[i].p_vaddr, phdrs.p32[i].p_memsz, + phdrs.p32[i].p_offset, phdrs.p32[i].p_filesz, + phdrs.p32[i].p_align); + } + else + { + if (elf64_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + found_bias = false; /* Trigger error check. */ + else + for (uint_fast16_t i = 0; i < phnum; ++i) + consider_phdr (phdrs.p64[i].p_type, + phdrs.p64[i].p_vaddr, phdrs.p64[i].p_memsz, + phdrs.p64[i].p_offset, phdrs.p64[i].p_filesz, + phdrs.p64[i].p_align); + } + + finish_portion (&ph_buffer, &ph_buffer_size); + + /* We must have seen the segment covering offset 0, or else the ELF + header we read at START was not produced by these program headers. */ + if (unlikely (!found_bias)) + return finish (); + + /* Now we know enough to report a module for sure: its bounds. */ + module_start += bias; + module_end += bias; + + dyn_vaddr += bias; + + /* Our return value now says to skip the segments contained + within the module. + XXX handle gaps + */ + ndx = addr_segndx (dwfl, segment, module_end); + + /* Examine its .dynamic section to get more interesting details. + If it has DT_SONAME, we'll use that as the module name. + We need its DT_STRTAB and DT_STRSZ to decipher DT_SONAME, + and they also tell us the essential portion of the file + for fetching symbols. */ + GElf_Addr soname_stroff = 0; + GElf_Addr dynstr_vaddr = 0; + GElf_Xword dynstrsz = 0; + inline bool consider_dyn (GElf_Sxword tag, GElf_Xword val) + { + switch (tag) + { + default: + return false; + + case DT_SONAME: + soname_stroff = val; + break; + + case DT_STRTAB: + dynstr_vaddr = val; + break; + + case DT_STRSZ: + dynstrsz = val; + break; + } + + return soname_stroff != 0 && dynstr_vaddr != 0 && dynstrsz != 0; + } + + const size_t dyn_entsize = (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32 + ? sizeof (Elf32_Dyn) : sizeof (Elf64_Dyn)); + void *dyn_data = NULL; + size_t dyn_data_size = 0; + if (dyn_filesz != 0 && dyn_filesz % dyn_entsize == 0 + && ! read_portion (&dyn_data, &dyn_data_size, dyn_vaddr, dyn_filesz)) + { + union + { + Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)]; + Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)]; + } dyn; + + xlatefrom.d_type = xlateto.d_type = ELF_T_DYN; + xlatefrom.d_buf = (void *) dyn_data; + xlatefrom.d_size = dyn_filesz; + xlateto.d_buf = &dyn; + xlateto.d_size = sizeof dyn; + + if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32) + { + if (elf32_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) != NULL) + for (size_t i = 0; i < dyn_filesz / sizeof dyn.d32[0]; ++i) + if (consider_dyn (dyn.d32[i].d_tag, dyn.d32[i].d_un.d_val)) + break; + } + else + { + if (elf64_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) != NULL) + for (size_t i = 0; i < dyn_filesz / sizeof dyn.d64[0]; ++i) + if (consider_dyn (dyn.d64[i].d_tag, dyn.d64[i].d_un.d_val)) + break; + } + } + finish_portion (&dyn_data, &dyn_data_size); + + /* We'll use the name passed in or a stupid default if not DT_SONAME. */ + if (name == NULL) + name = ehdr.e32.e_type == ET_EXEC ? "[exe]" : "[dso]"; + + void *soname = NULL; + size_t soname_size = 0; + if (dynstrsz != 0 && dynstr_vaddr != 0) + { + /* We know the bounds of the .dynstr section. */ + dynstr_vaddr += bias; + if (unlikely (dynstr_vaddr + dynstrsz > module_end)) + dynstrsz = 0; + + /* Try to get the DT_SONAME string. */ + if (soname_stroff != 0 && soname_stroff < dynstrsz - 1 + && ! read_portion (&soname, &soname_size, + dynstr_vaddr + soname_stroff, 0)) + name = soname; + } + + /* Now that we have chosen the module's name and bounds, report it. + If we found a build ID, report that too. */ + + Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, name, + module_start, module_end); + if (likely (mod != NULL) && build_id != NULL + && unlikely (INTUSE(dwfl_module_report_build_id) (mod, + build_id, + build_id_len, + build_id_vaddr))) + { + mod->gc = true; + mod = NULL; + } + + /* At this point we do not need BUILD_ID or NAME any more. + They have been copied. */ + free (build_id); + finish_portion (&soname, &soname_size); + + if (unlikely (mod == NULL)) + { + ndx = -1; + return finish (); + } + + /* We have reported the module. Now let the caller decide whether we + should read the whole thing in right now. */ + + const GElf_Off cost = (contiguous < file_trimmed_end ? total_filesz + : buffer_available >= contiguous ? 0 + : contiguous - buffer_available); + const GElf_Off worthwhile = ((dynstr_vaddr == 0 || dynstrsz == 0) ? 0 + : dynstr_vaddr + dynstrsz - start); + const GElf_Off whole = MAX (file_trimmed_end, shdrs_end); + + Elf *elf = NULL; + if ((*read_eagerly) (MODCB_ARGS (mod), &buffer, &buffer_available, + cost, worthwhile, whole, contiguous, + read_eagerly_arg, &elf) + && elf == NULL) + { + /* The caller wants to read the whole file in right now, but hasn't + done it for us. Fill in a local image of the virtual file. */ + + void *contents = calloc (1, file_trimmed_end); + if (unlikely (contents == NULL)) + return finish (); + + inline void final_read (size_t offset, GElf_Addr vaddr, size_t size) + { + void *into = contents + offset; + size_t read_size = size; + (void) segment_read (addr_segndx (dwfl, segment, vaddr), + &into, &read_size, vaddr, size); + } + + if (contiguous < file_trimmed_end) + { + /* We can't use the memory image verbatim as the file image. + So we'll be reading into a local image of the virtual file. */ + + inline void read_phdr (GElf_Word type, GElf_Addr vaddr, + GElf_Off offset, GElf_Xword filesz) + { + if (type == PT_LOAD) + final_read (offset, vaddr + bias, filesz); + } + + if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32) + for (uint_fast16_t i = 0; i < phnum; ++i) + read_phdr (phdrs.p32[i].p_type, phdrs.p32[i].p_vaddr, + phdrs.p32[i].p_offset, phdrs.p32[i].p_filesz); + else + for (uint_fast16_t i = 0; i < phnum; ++i) + read_phdr (phdrs.p64[i].p_type, phdrs.p64[i].p_vaddr, + phdrs.p64[i].p_offset, phdrs.p64[i].p_filesz); + } + else + { + /* The whole file sits contiguous in memory, + but the caller didn't want to just do it. */ + + const size_t have = MIN (buffer_available, file_trimmed_end); + memcpy (contents, buffer, have); + + if (have < file_trimmed_end) + final_read (have, start + have, file_trimmed_end - have); + } + + elf = elf_memory (contents, file_trimmed_end); + if (unlikely (elf == NULL)) + free (contents); + else + elf->flags |= ELF_F_MALLOCED; + } + + if (elf != NULL) + { + /* Install the file in the module. */ + mod->main.elf = elf; + mod->main.bias = bias; + } + + return finish (); +} diff --git a/libdwfl/dwfl_validate_address.c b/libdwfl/dwfl_validate_address.c new file mode 100644 index 00000000..81073762 --- /dev/null +++ b/libdwfl/dwfl_validate_address.c @@ -0,0 +1,82 @@ +/* Validate an address and the relocatability of an offset from it. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +int +dwfl_validate_address (Dwfl *dwfl, Dwarf_Addr address, Dwarf_Sword offset) +{ + Dwfl_Module *mod = INTUSE(dwfl_addrmodule) (dwfl, address); + if (mod == NULL) + return -1; + + Dwarf_Addr relative = address; + int idx = INTUSE(dwfl_module_relocate_address) (mod, &relative); + if (idx < 0) + return -1; + + if (offset != 0) + { + int offset_idx = -1; + relative = address + offset; + if (relative >= mod->low_addr && relative <= mod->high_addr) + { + offset_idx = INTUSE(dwfl_module_relocate_address) (mod, &relative); + if (offset_idx < 0) + return -1; + } + if (offset_idx != idx) + { + __libdwfl_seterrno (DWFL_E_ADDR_OUTOFRANGE); + return -1; + } + } + + return 0; +} diff --git a/libdwfl/dwfl_version.c b/libdwfl/dwfl_version.c new file mode 100644 index 00000000..9c7074c5 --- /dev/null +++ b/libdwfl/dwfl_version.c @@ -0,0 +1,57 @@ +/* Return implementation's version string suitable for printing. + Copyright (C) 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +const char * +dwfl_version (dwfl) + Dwfl *dwfl __attribute__ ((unused)); +{ + return PACKAGE_VERSION; +} diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c new file mode 100644 index 00000000..c0e7c46d --- /dev/null +++ b/libdwfl/elf-from-memory.c @@ -0,0 +1,368 @@ +/* Reconstruct an ELF file by reading the segments out of remote memory. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include "../libelf/libelfP.h" +#undef _ + +#include "libdwflP.h" + +#include <gelf.h> +#include <sys/types.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +/* Reconstruct an ELF file by reading the segments out of remote memory + based on the ELF file header at EHDR_VMA and the ELF program headers it + points to. If not null, *LOADBASEP is filled in with the difference + between the addresses from which the segments were read, and the + addresses the file headers put them at. + + The function READ_MEMORY is called to copy at least MINREAD and at most + MAXREAD bytes from the remote memory at target address ADDRESS into the + local buffer at DATA; it should return -1 for errors (with code in + `errno'), 0 if it failed to read at least MINREAD bytes due to EOF, or + the number of bytes read if >= MINREAD. ARG is passed through. */ + +Elf * +elf_from_remote_memory (GElf_Addr ehdr_vma, + GElf_Addr *loadbasep, + ssize_t (*read_memory) (void *arg, void *data, + GElf_Addr address, + size_t minread, + size_t maxread), + void *arg) +{ + /* First read in the file header and check its sanity. */ + + const size_t initial_bufsize = 256; + unsigned char *buffer = malloc (initial_bufsize); + if (buffer == NULL) + { + no_memory: + __libdwfl_seterrno (DWFL_E_NOMEM); + return NULL; + } + + ssize_t nread = (*read_memory) (arg, buffer, ehdr_vma, + sizeof (Elf32_Ehdr), initial_bufsize); + if (nread <= 0) + { + read_error: + free (buffer); + __libdwfl_seterrno (nread < 0 ? DWFL_E_ERRNO : DWFL_E_TRUNCATED); + return NULL; + } + + if (memcmp (buffer, ELFMAG, SELFMAG) != 0) + { + bad_elf: + __libdwfl_seterrno (DWFL_E_BADELF); + return NULL; + } + + /* Extract the information we need from the file header. */ + + union + { + Elf32_Ehdr e32; + Elf64_Ehdr e64; + } ehdr; + Elf_Data xlatefrom = + { + .d_type = ELF_T_EHDR, + .d_buf = buffer, + .d_version = EV_CURRENT, + }; + Elf_Data xlateto = + { + .d_type = ELF_T_EHDR, + .d_buf = &ehdr, + .d_size = sizeof ehdr, + .d_version = EV_CURRENT, + }; + + GElf_Off phoff; + uint_fast16_t phnum; + uint_fast16_t phentsize; + GElf_Off shdrs_end; + + switch (buffer[EI_CLASS]) + { + case ELFCLASS32: + xlatefrom.d_size = sizeof (Elf32_Ehdr); + if (elf32_xlatetom (&xlateto, &xlatefrom, buffer[EI_DATA]) == NULL) + { + libelf_error: + __libdwfl_seterrno (DWFL_E_LIBELF); + return NULL; + } + phoff = ehdr.e32.e_phoff; + phnum = ehdr.e32.e_phnum; + phentsize = ehdr.e32.e_phentsize; + if (phentsize != sizeof (Elf32_Phdr) || phnum == 0) + goto bad_elf; + shdrs_end = ehdr.e32.e_shoff + ehdr.e32.e_shnum * ehdr.e32.e_shentsize; + break; + + case ELFCLASS64: + xlatefrom.d_size = sizeof (Elf64_Ehdr); + if (elf64_xlatetom (&xlateto, &xlatefrom, buffer[EI_DATA]) == NULL) + goto libelf_error; + phoff = ehdr.e64.e_phoff; + phnum = ehdr.e64.e_phnum; + phentsize = ehdr.e64.e_phentsize; + if (phentsize != sizeof (Elf64_Phdr) || phnum == 0) + goto bad_elf; + shdrs_end = ehdr.e64.e_shoff + ehdr.e64.e_shnum * ehdr.e64.e_shentsize; + break; + + default: + goto bad_elf; + } + + + /* The file header tells where to find the program headers. + These are what we use to actually choose what to read. */ + + xlatefrom.d_type = xlateto.d_type = ELF_T_PHDR; + xlatefrom.d_size = phnum * phentsize; + + if ((size_t) nread >= phoff + phnum * phentsize) + /* We already have all the phdrs from the initial read. */ + xlatefrom.d_buf = buffer + phoff; + else + { + /* Read in the program headers. */ + + if (initial_bufsize < phnum * phentsize) + { + unsigned char *newbuf = realloc (buffer, phnum * phentsize); + if (newbuf == NULL) + { + free (buffer); + goto no_memory; + } + buffer = newbuf; + } + nread = (*read_memory) (arg, buffer, ehdr_vma + phoff, + phnum * phentsize, phnum * phentsize); + if (nread <= 0) + goto read_error; + + xlatefrom.d_buf = buffer; + } + + union + { + Elf32_Phdr p32[phnum]; + Elf64_Phdr p64[phnum]; + } phdrs; + + xlateto.d_buf = &phdrs; + xlateto.d_size = sizeof phdrs; + + /* Scan for PT_LOAD segments to find the total size of the file image. */ + size_t contents_size = 0; + GElf_Off segments_end = 0; + GElf_Addr loadbase = ehdr_vma; + bool found_base = false; + switch (ehdr.e32.e_ident[EI_CLASS]) + { + inline void handle_segment (GElf_Addr vaddr, GElf_Off offset, + GElf_Xword filesz, GElf_Xword align) + { + GElf_Off segment_end = ((offset + filesz + align - 1) & -align); + + if (segment_end > (GElf_Off) contents_size) + contents_size = segment_end; + + if (!found_base && (offset & -align) == 0) + { + loadbase = ehdr_vma - (vaddr & -align); + found_base = true; + } + + segments_end = offset + filesz; + } + + case ELFCLASS32: + if (elf32_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + goto libelf_error; + for (uint_fast16_t i = 0; i < phnum; ++i) + if (phdrs.p32[i].p_type == PT_LOAD) + handle_segment (phdrs.p32[i].p_vaddr, phdrs.p32[i].p_offset, + phdrs.p32[i].p_filesz, phdrs.p32[i].p_align); + break; + + case ELFCLASS64: + if (elf32_xlatetom (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + goto libelf_error; + for (uint_fast16_t i = 0; i < phnum; ++i) + if (phdrs.p32[i].p_type == PT_LOAD) + handle_segment (phdrs.p64[i].p_vaddr, phdrs.p64[i].p_offset, + phdrs.p64[i].p_filesz, phdrs.p64[i].p_align); + break; + + default: + abort (); + break; + } + + /* Trim the last segment so we don't bother with zeros in the last page + that are off the end of the file. However, if the extra bit in that + page includes the section headers, keep them. */ + if ((GElf_Off) contents_size > segments_end + && (GElf_Off) contents_size >= shdrs_end) + { + contents_size = segments_end; + if ((GElf_Off) contents_size < shdrs_end) + contents_size = shdrs_end; + } + else + contents_size = segments_end; + + free (buffer); + + /* Now we know the size of the whole image we want read in. */ + buffer = calloc (1, contents_size); + if (buffer == NULL) + goto no_memory; + + switch (ehdr.e32.e_ident[EI_CLASS]) + { + inline bool handle_segment (GElf_Addr vaddr, GElf_Off offset, + GElf_Xword filesz, GElf_Xword align) + { + GElf_Off start = offset & -align; + GElf_Off end = (offset + filesz + align - 1) & -align; + if (end > (GElf_Off) contents_size) + end = contents_size; + nread = (*read_memory) (arg, buffer + start, + (loadbase + vaddr) & -align, + end - start, end - start); + return nread <= 0; + } + + case ELFCLASS32: + for (uint_fast16_t i = 0; i < phnum; ++i) + if (phdrs.p32[i].p_type == PT_LOAD) + if (handle_segment (phdrs.p32[i].p_vaddr, phdrs.p32[i].p_offset, + phdrs.p32[i].p_filesz, phdrs.p32[i].p_align)) + goto read_error; + + /* If the segments visible in memory didn't include the section + headers, then clear them from the file header. */ + if (contents_size < shdrs_end) + { + ehdr.e32.e_shoff = 0; + ehdr.e32.e_shnum = 0; + ehdr.e32.e_shstrndx = 0; + } + + /* This will normally have been in the first PT_LOAD segment. But it + conceivably could be missing, and we might have just changed it. */ + xlatefrom.d_type = xlateto.d_type = ELF_T_EHDR; + xlatefrom.d_size = xlateto.d_size = sizeof ehdr.e32; + xlatefrom.d_buf = &ehdr.e32; + xlateto.d_buf = buffer; + if (elf32_xlatetof (&xlateto, &xlatefrom, + ehdr.e32.e_ident[EI_DATA]) == NULL) + goto libelf_error; + break; + + case ELFCLASS64: + for (uint_fast16_t i = 0; i < phnum; ++i) + if (phdrs.p32[i].p_type == PT_LOAD) + if (handle_segment (phdrs.p64[i].p_vaddr, phdrs.p64[i].p_offset, + phdrs.p64[i].p_filesz, phdrs.p64[i].p_align)) + goto read_error; + + /* If the segments visible in memory didn't include the section + headers, then clear them from the file header. */ + if (contents_size < shdrs_end) + { + ehdr.e64.e_shoff = 0; + ehdr.e64.e_shnum = 0; + ehdr.e64.e_shstrndx = 0; + } + + /* This will normally have been in the first PT_LOAD segment. But it + conceivably could be missing, and we might have just changed it. */ + xlatefrom.d_type = xlateto.d_type = ELF_T_EHDR; + xlatefrom.d_size = xlateto.d_size = sizeof ehdr.e64; + xlatefrom.d_buf = &ehdr.e64; + xlateto.d_buf = buffer; + if (elf64_xlatetof (&xlateto, &xlatefrom, + ehdr.e64.e_ident[EI_DATA]) == NULL) + goto libelf_error; + break; + + default: + abort (); + break; + } + + /* Now we have the image. Open libelf on it. */ + + Elf *elf = elf_memory ((char *) buffer, contents_size); + if (elf == NULL) + { + free (buffer); + goto libelf_error; + } + + elf->flags |= ELF_F_MALLOCED; + if (loadbasep != NULL) + *loadbasep = loadbase; + return elf; +} diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c new file mode 100644 index 00000000..5cc6f3b0 --- /dev/null +++ b/libdwfl/find-debuginfo.c @@ -0,0 +1,300 @@ +/* Standard find_debuginfo callback for libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include "system.h" + +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ + +/* Try to open64 [DIR/][SUBDIR/]DEBUGLINK, return file descriptor or -1. + On success, *DEBUGINFO_FILE_NAME has the malloc'd name of the open file. */ +static int +try_open (const char *dir, const char *subdir, const char *debuglink, + char **debuginfo_file_name) +{ + char *fname; + if (dir == NULL && subdir == NULL) + { + fname = strdup (debuglink); + if (fname == NULL) + return -1; + } + else if ((subdir == NULL ? asprintf (&fname, "%s/%s", dir, debuglink) + : dir == NULL ? asprintf (&fname, "%s/%s", subdir, debuglink) + : asprintf (&fname, "%s/%s/%s", dir, subdir, debuglink)) < 0) + return -1; + + int fd = TEMP_FAILURE_RETRY (open64 (fname, O_RDONLY)); + if (fd < 0) + free (fname); + else + *debuginfo_file_name = fname; + + return fd; +} + +/* Return true iff the FD's contents CRC matches DEBUGLINK_CRC. */ +static inline bool +check_crc (int fd, GElf_Word debuglink_crc) +{ + uint32_t file_crc; + return (__libdwfl_crc32_file (fd, &file_crc) == 0 + && file_crc == debuglink_crc); +} + +static bool +validate (Dwfl_Module *mod, int fd, bool check, GElf_Word debuglink_crc) +{ + /* If we have a build ID, check only that. */ + if (mod->build_id_len > 0) + { + /* We need to open an Elf handle on the file so we can check its + build ID note for validation. Backdoor the handle into the + module data structure since we had to open it early anyway. */ + mod->debug.elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + if (likely (__libdwfl_find_build_id (mod, false, mod->debug.elf) == 2)) + /* Also backdoor the gratuitous flag. */ + mod->debug.valid = true; + else + { + /* A mismatch! */ + elf_end (mod->debug.elf); + mod->debug.elf = NULL; + mod->debug.valid = false; + } + + return mod->debug.valid; + } + + return !check || check_crc (fd, debuglink_crc); +} + +static int +find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, + const char *debuglink_file, GElf_Word debuglink_crc, + char **debuginfo_file_name) +{ + bool cancheck = debuglink_crc != (GElf_Word) 0; + + const char *file_basename = file_name == NULL ? NULL : basename (file_name); + if (debuglink_file == NULL) + { + if (file_basename == NULL) + { + errno = 0; + return -1; + } + + size_t len = strlen (file_basename); + char *localname = alloca (len + sizeof ".debug"); + memcpy (localname, file_basename, len); + memcpy (&localname[len], ".debug", sizeof ".debug"); + debuglink_file = localname; + cancheck = false; + } + + /* Look for a file named DEBUGLINK_FILE in the directories + indicated by the debug directory path setting. */ + + const Dwfl_Callbacks *const cb = mod->dwfl->callbacks; +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); +#else + char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH); +#endif +/* ANDROID_CHANGE_END */ + + /* A leading - or + in the whole path sets whether to check file CRCs. */ + bool defcheck = true; + if (path[0] == '-' || path[0] == '+') + { + defcheck = path[0] == '+'; + ++path; + } + + /* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + char *file_dirname = (file_basename == file_name ? NULL + : strndup (file_name, file_basename - 1 - file_name)); +#else + char *file_dirname = (file_basename == file_name ? NULL + : strndupa (file_name, file_basename - 1 - file_name)); +#endif + /* ANDROID_CHANGE_END */ + char *p; + while ((p = strsep (&path, ":")) != NULL) + { + /* A leading - or + says whether to check file CRCs for this element. */ + bool check = defcheck; + if (*p == '+' || *p == '-') + check = *p++ == '+'; + check = check && cancheck; + + const char *dir, *subdir; + switch (p[0]) + { + case '\0': + /* An empty entry says to try the main file's directory. */ + dir = file_dirname; + subdir = NULL; + break; + case '/': + /* An absolute path says to look there for a subdirectory + named by the main file's absolute directory. + This cannot be applied to a relative file name. */ + if (file_dirname == NULL || file_dirname[0] != '/') + continue; + dir = p; + subdir = file_dirname + 1; + break; + default: + /* A relative path says to try a subdirectory of that name + in the main file's directory. */ + dir = file_dirname; + subdir = p; + break; + } + + char *fname; + int fd = try_open (dir, subdir, debuglink_file, &fname); + if (fd < 0) + switch (errno) + { + case ENOENT: + case ENOTDIR: + continue; + default: +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + free(path); + free(file_dirname); +#endif +/* ANDROID_CHANGE_END */ + return -1; + } + if (validate (mod, fd, check, debuglink_crc)) + { + *debuginfo_file_name = fname; +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + free(path); + free(file_dirname); +#endif +/* ANDROID_CHANGE_END */ + return fd; + } + free (fname); + close (fd); + } + +/* ANDROID_CHANGE_BEGIN */ +#ifdef __BIONIC__ + free(path); + free(file_dirname); +#endif +/* ANDROID_CHANGE_END */ + + /* No dice. */ + errno = 0; + return -1; +} + +int +dwfl_standard_find_debuginfo (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *modname __attribute__ ((unused)), + GElf_Addr base __attribute__ ((unused)), + const char *file_name, + const char *debuglink_file, + GElf_Word debuglink_crc, + char **debuginfo_file_name) +{ + /* First try by build ID if we have one. If that succeeds or fails + other than just by finding nothing, that's all we do. */ + const unsigned char *bits; + GElf_Addr vaddr; + if (INTUSE(dwfl_module_build_id) (mod, &bits, &vaddr) > 0) + { + int fd = INTUSE(dwfl_build_id_find_debuginfo) (mod, + NULL, NULL, 0, + NULL, NULL, 0, + debuginfo_file_name); + if (fd >= 0 || errno != 0) + return fd; + } + + /* Failing that, search the path by name. */ + int fd = find_debuginfo_in_path (mod, file_name, + debuglink_file, debuglink_crc, + debuginfo_file_name); + + if (fd < 0 && errno == 0) + { + /* If FILE_NAME is a symlink, the debug file might be associated + with the symlink target name instead. */ + + char *canon = canonicalize_file_name (file_name); + if (canon != NULL && strcmp (file_name, canon)) + fd = find_debuginfo_in_path (mod, canon, + debuglink_file, debuglink_crc, + debuginfo_file_name); + free (canon); + } + + return fd; +} +INTDEF (dwfl_standard_find_debuginfo) diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h new file mode 100644 index 00000000..b6ae7765 --- /dev/null +++ b/libdwfl/libdwfl.h @@ -0,0 +1,558 @@ +/* Interfaces for libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _LIBDWFL_H +#define _LIBDWFL_H 1 + +#include "libdw.h" +#include <stdio.h> + +/* Handle for a session using the library. */ +typedef struct Dwfl Dwfl; + +/* Handle for a module. */ +typedef struct Dwfl_Module Dwfl_Module; + +/* Handle describing a line record. */ +typedef struct Dwfl_Line Dwfl_Line; + +/* Callbacks. */ +typedef struct +{ + int (*find_elf) (Dwfl_Module *mod, void **userdata, + const char *modname, Dwarf_Addr base, + char **file_name, Elf **elfp); + + int (*find_debuginfo) (Dwfl_Module *mod, void **userdata, + const char *modname, Dwarf_Addr base, + const char *file_name, + const char *debuglink_file, GElf_Word debuglink_crc, + char **debuginfo_file_name); + + /* Fill *ADDR with the loaded address of the section called SECNAME in + the given module. Use (Dwarf_Addr) -1 if this section is omitted from + accessible memory. This is called exactly once for each SHF_ALLOC + section that relocations affecting DWARF data refer to, so it can + easily be used to collect state about the sections referenced. */ + int (*section_address) (Dwfl_Module *mod, void **userdata, + const char *modname, Dwarf_Addr base, + const char *secname, + GElf_Word shndx, const GElf_Shdr *shdr, + Dwarf_Addr *addr); + + char **debuginfo_path; /* See dwfl_standard_find_debuginfo. */ +} Dwfl_Callbacks; + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Start a new session with the library. */ +extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks) + __nonnull_attribute__ (1); + + +/* End a session. */ +extern void dwfl_end (Dwfl *); + +/* Return implementation's version string suitable for printing. */ +extern const char *dwfl_version (Dwfl *); + +/* Return error code of last failing function call. This value is kept + separately for each thread. */ +extern int dwfl_errno (void); + +/* Return error string for ERROR. If ERROR is zero, return error string + for most recent error or NULL if none occurred. If ERROR is -1 the + behaviour is similar to the last case except that not NULL but a legal + string is returned. */ +extern const char *dwfl_errmsg (int err); + + +/* Start reporting the current set of segments and modules to the library. + All existing segments are wiped. Existing modules are marked to be + deleted, and will not be found via dwfl_addrmodule et al if they are not + re-reported before dwfl_report_end is called. */ +extern void dwfl_report_begin (Dwfl *dwfl); + +/* Report that segment NDX begins at PHDR->p_vaddr + BIAS. + If NDX is < 0, the value succeeding the last call's NDX + is used instead (zero on the first call). + + If nonzero, the smallest PHDR->p_align value seen sets the + effective page size for the address space DWFL describes. + This is the granularity at which reported module boundary + addresses will be considered to fall in or out of a segment. + + Returns -1 for errors, or NDX (or its assigned replacement) on success. + + When NDX is the value succeeding the last call's NDX (or is implicitly + so as above), IDENT is nonnull and matches the value in the last call, + and the PHDR and BIAS values reflect a segment that would be contiguous, + in both memory and file, with the last segment reported, then this + segment may be coalesced internally with preceding segments. When given + an address inside this segment, dwfl_addrsegment may return the NDX of a + preceding contiguous segment. To prevent coalesced segments, always + pass a null pointer for IDENT. + + The values passed are not stored (except to track coalescence). + The only information that can be extracted from DWFL later is the + mapping of an address to a segment index that starts at or below + it. Reporting segments at all is optional. Its only benefit to + the caller is to offer this quick lookup via dwfl_addrsegment, + or use other segment-based calls. */ +extern int dwfl_report_segment (Dwfl *dwfl, int ndx, + const GElf_Phdr *phdr, GElf_Addr bias, + const void *ident); + +/* Report that a module called NAME spans addresses [START, END). + Returns the module handle, either existing or newly allocated, + or returns a null pointer for an allocation error. */ +extern Dwfl_Module *dwfl_report_module (Dwfl *dwfl, const char *name, + Dwarf_Addr start, Dwarf_Addr end); + +/* Report a module with start and end addresses computed from the ELF + program headers in the given file, plus BASE. For an ET_REL file, + does a simple absolute section layout starting at BASE. + FD may be -1 to open FILE_NAME. On success, FD is consumed by the + library, and the `find_elf' callback will not be used for this module. */ +extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name, + const char *file_name, int fd, + GElf_Addr base); + +/* Similar, but report the module for offline use. All ET_EXEC files + being reported must be reported before any relocatable objects. + If this is used, dwfl_report_module and dwfl_report_elf may not be + used in the same reporting session. */ +extern Dwfl_Module *dwfl_report_offline (Dwfl *dwfl, const char *name, + const char *file_name, int fd); + + +/* Finish reporting the current set of modules to the library. + If REMOVED is not null, it's called for each module that + existed before but was not included in the current report. + Returns a nonzero return value from the callback. + The callback may call dwfl_report_module; doing so with the + details of the module being removed prevents its removal. + DWFL cannot be used until this function has returned zero. */ +extern int dwfl_report_end (Dwfl *dwfl, + int (*removed) (Dwfl_Module *, void *, + const char *, Dwarf_Addr, + void *arg), + void *arg); + +/* Start reporting additional modules to the library. No calls but + dwfl_report_* can be made on DWFL until dwfl_report_end is called. + This is like dwfl_report_begin, but all the old modules are kept on. + More dwfl_report_* calls can follow to add more modules. + When dwfl_report_end is called, no old modules will be removed. */ +extern void dwfl_report_begin_add (Dwfl *dwfl); + + +/* Return the name of the module, and for each non-null argument store + interesting details: *USERDATA is a location for storing your own + pointer, **USERDATA is initially null; *START and *END give the address + range covered by the module; *DWBIAS is the address bias for debugging + information, and *SYMBIAS for symbol table entries (either is -1 if not + yet accessed); *MAINFILE is the name of the ELF file, and *DEBUGFILE the + name of the debuginfo file (might be equal to *MAINFILE; either is null + if not yet accessed). */ +extern const char *dwfl_module_info (Dwfl_Module *mod, void ***userdata, + Dwarf_Addr *start, Dwarf_Addr *end, + Dwarf_Addr *dwbias, Dwarf_Addr *symbias, + const char **mainfile, + const char **debugfile); + +/* Iterate through the modules, starting the walk with OFFSET == 0. + Calls *CALLBACK for each module as long as it returns DWARF_CB_OK. + When *CALLBACK returns another value, the walk stops and the + return value can be passed as OFFSET to resume it. Returns 0 when + there are no more modules, or -1 for errors. */ +extern ptrdiff_t dwfl_getmodules (Dwfl *dwfl, + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + void *arg), + void *arg, + ptrdiff_t offset); + +/* Find the module containing the given address. */ +extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address); + +/* Find the segment, if any, and module, if any, containing ADDRESS. + Returns a segment index returned by dwfl_report_segment, or -1 + if no segment matches the address. Regardless of the return value, + *MOD is always set to the module containing ADDRESS, or to null. */ +extern int dwfl_addrsegment (Dwfl *dwfl, Dwarf_Addr address, Dwfl_Module **mod); + + + +/* Report the known build ID bits associated with a module. + If VADDR is nonzero, it gives the absolute address where those + bits are found within the module. This can be called at any + time, but is usually used immediately after dwfl_report_module. + Once the module's main ELF file is opened, the ID note found + there takes precedence and cannot be changed. */ +extern int dwfl_module_report_build_id (Dwfl_Module *mod, + const unsigned char *bits, size_t len, + GElf_Addr vaddr) + __nonnull_attribute__ (2); + +/* Extract the build ID bits associated with a module. + Returns -1 for errors, 0 if no ID is known, or the number of ID bytes. + When an ID is found, *BITS points to it; *VADDR is the absolute address + at which the ID bits are found within the module, or 0 if unknown. + + This returns 0 when the module's main ELF file has not yet been loaded + and its build ID bits were not reported. To ensure the ID is always + returned when determinable, call dwfl_module_getelf first. */ +extern int dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) + __nonnull_attribute__ (2, 3); + + +/*** Standard callbacks ***/ + +/* These standard find_elf and find_debuginfo callbacks are + controlled by a string specifying directories to look in. + If `debuginfo_path' is set in the Dwfl_Callbacks structure + and the char * it points to is not null, that supplies the + string. Otherwise a default path is used. + + If the first character of the string is + or - that enables or + disables CRC32 checksum validation when it's necessary. The + remainder of the string is composed of elements separated by + colons. Each element can start with + or - to override the + global checksum behavior. This flag is never relevant when + working with build IDs, but it's always parsed in the path + string. The remainder of the element indicates a directory. + + Searches by build ID consult only the elements naming absolute + directory paths. They look under those directories for a link + named ".build-id/xx/yy" or ".build-id/xx/yy.debug", where "xxyy" + is the lower-case hexadecimal representation of the ID bytes. + + In searches for debuginfo by name, if the remainder of the + element is empty, the directory containing the main file is + tried; if it's an absolute path name, the absolute directory path + containing the main file is taken as a subdirectory of this path; + a relative path name is taken as a subdirectory of the directory + containing the main file. Hence for /bin/ls, the default string + ":.debug:/usr/lib/debug" says to look in /bin, then /bin/.debug, + then /usr/lib/debug/bin, for the file name in the .gnu_debuglink + section (or "ls.debug" if none was found). */ + +/* Standard find_elf callback function working solely on build ID. + This can be tried first by any find_elf callback, to use the + bits passed to dwfl_module_report_build_id, if any. */ +extern int dwfl_build_id_find_elf (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + char **, Elf **); + +/* Standard find_debuginfo callback function working solely on build ID. + This can be tried first by any find_debuginfo callback, + to use the build ID bits from the main file when present. */ +extern int dwfl_build_id_find_debuginfo (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + const char *, const char *, + GElf_Word, char **); + +/* Standard find_debuginfo callback function. + If a build ID is available, this tries first to use that. + If there is no build ID or no valid debuginfo found by ID, + it searches the debuginfo path by name, as described above. + Any file found in the path is validated by build ID if possible, + or else by CRC32 checksum if enabled, and skipped if it does not match. */ +extern int dwfl_standard_find_debuginfo (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + const char *, const char *, + GElf_Word, char **); + + +/* This callback must be used when using dwfl_offline_* to report modules, + if ET_REL is to be supported. */ +extern int dwfl_offline_section_address (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + const char *, GElf_Word, + const GElf_Shdr *, + Dwarf_Addr *addr); + + +/* Callbacks for working with kernel modules in the running Linux kernel. */ +extern int dwfl_linux_kernel_find_elf (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + char **, Elf **); +extern int dwfl_linux_kernel_module_section_address (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + const char *, GElf_Word, + const GElf_Shdr *, + Dwarf_Addr *addr); + +/* Call dwfl_report_elf for the running Linux kernel. + Returns zero on success, -1 if dwfl_report_module failed, + or an errno code if opening the kernel binary failed. */ +extern int dwfl_linux_kernel_report_kernel (Dwfl *dwfl); + +/* Call dwfl_report_module for each kernel module in the running Linux kernel. + Returns zero on success, -1 if dwfl_report_module failed, + or an errno code if reading the list of modules failed. */ +extern int dwfl_linux_kernel_report_modules (Dwfl *dwfl); + +/* Report a kernel and its modules found on disk, for offline use. + If RELEASE starts with '/', it names a directory to look in; + if not, it names a directory to find under /lib/modules/; + if null, /lib/modules/`uname -r` is used. + Returns zero on success, -1 if dwfl_report_module failed, + or an errno code if finding the files on disk failed. + + If PREDICATE is not null, it is called with each module to be reported; + its arguments are the module name, and the ELF file name or null if unknown, + and its return value should be zero to skip the module, one to report it, + or -1 to cause the call to fail and return errno. */ +extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, + int (*predicate) (const char *, + const char *)); + + +/* Call dwfl_report_module for each file mapped into the address space of PID. + Returns zero on success, -1 if dwfl_report_module failed, + or an errno code if opening the kernel binary failed. */ +extern int dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid); + +/* Similar, but reads an input stream in the format of Linux /proc/PID/maps + files giving module layout, not the file for a live process. */ +extern int dwfl_linux_proc_maps_report (Dwfl *dwfl, FILE *); + +/* Trivial find_elf callback for use with dwfl_linux_proc_report. + This uses the module name as a file name directly and tries to open it + if it begin with a slash, or handles the magic string "[vdso]". */ +extern int dwfl_linux_proc_find_elf (Dwfl_Module *mod, void **userdata, + const char *module_name, Dwarf_Addr base, + char **file_name, Elf **); + +/* Standard argument parsing for using a standard callback set. */ +struct argp; +extern const struct argp *dwfl_standard_argp (void) __attribute__ ((const)); + + +/*** Relocation of addresses from Dwfl ***/ + +/* Return the number of relocatable bases associated with the module, + which is zero for ET_EXEC and one for ET_DYN. Returns -1 for errors. */ +extern int dwfl_module_relocations (Dwfl_Module *mod); + +/* Return the relocation base index associated with the *ADDRESS location, + and adjust *ADDRESS to be an offset relative to that base. + Returns -1 for errors. */ +extern int dwfl_module_relocate_address (Dwfl_Module *mod, + Dwarf_Addr *address); + +/* Return the ELF section name for the given relocation base index; + if SHNDXP is not null, set *SHNDXP to the ELF section index. + For ET_DYN, returns "" and sets *SHNDXP to SHN_ABS; the relocation + base is the runtime start address reported for the module. + Returns null for errors. */ +extern const char *dwfl_module_relocation_info (Dwfl_Module *mod, + unsigned int idx, + GElf_Word *shndxp); + +/* Validate that ADDRESS and ADDRESS+OFFSET lie in a known module + and both within the same contiguous region for relocation purposes. + Returns zero for success and -1 for errors. */ +extern int dwfl_validate_address (Dwfl *dwfl, + Dwarf_Addr address, Dwarf_Sword offset); + + +/*** ELF access functions ***/ + +/* Fetch the module main ELF file (where the allocated sections + are found) for use with libelf. If successful, fills in *BIAS + with the difference between addresses within the loaded module + and those in symbol tables or Dwarf information referring to it. */ +extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias); + +/* Return the number of symbols in the module's symbol table, + or -1 for errors. */ +extern int dwfl_module_getsymtab (Dwfl_Module *mod); + +/* Fetch one entry from the module's symbol table. On errors, returns + NULL. If successful, fills in *SYM and returns the string for st_name. + This works like gelf_getsym except that st_value is always adjusted + to an absolute value based on the module's location. If SHNDXP is + non-null, it's set with the section index (whether from st_shndx or + extended index table). */ +extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx, + GElf_Sym *sym, GElf_Word *shndxp) + __nonnull_attribute__ (3); + +/* Find the symbol that ADDRESS lies inside, and return its name. */ +extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address); + +/* Find the symbol that ADDRESS lies inside, and return detailed + information as for dwfl_module_getsym (above). */ +extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address, + GElf_Sym *sym, GElf_Word *shndxp) + __nonnull_attribute__ (3); + +/* Find the ELF section that *ADDRESS lies inside and return it. + On success, adjusts *ADDRESS to be relative to the section, + and sets *BIAS to the difference between addresses used in + the returned section's headers and run-time addresses. */ +extern Elf_Scn *dwfl_module_address_section (Dwfl_Module *mod, + Dwarf_Addr *address, + Dwarf_Addr *bias) + __nonnull_attribute__ (2, 3); + + +/*** Dwarf access functions ***/ + +/* Fetch the module's debug information for use with libdw. + If successful, fills in *BIAS with the difference between + addresses within the loaded module and those to use with libdw. */ +extern Dwarf *dwfl_module_getdwarf (Dwfl_Module *, Dwarf_Addr *bias) + __nonnull_attribute__ (2); + +/* Get the libdw handle for each module. */ +extern ptrdiff_t dwfl_getdwarf (Dwfl *, + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + Dwarf *, Dwarf_Addr, void *), + void *arg, ptrdiff_t offset); + +/* Look up the module containing ADDR and return its debugging information, + loading it if necessary. */ +extern Dwarf *dwfl_addrdwarf (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias) + __nonnull_attribute__ (3); + + +/* Find the CU containing ADDR and return its DIE. */ +extern Dwarf_Die *dwfl_addrdie (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias) + __nonnull_attribute__ (3); +extern Dwarf_Die *dwfl_module_addrdie (Dwfl_Module *mod, + Dwarf_Addr addr, Dwarf_Addr *bias) + __nonnull_attribute__ (3); + +/* Iterate through the CUs, start with null for LASTCU. */ +extern Dwarf_Die *dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias) + __nonnull_attribute__ (3); +extern Dwarf_Die *dwfl_module_nextcu (Dwfl_Module *mod, + Dwarf_Die *lastcu, Dwarf_Addr *bias) + __nonnull_attribute__ (3); + +/* Return the module containing the CU DIE. */ +extern Dwfl_Module *dwfl_cumodule (Dwarf_Die *cudie); + + +/* Cache the source line information fo the CU and return the + number of Dwfl_Line entries it has. */ +extern int dwfl_getsrclines (Dwarf_Die *cudie, size_t *nlines); + +/* Access one line number entry within the CU. */ +extern Dwfl_Line *dwfl_onesrcline (Dwarf_Die *cudie, size_t idx); + +/* Get source for address. */ +extern Dwfl_Line *dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr); +extern Dwfl_Line *dwfl_getsrc (Dwfl *dwfl, Dwarf_Addr addr); + +/* Get address for source. */ +extern int dwfl_module_getsrc_file (Dwfl_Module *mod, + const char *fname, int lineno, int column, + Dwfl_Line ***srcsp, size_t *nsrcs); + +/* Return the module containing this line record. */ +extern Dwfl_Module *dwfl_linemodule (Dwfl_Line *line); + +/* Return the CU containing this line record. */ +extern Dwarf_Die *dwfl_linecu (Dwfl_Line *line); + +/* Return the source file name and fill in other information. + Arguments may be null for unneeded fields. */ +extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, + int *linep, int *colp, + Dwarf_Word *mtime, Dwarf_Word *length); + +/* Return the compilation directory (AT_comp_dir) from this line's CU. */ +extern const char *dwfl_line_comp_dir (Dwfl_Line *line); + + +/*** Machine backend access functions ***/ + +/* Return location expression to find return value given a + DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing + function itself (whose DW_AT_type attribute describes its return type). + The given DIE must come from the given module. Returns -1 for errors. + Returns zero if the function has no return value (e.g. "void" in C). + Otherwise, *LOCOPS gets a location expression to find the return value, + and returns the number of operations in the expression. The pointer is + permanently allocated at least as long as the module is live. */ +extern int dwfl_module_return_value_location (Dwfl_Module *mod, + Dwarf_Die *functypedie, + const Dwarf_Op **locops); + +/* Enumerate the DWARF register numbers and their names. + For each register, CALLBACK gets its DWARF number, a string describing + the register set (such as "integer" or "FPU"), a prefix used in + assembler syntax (such as "%" or "$", may be ""), and the name for the + register (contains identifier characters only, possibly all digits). + The REGNAME string is valid only during the callback. */ +extern int dwfl_module_register_names (Dwfl_Module *mod, + int (*callback) (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits, int type), + void *arg); + + +#ifdef __cplusplus +} +#endif + +#endif /* libdwfl.h */ diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h new file mode 100644 index 00000000..6ba5c96e --- /dev/null +++ b/libdwfl/libdwflP.h @@ -0,0 +1,416 @@ +/* Internal definitions for libdwfl. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _LIBDWFLP_H +#define _LIBDWFLP_H 1 + +#ifndef PACKAGE_NAME +# include <config.h> +#endif +#include <libdwfl.h> +#include <libebl.h> +#include <assert.h> +#include <errno.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#include "../libdw/libdwP.h" /* We need its INTDECLs. */ + +/* gettext helper macros. */ +#define _(Str) dgettext ("elfutils", Str) + +#define DWFL_ERRORS \ + DWFL_ERROR (NOERROR, N_("no error")) \ + DWFL_ERROR (UNKNOWN_ERROR, N_("unknown error")) \ + DWFL_ERROR (NOMEM, N_("out of memory")) \ + DWFL_ERROR (ERRNO, N_("See errno")) \ + DWFL_ERROR (LIBELF, N_("See elf_errno")) \ + DWFL_ERROR (LIBDW, N_("See dwarf_errno")) \ + DWFL_ERROR (LIBEBL, N_("See ebl_errno (XXX missing)")) \ + DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \ + DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \ + DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \ + DWFL_ERROR (BADRELOFF, N_("r_offset is bogus")) \ + DWFL_ERROR (BADSTROFF, N_("offset out of range")) \ + DWFL_ERROR (RELUNDEF, N_("relocation refers to undefined symbol")) \ + DWFL_ERROR (CB, N_("Callback returned failure")) \ + DWFL_ERROR (NO_DWARF, N_("No DWARF information found")) \ + DWFL_ERROR (NO_SYMTAB, N_("No symbol table found")) \ + DWFL_ERROR (NO_PHDR, N_("No ELF program headers")) \ + DWFL_ERROR (OVERLAP, N_("address range overlaps an existing module")) \ + DWFL_ERROR (ADDR_OUTOFRANGE, N_("address out of range")) \ + DWFL_ERROR (NO_MATCH, N_("no matching address range")) \ + DWFL_ERROR (TRUNCATED, N_("image truncated")) \ + DWFL_ERROR (ALREADY_ELF, N_("ELF file opened")) \ + DWFL_ERROR (BADELF, N_("not a valid ELF file")) \ + DWFL_ERROR (WEIRD_TYPE, N_("cannot handle DWARF type description")) + +#define DWFL_ERROR(name, text) DWFL_E_##name, +typedef enum { DWFL_ERRORS DWFL_E_NUM } Dwfl_Error; +#undef DWFL_ERROR + +#define OTHER_ERROR(name) ((unsigned int) DWFL_E_##name << 16) +#define DWFL_E(name, errno) (OTHER_ERROR (name) | (errno)) + +extern int __libdwfl_canon_error (Dwfl_Error) internal_function; +extern void __libdwfl_seterrno (Dwfl_Error) internal_function; + +struct Dwfl +{ + const Dwfl_Callbacks *callbacks; + + Dwfl_Module *modulelist; /* List in order used by full traversals. */ + + GElf_Addr offline_next_address; + + GElf_Addr segment_align; /* Smallest granularity of segments. */ + + /* Binary search table in three parallel malloc'd arrays. */ + size_t lookup_elts; /* Elements in use. */ + size_t lookup_alloc; /* Elements allococated. */ + GElf_Addr *lookup_addr; /* Start address of segment. */ + Dwfl_Module **lookup_module; /* Module associated with segment, or null. */ + int *lookup_segndx; /* User segment index, or -1. */ + + /* Cache from last dwfl_report_segment call. */ + const void *lookup_tail_ident; + GElf_Off lookup_tail_vaddr; + GElf_Off lookup_tail_offset; + int lookup_tail_ndx; +}; + +#define OFFLINE_REDZONE 0x10000 + +struct dwfl_file +{ + char *name; + int fd; + bool valid; /* The build ID note has been matched. */ + bool relocated; /* Partial relocation of all sections done. */ + + Elf *elf; + GElf_Addr bias; /* Actual load address - p_vaddr. */ +}; + +struct Dwfl_Module +{ + Dwfl *dwfl; + struct Dwfl_Module *next; /* Link on Dwfl.modulelist. */ + + void *userdata; + + char *name; /* Iterator name for this module. */ + GElf_Addr low_addr, high_addr; + + void *build_id_bits; /* malloc'd copy of build ID bits. */ + GElf_Addr build_id_vaddr; /* Address where they reside, 0 if unknown. */ + int build_id_len; /* -1 for prior failure, 0 if unset. */ + + struct dwfl_file main, debug; + Ebl *ebl; + GElf_Half e_type; /* GElf_Ehdr.e_type cache. */ + Dwfl_Error elferr; /* Previous failure to open main file. */ + + struct dwfl_relocation *reloc_info; /* Relocatable sections. */ + + struct dwfl_file *symfile; /* Either main or debug. */ + Elf_Data *symdata; /* Data in the ELF symbol table section. */ + size_t syments; /* sh_size / sh_entsize of that section. */ + Elf_Data *symstrdata; /* Data for its string table. */ + Elf_Data *symxndxdata; /* Data in the extended section index table. */ + Dwfl_Error symerr; /* Previous failure to load symbols. */ + + Dwarf *dw; /* libdw handle for its debugging info. */ + Dwfl_Error dwerr; /* Previous failure to load info. */ + + /* Known CU's in this module. */ + struct dwfl_cu *first_cu, **cu; + unsigned int ncu; + + void *lazy_cu_root; /* Table indexed by Dwarf_Off of CU. */ + unsigned int lazycu; /* Possible users, deleted when none left. */ + + struct dwfl_arange *aranges; /* Mapping of addresses in module to CUs. */ + unsigned int naranges; + + int segment; /* Index of first segment table entry. */ + bool gc; /* Mark/sweep flag. */ +}; + + + +/* Information cached about each CU in Dwfl_Module.dw. */ +struct dwfl_cu +{ + /* This caches libdw information about the CU. It's also the + address passed back to users, so we take advantage of the + fact that it's placed first to cast back. */ + Dwarf_Die die; + + Dwfl_Module *mod; /* Pointer back to containing module. */ + + struct dwfl_cu *next; /* CU immediately following in the file. */ + + struct Dwfl_Lines *lines; +}; + +struct Dwfl_Lines +{ + struct dwfl_cu *cu; + + /* This is what the opaque Dwfl_Line * pointers we pass to users are. + We need to recover pointers to our struct dwfl_cu and a record in + libdw's Dwarf_Line table. To minimize the memory used in addition + to libdw's Dwarf_Lines buffer, we just point to our own index in + this table, and have one pointer back to the CU. The indices here + match those in libdw's Dwarf_CU.lines->info table. */ + struct Dwfl_Line + { + unsigned int idx; /* My index in the dwfl_cu.lines table. */ + } idx[0]; +}; + +static inline struct dwfl_cu * +dwfl_linecu_inline (const Dwfl_Line *line) +{ + const struct Dwfl_Lines *lines = ((const void *) line + - offsetof (struct Dwfl_Lines, + idx[line->idx])); + return lines->cu; +} +#define dwfl_linecu dwfl_linecu_inline + +/* This describes a contiguous address range that lies in a single CU. + We condense runs of Dwarf_Arange entries for the same CU into this. */ +struct dwfl_arange +{ + struct dwfl_cu *cu; + size_t arange; /* Index in Dwarf_Aranges. */ +}; + + + +extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function; + + +/* Process relocations in debugging sections in an ET_REL file. + FILE must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ, + to make it possible to relocate the data in place (or ELF_C_RDWR or + ELF_C_RDWR_MMAP if you intend to modify the Elf file on disk). After + this, dwarf_begin_elf on FILE will read the relocated data. + + When DEBUG is false, apply partial relocation to all sections. */ +extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *mod, Elf *file, bool debug) + internal_function; + +/* Process (simple) relocations in arbitrary section TSCN of an ET_REL file. + RELOCSCN is SHT_REL or SHT_RELA and TSCN is its sh_info target section. */ +extern Dwfl_Error __libdwfl_relocate_section (Dwfl_Module *mod, Elf *relocated, + Elf_Scn *relocscn, Elf_Scn *tscn, + bool partial) + internal_function; + +/* Adjust *VALUE from section-relative to absolute. + MOD->dwfl->callbacks->section_address is called to determine the actual + address of a loaded section. */ +extern Dwfl_Error __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf, + size_t *shstrndx_cache, + Elf32_Word shndx, + GElf_Addr *value) + internal_function; + + +/* Ensure that MOD->ebl is set up. */ +extern Dwfl_Error __libdwfl_module_getebl (Dwfl_Module *mod) internal_function; + +/* Iterate through all the CU's in the module. Start by passing a null + LASTCU, and then pass the last *CU returned. Success return with null + *CU no more CUs. */ +extern Dwfl_Error __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu, + struct dwfl_cu **cu) internal_function; + +/* Find the CU by address. */ +extern Dwfl_Error __libdwfl_addrcu (Dwfl_Module *mod, Dwarf_Addr addr, + struct dwfl_cu **cu) internal_function; + +/* Ensure that CU->lines (and CU->cu->lines) is set up. */ +extern Dwfl_Error __libdwfl_cu_getsrclines (struct dwfl_cu *cu) + internal_function; + +/* Look in ELF for an NT_GNU_BUILD_ID note. If SET is true, store it + in MOD and return its length. If SET is false, instead compare it + to that stored in MOD and return 2 if they match, 1 if they do not. + Returns -1 for errors, 0 if no note is found. */ +extern int __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) + internal_function; + +/* Open a main or debuginfo file by its build ID, returns the fd. */ +extern int __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, + char **file_name) internal_function; + +extern uint32_t __libdwfl_crc32 (uint32_t crc, unsigned char *buf, size_t len) + attribute_hidden; +extern int __libdwfl_crc32_file (int fd, uint32_t *resp) attribute_hidden; + + +/* Meat of dwfl_report_elf, given elf_begin just called. + Consumes ELF on success, not on failure. */ +extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name, + const char *file_name, int fd, + Elf *elf, GElf_Addr base) + internal_function; + +/* Meat of dwfl_report_offline. */ +extern Dwfl_Module *__libdwfl_report_offline (Dwfl *dwfl, const char *name, + const char *file_name, + int fd, bool closefd, + int (*predicate) (const char *, + const char *)) + internal_function; + + +/* These are working nicely for --core, but are not ready to be + exported interfaces quite yet. */ + +/* Type of callback function ... + */ +typedef bool Dwfl_Memory_Callback (Dwfl *dwfl, int segndx, + void **buffer, size_t *buffer_available, + GElf_Addr vaddr, size_t minread, void *arg); + +/* Type of callback function ... + */ +typedef bool Dwfl_Module_Callback (Dwfl_Module *mod, void **userdata, + const char *name, Dwarf_Addr base, + void **buffer, size_t *buffer_available, + GElf_Off cost, GElf_Off worthwhile, + GElf_Off whole, GElf_Off contiguous, + void *arg, Elf **elfp); + +/* ... + */ +extern int dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg, + Dwfl_Module_Callback *read_eagerly, + void *read_eagerly_arg); + +/* Report a module for entry in the dynamic linker's struct link_map list. + For each link_map entry, if an existing module resides at its address, + this just modifies that module's name and suggested file name. If + no such module exists, this calls dwfl_report_elf on the l_name string. + + If AUXV is not null, it points to AUXV_SIZE bytes of auxiliary vector + data as contained in an NT_AUXV note or read from a /proc/pid/auxv + file. When this is available, it guides the search. If AUXV is null + or the memory it points to is not accessible, then this search can + only find where to begin if the correct executable file was + previously reported and preloaded as with dwfl_report_elf. + + Returns the number of modules found, or -1 for errors. */ +extern int dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg); + +/* Examine an ET_CORE file and report modules based on its contents. */ +extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr); + + +/* Avoid PLT entries. */ +INTDECL (dwfl_begin) +INTDECL (dwfl_errmsg) +INTDECL (dwfl_addrmodule) +INTDECL (dwfl_addrsegment) +INTDECL (dwfl_addrdwarf) +INTDECL (dwfl_addrdie) +INTDECL (dwfl_core_file_report) +INTDECL (dwfl_getmodules) +INTDECL (dwfl_module_addrdie) +INTDECL (dwfl_module_address_section) +INTDECL (dwfl_module_addrsym) +INTDECL (dwfl_module_build_id) +INTDECL (dwfl_module_getdwarf) +INTDECL (dwfl_module_getelf) +INTDECL (dwfl_module_getsym) +INTDECL (dwfl_module_getsymtab) +INTDECL (dwfl_module_getsrc) +INTDECL (dwfl_module_report_build_id) +INTDECL (dwfl_report_elf) +INTDECL (dwfl_report_begin) +INTDECL (dwfl_report_begin_add) +INTDECL (dwfl_report_module) +INTDECL (dwfl_report_segment) +INTDECL (dwfl_report_offline) +INTDECL (dwfl_report_end) +INTDECL (dwfl_build_id_find_elf) +INTDECL (dwfl_build_id_find_debuginfo) +INTDECL (dwfl_standard_find_debuginfo) +INTDECL (dwfl_link_map_report) +INTDECL (dwfl_linux_kernel_find_elf) +INTDECL (dwfl_linux_kernel_module_section_address) +INTDECL (dwfl_linux_proc_report) +INTDECL (dwfl_linux_proc_maps_report) +INTDECL (dwfl_linux_proc_find_elf) +INTDECL (dwfl_linux_kernel_report_kernel) +INTDECL (dwfl_linux_kernel_report_modules) +INTDECL (dwfl_linux_kernel_report_offline) +INTDECL (dwfl_offline_section_address) +INTDECL (dwfl_module_relocate_address) + +/* Leading arguments standard to callbacks passed a Dwfl_Module. */ +#define MODCB_ARGS(mod) (mod), &(mod)->userdata, (mod)->name, (mod)->low_addr +#define CBFAIL (errno ? DWFL_E (ERRNO, errno) : DWFL_E_CB); + + +/* The default used by dwfl_standard_find_debuginfo. */ +#define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug" + + +#endif /* libdwflP.h */ diff --git a/libdwfl/libdwfl_crc32.c b/libdwfl/libdwfl_crc32.c new file mode 100644 index 00000000..0fa23789 --- /dev/null +++ b/libdwfl/libdwfl_crc32.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define crc32 attribute_hidden __libdwfl_crc32 +#define LIB_SYSTEM_H 1 +#include <libdwflP.h> +#include "../lib/crc32.c" diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c new file mode 100644 index 00000000..ca154be3 --- /dev/null +++ b/libdwfl/libdwfl_crc32_file.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define crc32_file attribute_hidden __libdwfl_crc32_file +#define crc32 __libdwfl_crc32 +#define LIB_SYSTEM_H 1 +#include <libdwflP.h> +#include "../lib/crc32_file.c" diff --git a/libdwfl/lines.c b/libdwfl/lines.c new file mode 100644 index 00000000..ed4267fc --- /dev/null +++ b/libdwfl/lines.c @@ -0,0 +1,73 @@ +/* Fetch source line info for CU. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include "../libdw/libdwP.h" + +Dwfl_Error +internal_function +__libdwfl_cu_getsrclines (struct dwfl_cu *cu) +{ + if (cu->lines == NULL) + { + Dwarf_Lines *lines; + size_t nlines; + if (INTUSE(dwarf_getsrclines) (&cu->die, &lines, &nlines) != 0) + return DWFL_E_LIBDW; + + cu->lines = malloc (offsetof (struct Dwfl_Lines, idx[nlines])); + if (cu->lines == NULL) + return DWFL_E_NOMEM; + cu->lines->cu = cu; + for (unsigned int i = 0; i < nlines; ++i) + cu->lines->idx[i].idx = i; + } + + return DWFL_E_NOERROR; +} diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c new file mode 100644 index 00000000..e9890384 --- /dev/null +++ b/libdwfl/link_map.c @@ -0,0 +1,867 @@ +/* Report modules by examining dynamic linker data structures. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include "libdwflP.h" + +#include <byteswap.h> +#include <endian.h> + +/* This element is always provided and always has a constant value. + This makes it an easy thing to scan for to discern the format. */ +#define PROBE_TYPE AT_PHENT +#define PROBE_VAL32 sizeof (Elf32_Phdr) +#define PROBE_VAL64 sizeof (Elf64_Phdr) + +#if BYTE_ORDER == BIG_ENDIAN +# define BE32(x) (x) +# define BE64(x) (x) +# define LE32(x) bswap_32 (x) +# define LE64(x) bswap_64 (x) +#else +# define LE32(x) (x) +# define LE64(x) (x) +# define BE32(x) bswap_32 (x) +# define BE64(x) bswap_64 (x) +#endif + + +/* Examine an auxv data block and determine its format. + Return true iff we figured it out. */ +static bool +auxv_format_probe (const void *auxv, size_t size, + uint_fast8_t *elfclass, uint_fast8_t *elfdata) +{ + const union + { + char buf[size]; + Elf32_auxv_t a32[size / sizeof (Elf32_auxv_t)]; + Elf64_auxv_t a64[size / sizeof (Elf64_auxv_t)]; + } *u = auxv; + + inline bool check64 (size_t i) + { + if (u->a64[i].a_type == BE64 (PROBE_TYPE) + && u->a64[i].a_un.a_val == BE64 (PROBE_VAL64)) + { + *elfdata = ELFDATA2MSB; + return true; + } + + if (u->a64[i].a_type == LE64 (PROBE_TYPE) + && u->a64[i].a_un.a_val == LE64 (PROBE_VAL64)) + { + *elfdata = ELFDATA2LSB; + return true; + } + + return false; + } + + inline bool check32 (size_t i) + { + if (u->a32[i].a_type == BE32 (PROBE_TYPE) + && u->a32[i].a_un.a_val == BE32 (PROBE_VAL32)) + { + *elfdata = ELFDATA2MSB; + return true; + } + + if (u->a32[i].a_type == LE32 (PROBE_TYPE) + && u->a32[i].a_un.a_val == LE32 (PROBE_VAL32)) + { + *elfdata = ELFDATA2LSB; + return true; + } + + return false; + } + + size_t i; + for (i = 0; i < size / sizeof (Elf64_auxv_t); ++i) + { + if (check64 (i)) + { + *elfclass = ELFCLASS64; + return true; + } + + if (check32 (i)) + { + *elfclass = ELFCLASS32; + return true; + } + } + for (; i < size / sizeof (Elf64_auxv_t); ++i) + if (check32 (i)) + { + *elfclass = ELFCLASS32; + return true; + } + + return false; +} + +/* This is a Dwfl_Memory_Callback that wraps another memory callback. + If the underlying callback cannot fill the data, then this will + fall back to fetching data from module files. */ + +struct integrated_memory_callback +{ + Dwfl_Memory_Callback *memory_callback; + void *memory_callback_arg; + void *buffer; +}; + +static bool +integrated_memory_callback (Dwfl *dwfl, int ndx, + void **buffer, size_t *buffer_available, + GElf_Addr vaddr, + size_t minread, + void *arg) +{ + struct integrated_memory_callback *info = arg; + + if (ndx == -1) + { + /* Called for cleanup. */ + if (info->buffer != NULL) + { + /* The last probe buffer came from the underlying callback. + Let it do its cleanup. */ + assert (*buffer == info->buffer); /* XXX */ + *buffer = info->buffer; + info->buffer = NULL; + return (*info->memory_callback) (dwfl, ndx, buffer, buffer_available, + vaddr, minread, + info->memory_callback_arg); + } + *buffer = NULL; + *buffer_available = 0; + return false; + } + + if (*buffer != NULL) + /* For a final-read request, we only use the underlying callback. */ + return (*info->memory_callback) (dwfl, ndx, buffer, buffer_available, + vaddr, minread, info->memory_callback_arg); + + /* Let the underlying callback try to fill this request. */ + if ((*info->memory_callback) (dwfl, ndx, &info->buffer, buffer_available, + vaddr, minread, info->memory_callback_arg)) + { + *buffer = info->buffer; + return true; + } + + /* Now look for module text covering this address. */ + + Dwfl_Module *mod; + (void) INTUSE(dwfl_addrsegment) (dwfl, vaddr, &mod); + if (mod == NULL) + return false; + + Dwarf_Addr bias; + Elf_Scn *scn = INTUSE(dwfl_module_address_section) (mod, &vaddr, &bias); + if (unlikely (scn == NULL)) + { +#if 0 // XXX would have to handle ndx=-1 cleanup calls passed down. + /* If we have no sections we can try to fill it from the module file + based on its phdr mappings. */ + if (likely (mod->e_type != ET_REL) && mod->main.elf != NULL) + return INTUSE(dwfl_elf_phdr_memory_callback) + (dwfl, 0, buffer, buffer_available, + vaddr - mod->main.bias, minread, mod->main.elf); +#endif + return false; + } + + Elf_Data *data = elf_rawdata (scn, NULL); + if (unlikely (data == NULL)) + // XXX throw error? + return false; + + if (unlikely (data->d_size < vaddr)) + return false; + + /* Provide as much data as we have. */ + void *contents = data->d_buf + vaddr; + size_t avail = data->d_size - vaddr; + if (unlikely (avail < minread)) + return false; + + /* If probing for a string, make sure it's terminated. */ + if (minread == 0 && unlikely (memchr (contents, '\0', avail) == NULL)) + return false; + + /* We have it! */ + *buffer = contents; + *buffer_available = avail; + return true; +} + +static size_t +addrsize (uint_fast8_t elfclass) +{ + return elfclass * 4; +} + +/* Report a module for each struct link_map in the linked list at r_map + in the struct r_debug at R_DEBUG_VADDR. + + For each link_map entry, if an existing module resides at its address, + this just modifies that module's name and suggested file name. If + no such module exists, this calls dwfl_report_elf on the l_name string. + + Returns the number of modules found, or -1 for errors. */ + +static int +report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, + Dwfl *dwfl, GElf_Addr r_debug_vaddr, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg) +{ + /* Skip r_version, to aligned r_map field. */ + GElf_Addr read_vaddr = r_debug_vaddr + addrsize (elfclass); + + void *buffer = NULL; + size_t buffer_available = 0; + inline int release_buffer (int result) + { + if (buffer != NULL) + (void) (*memory_callback) (dwfl, -1, &buffer, &buffer_available, 0, 0, + memory_callback_arg); + return result; + } + + GElf_Addr addrs[4]; + inline bool read_addrs (GElf_Addr vaddr, size_t n) + { + size_t nb = n * addrsize (elfclass); /* Address words -> bytes to read. */ + + /* Read a new buffer if the old one doesn't cover these words. */ + if (buffer == NULL + || vaddr < read_vaddr + || vaddr - read_vaddr + nb > buffer_available) + { + release_buffer (0); + + read_vaddr = vaddr; + int segndx = INTUSE(dwfl_addrsegment) (dwfl, vaddr, NULL); + if (unlikely (segndx < 0) + || unlikely (! (*memory_callback) (dwfl, segndx, + &buffer, &buffer_available, + vaddr, nb, memory_callback_arg))) + return true; + } + + const union + { + Elf32_Addr a32[n]; + Elf64_Addr a64[n]; + } *in = vaddr - read_vaddr + buffer; + + if (elfclass == ELFCLASS32) + { + if (elfdata == ELFDATA2MSB) + for (size_t i = 0; i < n; ++i) + addrs[i] = BE32 (in->a32[i]); + else + for (size_t i = 0; i < n; ++i) + addrs[i] = LE32 (in->a32[i]); + } + else + { + if (elfdata == ELFDATA2MSB) + for (size_t i = 0; i < n; ++i) + addrs[i] = BE64 (in->a64[i]); + else + for (size_t i = 0; i < n; ++i) + addrs[i] = LE64 (in->a64[i]); + } + + return false; + } + + if (unlikely (read_addrs (read_vaddr, 1))) + return release_buffer (-1); + + GElf_Addr next = addrs[0]; + + Dwfl_Module **lastmodp = &dwfl->modulelist; + int result = 0; + while (next != 0) + { + if (read_addrs (next, 4)) + return release_buffer (-1); + + GElf_Addr l_addr = addrs[0]; + GElf_Addr l_name = addrs[1]; + GElf_Addr l_ld = addrs[2]; + next = addrs[3]; + + /* Fetch the string at the l_name address. */ + const char *name = NULL; + if (buffer != NULL + && read_vaddr <= l_name + && l_name + 1 - read_vaddr < buffer_available + && memchr (l_name - read_vaddr + buffer, '\0', + buffer_available - (l_name - read_vaddr)) != NULL) + name = l_name - read_vaddr + buffer; + else + { + release_buffer (0); + read_vaddr = l_name; + int segndx = INTUSE(dwfl_addrsegment) (dwfl, l_name, NULL); + if (likely (segndx >= 0) + && (*memory_callback) (dwfl, segndx, + &buffer, &buffer_available, + l_name, 0, memory_callback_arg)) + name = buffer; + } + + if (name != NULL && name[0] == '\0') + name = NULL; + + /* If content-sniffing already reported a module covering + the same area, find that existing module to adjust. + The l_ld address is the only one we know for sure + to be within the module's own segments (its .dynamic). */ + Dwfl_Module *mod; + int segndx = INTUSE(dwfl_addrsegment) (dwfl, l_ld, &mod); + if (unlikely (segndx < 0)) + return release_buffer (-1); + + if (mod != NULL) + { + /* We have a module. We can give it a better name from l_name. */ + if (name != NULL && mod->name[0] == '[') + { + char *newname = strdup (basename (name)); + if (newname != NULL) + { + free (mod->name); + mod->name = newname; + } + } + + if (name == NULL && mod->name[0] == '/') + name = mod->name; + + /* If we don't have a file for it already, we can pre-install + the full file name from l_name. Opening the file by this + name will be the fallback when no build ID match is found. + XXX hook for sysroot */ + if (name != NULL + && mod->main.elf == NULL + && mod->main.name == NULL) + mod->main.name = strdup (name); + } + else if (name != NULL) + { + /* We have to find the file's phdrs to compute along with l_addr + what its runtime address boundaries are. */ + + // XXX hook for sysroot + mod = INTUSE(dwfl_report_elf) (dwfl, basename (name), + name, -1, l_addr); + } + + if (mod != NULL) + { + ++result; + + /* Move this module to the end of the list, so that we end + up with a list in the same order as the link_map chain. */ + if (mod->next != NULL) + { + if (*lastmodp != mod) + { + lastmodp = &dwfl->modulelist; + while (*lastmodp != mod) + lastmodp = &(*lastmodp)->next; + } + *lastmodp = mod->next; + mod->next = NULL; + while (*lastmodp != NULL) + lastmodp = &(*lastmodp)->next; + *lastmodp = mod; + } + + lastmodp = &mod->next; + } + } + + return release_buffer (result); +} + +static GElf_Addr +consider_executable (Dwfl_Module *mod, GElf_Addr at_phdr, GElf_Addr at_entry, + uint_fast8_t *elfclass, uint_fast8_t *elfdata, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg) +{ + GElf_Ehdr ehdr; + if (unlikely (gelf_getehdr (mod->main.elf, &ehdr) == NULL)) + return 0; + + if (at_entry != 0) + { + /* If we have an AT_ENTRY value, reject this executable if + its entry point address could not have supplied that. */ + + if (ehdr.e_entry == 0) + return 0; + + if (mod->e_type == ET_EXEC) + { + if (ehdr.e_entry != at_entry) + return 0; + } + else + { + /* It could be a PIE. */ + } + } + + // XXX this could be saved in the file cache: phdr vaddr, DT_DEBUG d_val vaddr + /* Find the vaddr of the DT_DEBUG's d_ptr. This is the memory + address where &r_debug was written at runtime. */ + GElf_Xword align = mod->dwfl->segment_align; + GElf_Addr d_val_vaddr = 0; + for (uint_fast16_t i = 0; i < ehdr.e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (mod->main.elf, i, &phdr_mem); + if (phdr == NULL) + break; + + if (phdr->p_align > 1 && (align == 0 || phdr->p_align < align)) + align = phdr->p_align; + + if (at_phdr != 0 + && phdr->p_type == PT_LOAD + && (phdr->p_offset & -align) == (ehdr.e_phoff & -align)) + { + /* This is the segment that would map the phdrs. + If we have an AT_PHDR value, reject this executable + if its phdr mapping could not have supplied that. */ + if (mod->e_type == ET_EXEC) + { + if (ehdr.e_phoff - phdr->p_offset + phdr->p_vaddr != at_phdr) + return 0; + } + else + { + /* It could be a PIE. If the AT_PHDR value and our + phdr address don't match modulo ALIGN, then this + could not have been the right PIE. */ + if (((ehdr.e_phoff - phdr->p_offset + phdr->p_vaddr) & -align) + != (at_phdr & -align)) + return 0; + + /* Calculate the bias applied to the PIE's p_vaddr values. */ + GElf_Addr bias = (at_phdr - (ehdr.e_phoff - phdr->p_offset + + phdr->p_vaddr)); + + /* Final sanity check: if we have an AT_ENTRY value, + reject this PIE unless its biased e_entry matches. */ + if (at_entry != 0 && at_entry != ehdr.e_entry + bias) + return 0; + + /* If we're changing the module's address range, + we've just invalidated the module lookup table. */ + if (bias != mod->main.bias) + { + mod->low_addr -= mod->main.bias; + mod->high_addr -= mod->main.bias; + mod->main.bias = bias; + mod->low_addr += bias; + mod->high_addr += bias; + + free (mod->dwfl->lookup_module); + mod->dwfl->lookup_module = NULL; + } + } + } + + if (phdr->p_type == PT_DYNAMIC) + { + Elf_Data *data = elf_getdata_rawchunk (mod->main.elf, phdr->p_offset, + phdr->p_filesz, ELF_T_DYN); + if (data == NULL) + continue; + const size_t entsize = gelf_fsize (mod->main.elf, + ELF_T_DYN, 1, EV_CURRENT); + const size_t n = data->d_size / entsize; + for (size_t j = 0; j < n; ++j) + { + GElf_Dyn dyn_mem; + GElf_Dyn *dyn = gelf_getdyn (data, j, &dyn_mem); + if (dyn != NULL && dyn->d_tag == DT_DEBUG) + { + d_val_vaddr = phdr->p_vaddr + entsize * j + entsize / 2; + break; + } + } + } + } + + if (d_val_vaddr != 0) + { + /* Now we have the final address from which to read &r_debug. */ + d_val_vaddr += mod->main.bias; + + void *buffer = NULL; + size_t buffer_available = addrsize (ehdr.e_ident[EI_CLASS]); + + Dwfl_Module *m; + int segndx = INTUSE(dwfl_addrsegment) (mod->dwfl, d_val_vaddr, &m); + assert (m == mod); + + if ((*memory_callback) (mod->dwfl, segndx, + &buffer, &buffer_available, + d_val_vaddr, buffer_available, + memory_callback_arg)) + { + const union + { + Elf32_Addr a32; + Elf64_Addr a64; + } *u = buffer; + + GElf_Addr vaddr; + if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) + vaddr = (ehdr.e_ident[EI_DATA] == ELFDATA2MSB + ? BE32 (u->a32) : LE32 (u->a32)); + else + vaddr = (ehdr.e_ident[EI_DATA] == ELFDATA2MSB + ? BE64 (u->a64) : LE64 (u->a64)); + + (*memory_callback) (mod->dwfl, -1, &buffer, &buffer_available, 0, 0, + memory_callback_arg); + + + if (*elfclass == ELFCLASSNONE) + *elfclass = ehdr.e_ident[EI_CLASS]; + else if (*elfclass != ehdr.e_ident[EI_CLASS]) + return 0; + + if (*elfdata == ELFDATANONE) + *elfdata = ehdr.e_ident[EI_DATA]; + else if (*elfdata != ehdr.e_ident[EI_DATA]) + return 0; + + return vaddr; + } + } + + return 0; +} + +/* Try to find an existing executable module with a DT_DEBUG. */ +static GElf_Addr +find_executable (Dwfl *dwfl, GElf_Addr at_phdr, GElf_Addr at_entry, + uint_fast8_t *elfclass, uint_fast8_t *elfdata, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg) +{ + for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; mod = mod->next) + if (mod->main.elf != NULL) + { + GElf_Addr r_debug_vaddr = consider_executable (mod, at_phdr, at_entry, + elfclass, elfdata, + memory_callback, + memory_callback_arg); + if (r_debug_vaddr != 0) + return r_debug_vaddr; + } + + return 0; +} + + +int +dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg) +{ + GElf_Addr r_debug_vaddr = 0; + + uint_fast8_t elfclass = ELFCLASSNONE; + uint_fast8_t elfdata = ELFDATANONE; + if (likely (auxv != NULL) + && likely (auxv_format_probe (auxv, auxv_size, &elfclass, &elfdata))) + { + GElf_Addr entry = 0; + GElf_Addr phdr = 0; + GElf_Xword phent = 0; + GElf_Xword phnum = 0; + +#define AUXV_SCAN(NN, BL) do \ + { \ + const Elf##NN##_auxv_t *av = auxv; \ + for (size_t i = 0; i < auxv_size / sizeof av[0]; ++i) \ + { \ + Elf##NN##_Addr val = BL##NN (av[i].a_un.a_val); \ + if (av[i].a_type == BL##NN (AT_ENTRY)) \ + entry = val; \ + else if (av[i].a_type == BL##NN (AT_PHDR)) \ + phdr = val; \ + else if (av[i].a_type == BL##NN (AT_PHNUM)) \ + phnum = val; \ + else if (av[i].a_type == BL##NN (AT_PHENT)) \ + phent = val; \ + else if (av[i].a_type == BL##NN (AT_PAGESZ)) \ + { \ + if (val > 1 \ + && (dwfl->segment_align == 0 \ + || val < dwfl->segment_align)) \ + dwfl->segment_align = val; \ + } \ + } \ + } \ + while (0) + + if (elfclass == ELFCLASS32) + { + if (elfdata == ELFDATA2MSB) + AUXV_SCAN (32, BE); + else + AUXV_SCAN (32, LE); + } + else + { + if (elfdata == ELFDATA2MSB) + AUXV_SCAN (64, BE); + else + AUXV_SCAN (64, LE); + } + + /* If we found the phdr dimensions, search phdrs for PT_DYNAMIC. */ + GElf_Addr dyn_vaddr = 0; + GElf_Xword dyn_filesz = 0; + if (phdr != 0 && phnum != 0) + { + Dwfl_Module *phdr_mod; + int phdr_segndx = INTUSE(dwfl_addrsegment) (dwfl, phdr, &phdr_mod); + Elf_Data in = + { + .d_type = ELF_T_PHDR, + .d_version = EV_CURRENT, + .d_size = phnum * phent, + .d_buf = NULL + }; + if ((*memory_callback) (dwfl, phdr_segndx, &in.d_buf, &in.d_size, + phdr, phnum * phent, memory_callback_arg)) + { + union + { + Elf32_Phdr p32; + Elf64_Phdr p64; + char data[phnum * phent]; + } buf; + Elf_Data out = + { + .d_type = ELF_T_PHDR, + .d_version = EV_CURRENT, + .d_size = phnum * phent, + .d_buf = &buf + }; + in.d_size = out.d_size; + if (likely ((elfclass == ELFCLASS32 + ? elf32_xlatetom : elf64_xlatetom) + (&out, &in, elfdata) != NULL)) + { + /* We are looking for PT_DYNAMIC. */ + const union + { + Elf32_Phdr p32[phnum]; + Elf64_Phdr p64[phnum]; + } *u = (void *) &buf; + if (elfclass == ELFCLASS32) + { + for (size_t i = 0; i < phnum; ++i) + if (u->p32[i].p_type == PT_DYNAMIC) + { + dyn_vaddr = u->p32[i].p_vaddr; + dyn_filesz = u->p32[i].p_filesz; + break; + } + } + else + { + for (size_t i = 0; i < phnum; ++i) + if (u->p64[i].p_type == PT_DYNAMIC) + { + dyn_vaddr = u->p64[i].p_vaddr; + dyn_filesz = u->p64[i].p_filesz; + break; + } + } + } + + (*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0, + memory_callback_arg); + } + else + /* We could not read the executable's phdrs from the + memory image. If we have a presupplied executable, + we can still use the AT_PHDR and AT_ENTRY values to + verify it, and to adjust its bias if it's a PIE. + + If there was an ET_EXEC module presupplied that contains + the AT_PHDR address, then we only consider that one. + We'll either accept it if its phdr location and e_entry + make sense or reject it if they don't. If there is no + presupplied ET_EXEC, then look for a presupplied module, + which might be a PIE (ET_DYN) that needs its bias adjusted. */ + r_debug_vaddr = ((phdr_mod == NULL + || phdr_mod->main.elf == NULL + || phdr_mod->e_type != ET_EXEC) + ? find_executable (dwfl, phdr, entry, + &elfclass, &elfdata, + memory_callback, + memory_callback_arg) + : consider_executable (phdr_mod, phdr, entry, + &elfclass, &elfdata, + memory_callback, + memory_callback_arg)); + } + + /* If we found PT_DYNAMIC, search it for DT_DEBUG. */ + if (dyn_filesz != 0) + { + Elf_Data in = + { + .d_type = ELF_T_DYN, + .d_version = EV_CURRENT, + .d_size = dyn_filesz, + .d_buf = NULL + }; + int dyn_segndx = dwfl_addrsegment (dwfl, dyn_vaddr, NULL); + if ((*memory_callback) (dwfl, dyn_segndx, &in.d_buf, &in.d_size, + dyn_vaddr, dyn_filesz, memory_callback_arg)) + { + union + { + Elf32_Dyn d32; + Elf64_Dyn d64; + char data[dyn_filesz]; + } buf; + Elf_Data out = + { + .d_type = ELF_T_DYN, + .d_version = EV_CURRENT, + .d_size = dyn_filesz, + .d_buf = &buf + }; + in.d_size = out.d_size; + if (likely ((elfclass == ELFCLASS32 + ? elf32_xlatetom : elf64_xlatetom) + (&out, &in, elfdata) != NULL)) + { + /* We are looking for PT_DYNAMIC. */ + const union + { + Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)]; + Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)]; + } *u = (void *) &buf; + if (elfclass == ELFCLASS32) + { + size_t n = dyn_filesz / sizeof (Elf32_Dyn); + for (size_t i = 0; i < n; ++i) + if (u->d32[i].d_tag == DT_DEBUG) + { + r_debug_vaddr = u->d32[i].d_un.d_val; + break; + } + } + else + { + size_t n = dyn_filesz / sizeof (Elf64_Dyn); + for (size_t i = 0; i < n; ++i) + if (u->d64[i].d_tag == DT_DEBUG) + { + r_debug_vaddr = u->d64[i].d_un.d_val; + break; + } + } + } + + (*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0, + memory_callback_arg); + } + } + } + else + /* We have to look for a presupplied executable file to determine + the vaddr of its dynamic section and DT_DEBUG therein. */ + r_debug_vaddr = find_executable (dwfl, 0, 0, &elfclass, &elfdata, + memory_callback, memory_callback_arg); + + if (r_debug_vaddr == 0) + return 0; + + /* For following pointers from struct link_map, we will use an + integrated memory access callback that can consult module text + elided from the core file. This is necessary when the l_name + pointer for the dynamic linker's own entry is a pointer into the + executable's .interp section. */ + struct integrated_memory_callback mcb = + { + .memory_callback = memory_callback, + .memory_callback_arg = memory_callback_arg + }; + + /* Now we can follow the dynamic linker's library list. */ + return report_r_debug (elfclass, elfdata, dwfl, r_debug_vaddr, + &integrated_memory_callback, &mcb); +} +INTDEF (dwfl_link_map_report) diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c new file mode 100644 index 00000000..5bbb384a --- /dev/null +++ b/libdwfl/linux-kernel-modules.c @@ -0,0 +1,856 @@ +/* Standard libdwfl callbacks for debugging the running Linux kernel. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* We include this before config.h because it can't handle _FILE_OFFSET_BITS. + Everything we need here is fine if its declarations just come first. */ + +#include <fts.h> + +#include <config.h> + +#include "libdwflP.h" +#include <inttypes.h> +#include <errno.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <string.h> +#include <stdlib.h> +#include <sys/utsname.h> +#include <fcntl.h> +#include <unistd.h> + + +#define KERNEL_MODNAME "kernel" + +#define MODULEDIRFMT "/lib/modules/%s" + +#define KNOTESFILE "/sys/kernel/notes" +#define MODNOTESFMT "/sys/module/%s/notes" +#define KSYMSFILE "/proc/kallsyms" +#define MODULELIST "/proc/modules" +#define SECADDRDIRFMT "/sys/module/%s/sections/" +#define MODULE_SECT_NAME_LEN 32 /* Minimum any linux/module.h has had. */ + + +/* Try to open the given file as it is or under the debuginfo directory. */ +static int +try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) +{ + if (*fname == NULL) + return -1; + + /* Don't bother trying *FNAME itself here if the path will cause it to be + tried because we give its own basename as DEBUGLINK_FILE. */ + int fd = ((((dwfl->callbacks->debuginfo_path + ? *dwfl->callbacks->debuginfo_path : NULL) + ?: DEFAULT_DEBUGINFO_PATH)[0] == ':') ? -1 + : TEMP_FAILURE_RETRY (open64 (*fname, O_RDONLY))); + if (fd < 0) + { + char *debugfname = NULL; + Dwfl_Module fakemod = { .dwfl = dwfl }; + /* First try the file's unadorned basename as DEBUGLINK_FILE, + to look for "vmlinux" files. */ + fd = INTUSE(dwfl_standard_find_debuginfo) (&fakemod, NULL, NULL, 0, + *fname, basename (*fname), 0, + &debugfname); + if (fd < 0 && try_debug) + /* Next, let the call use the default of basename + ".debug", + to look for "vmlinux.debug" files. */ + fd = INTUSE(dwfl_standard_find_debuginfo) (&fakemod, NULL, NULL, 0, + *fname, NULL, 0, + &debugfname); + free (*fname); + *fname = debugfname; + } + + return fd; +} + +static inline const char * +kernel_release (void) +{ + /* Cache the `uname -r` string we'll use. */ + static struct utsname utsname; + if (utsname.release[0] == '\0' && uname (&utsname) != 0) + return NULL; + return utsname.release; +} + +static int +find_kernel_elf (Dwfl *dwfl, const char *release, char **fname) +{ + if ((release[0] == '/' + ? asprintf (fname, "%s/vmlinux", release) + : asprintf (fname, "/boot/vmlinux-%s", release)) < 0) + return -1; + + int fd = try_kernel_name (dwfl, fname, true); + if (fd < 0 && release[0] != '/') + { + free (*fname); + if (asprintf (fname, MODULEDIRFMT "/vmlinux", release) < 0) + return -1; + fd = try_kernel_name (dwfl, fname, true); + } + + return fd; +} + +static int +get_release (Dwfl *dwfl, const char **release) +{ + if (dwfl == NULL) + return -1; + + const char *release_string = release == NULL ? NULL : *release; + if (release_string == NULL) + { + release_string = kernel_release (); + if (release_string == NULL) + return errno; + if (release != NULL) + *release = release_string; + } + + return 0; +} + +static int +report_kernel (Dwfl *dwfl, const char **release, + int (*predicate) (const char *module, const char *file)) +{ + int result = get_release (dwfl, release); + if (unlikely (result != 0)) + return result; + + char *fname; + int fd = find_kernel_elf (dwfl, *release, &fname); + + if (fd < 0) + result = ((predicate != NULL && !(*predicate) (KERNEL_MODNAME, NULL)) + ? 0 : errno ?: ENOENT); + else + { + bool report = true; + + if (predicate != NULL) + { + /* Let the predicate decide whether to use this one. */ + int want = (*predicate) (KERNEL_MODNAME, fname); + if (want < 0) + result = errno; + report = want > 0; + } + + if (report) + { + Dwfl_Module *mod = INTUSE(dwfl_report_elf) (dwfl, KERNEL_MODNAME, + fname, fd, 0); + if (mod == NULL) + result = -1; + else + /* The kernel is ET_EXEC, but always treat it as relocatable. */ + mod->e_type = ET_DYN; + } + + if (!report || result < 0) + close (fd); + } + + free (fname); + + return result; +} + +/* Look for a kernel debug archive. If we find one, report all its modules. + If not, return ENOENT. */ +static int +report_kernel_archive (Dwfl *dwfl, const char **release, + int (*predicate) (const char *module, const char *file)) +{ + int result = get_release (dwfl, release); + if (unlikely (result != 0)) + return result; + + char *archive; + if (unlikely ((*release)[0] == '/' + ? asprintf (&archive, "%s/debug.a", *release) + : asprintf (&archive, MODULEDIRFMT "/debug.a", *release)) < 0) + return ENOMEM; + + int fd = try_kernel_name (dwfl, &archive, false); + if (fd < 0) + result = errno ?: ENOENT; + else + { + /* We have the archive file open! */ + Dwfl_Module *last = __libdwfl_report_offline (dwfl, NULL, archive, fd, + true, predicate); + if (unlikely (last == NULL)) + result = -1; + else + { + /* Find the kernel and move it to the head of the list. */ + Dwfl_Module **tailp = &dwfl->modulelist, **prevp = tailp; + for (Dwfl_Module *m = *prevp; m != NULL; m = *(prevp = &m->next)) + if (!m->gc && m->e_type != ET_REL && !strcmp (m->name, "kernel")) + { + *prevp = m->next; + m->next = *tailp; + *tailp = m; + break; + } + } + } + + free (archive); + return result; +} + +/* Report a kernel and all its modules found on disk, for offline use. + If RELEASE starts with '/', it names a directory to look in; + if not, it names a directory to find under /lib/modules/; + if null, /lib/modules/`uname -r` is used. + Returns zero on success, -1 if dwfl_report_module failed, + or an errno code if finding the files on disk failed. */ +int +dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, + int (*predicate) (const char *module, + const char *file)) +{ + int result = report_kernel_archive (dwfl, &release, predicate); + if (result != ENOENT) + return result; + + /* First report the kernel. */ + result = report_kernel (dwfl, &release, predicate); + if (result == 0) + { + /* Do "find /lib/modules/RELEASE -name *.ko". */ + + char *modulesdir[] = { NULL, NULL }; + if (release[0] == '/') + modulesdir[0] = (char *) release; + else + { + if (asprintf (&modulesdir[0], MODULEDIRFMT, release) < 0) + return errno; + } + + FTS *fts = fts_open (modulesdir, FTS_NOSTAT | FTS_LOGICAL, NULL); + if (modulesdir[0] == (char *) release) + modulesdir[0] = NULL; + if (fts == NULL) + { + free (modulesdir[0]); + return errno; + } + + FTSENT *f; + while ((f = fts_read (fts)) != NULL) + { + switch (f->fts_info) + { + case FTS_F: + case FTS_SL: + case FTS_NSOK: + /* See if this file name matches "*.ko". */ + if (f->fts_namelen > 3 + && !memcmp (f->fts_name + f->fts_namelen - 3, ".ko", 4)) + { + /* We have a .ko file to report. Following the algorithm + by which the kernel makefiles set KBUILD_MODNAME, we + replace all ',' or '-' with '_' in the file name and + call that the module name. Modules could well be + built using different embedded names than their file + names. To handle that, we would have to look at the + __this_module.name contents in the module's text. */ + + char name[f->fts_namelen - 3 + 1]; + for (size_t i = 0; i < f->fts_namelen - 3U; ++i) + if (f->fts_name[i] == '-' || f->fts_name[i] == ',') + name[i] = '_'; + else + name[i] = f->fts_name[i]; + name[f->fts_namelen - 3] = '\0'; + + if (predicate != NULL) + { + /* Let the predicate decide whether to use this one. */ + int want = (*predicate) (name, f->fts_path); + if (want < 0) + { + result = -1; + break; + } + if (!want) + continue; + } + + if (dwfl_report_offline (dwfl, name, + f->fts_path, -1) == NULL) + { + result = -1; + break; + } + } + continue; + + case FTS_ERR: + case FTS_DNR: + case FTS_NS: + result = f->fts_errno; + break; + + case FTS_SLNONE: + default: + continue; + } + + /* We only get here in error cases. */ + break; + } + fts_close (fts); + free (modulesdir[0]); + } + + return result; +} +INTDEF (dwfl_linux_kernel_report_offline) + + +/* Grovel around to guess the bounds of the runtime kernel image. */ +static int +intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes) +{ + FILE *f = fopen (KSYMSFILE, "r"); + if (f == NULL) + return errno; + + (void) __fsetlocking (f, FSETLOCKING_BYCALLER); + + *notes = 0; + + char *line = NULL; + size_t linesz = 0; + size_t n = getline (&line, &linesz, f); + Dwarf_Addr first; + char *p = NULL; + int result = 0; + if (n > 0 && (first = strtoull (line, &p, 16)) > 0 && p > line) + { + Dwarf_Addr last = 0; + while ((n = getline (&line, &linesz, f)) > 1 && line[n - 2] != ']') + { + p = NULL; + last = strtoull (line, &p, 16); + if (p == NULL || p == line || last == 0) + { + result = -1; + break; + } + + if (*notes == 0) + { + const char *sym = (strsep (&p, " \t\n") + ? strsep (&p, " \t\n") : NULL); + if (sym != NULL && !strcmp (sym, "__start_notes")) + *notes = last; + } + } + if ((n == 0 && feof_unlocked (f)) || (n > 1 && line[n - 2] == ']')) + { + Dwarf_Addr round_kernel = sysconf (_SC_PAGE_SIZE); + first &= -(Dwarf_Addr) round_kernel; + last += round_kernel - 1; + last &= -(Dwarf_Addr) round_kernel; + *start = first; + *end = last; + result = 0; + } + } + free (line); + + if (result == -1) + result = ferror_unlocked (f) ? errno : ENOEXEC; + + fclose (f); + + return result; +} + + +/* Look for a build ID note in NOTESFILE and associate the ID with MOD. */ +static int +check_notes (Dwfl_Module *mod, const char *notesfile, + Dwarf_Addr vaddr, const char *secname) +{ + int fd = open64 (notesfile, O_RDONLY); + if (fd < 0) + return 1; + + assert (sizeof (Elf32_Nhdr) == sizeof (GElf_Nhdr)); + assert (sizeof (Elf64_Nhdr) == sizeof (GElf_Nhdr)); + union + { + GElf_Nhdr nhdr; + unsigned char data[8192]; + } buf; + + ssize_t n = read (fd, buf.data, sizeof buf); + close (fd); + + if (n <= 0) + return 1; + + unsigned char *p = buf.data; + while (p < &buf.data[n]) + { + /* No translation required since we are reading the native kernel. */ + GElf_Nhdr *nhdr = (void *) p; + p += sizeof *nhdr; + unsigned char *name = p; + p += (nhdr->n_namesz + 3) & -4U; + unsigned char *bits = p; + p += (nhdr->n_descsz + 3) & -4U; + + if (p <= &buf.data[n] + && nhdr->n_type == NT_GNU_BUILD_ID + && nhdr->n_namesz == sizeof "GNU" + && !memcmp (name, "GNU", sizeof "GNU")) + { + /* Found it. For a module we must figure out its VADDR now. */ + + if (secname != NULL + && (INTUSE(dwfl_linux_kernel_module_section_address) + (mod, NULL, mod->name, 0, secname, 0, NULL, &vaddr) != 0 + || vaddr == (GElf_Addr) -1l)) + vaddr = 0; + + if (vaddr != 0) + vaddr += bits - buf.data; + return INTUSE(dwfl_module_report_build_id) (mod, bits, + nhdr->n_descsz, vaddr); + } + } + + return 0; +} + +/* Look for a build ID for the kernel. */ +static int +check_kernel_notes (Dwfl_Module *kernelmod, GElf_Addr vaddr) +{ + return check_notes (kernelmod, KNOTESFILE, vaddr, NULL) < 0 ? -1 : 0; +} + +/* Look for a build ID for a loaded kernel module. */ +static int +check_module_notes (Dwfl_Module *mod) +{ + char *dirs[2] = { NULL, NULL }; + if (asprintf (&dirs[0], MODNOTESFMT, mod->name) < 0) + return ENOMEM; + + FTS *fts = fts_open (dirs, FTS_NOSTAT | FTS_LOGICAL, NULL); + if (fts == NULL) + { + free (dirs[0]); + return 0; + } + + int result = 0; + FTSENT *f; + while ((f = fts_read (fts)) != NULL) + { + switch (f->fts_info) + { + case FTS_F: + case FTS_SL: + case FTS_NSOK: + result = check_notes (mod, f->fts_accpath, 0, f->fts_name); + if (result > 0) /* Nothing found. */ + { + result = 0; + continue; + } + break; + + case FTS_ERR: + case FTS_DNR: + result = f->fts_errno; + break; + + case FTS_NS: + case FTS_SLNONE: + default: + continue; + } + + /* We only get here when finished or in error cases. */ + break; + } + fts_close (fts); + free (dirs[0]); + + return result; +} + +int +dwfl_linux_kernel_report_kernel (Dwfl *dwfl) +{ + Dwarf_Addr start; + Dwarf_Addr end; + inline Dwfl_Module *report (void) + { + return INTUSE(dwfl_report_module) (dwfl, KERNEL_MODNAME, start, end); + } + + /* This is a bit of a kludge. If we already reported the kernel, + don't bother figuring it out again--it never changes. */ + for (Dwfl_Module *m = dwfl->modulelist; m != NULL; m = m->next) + if (!strcmp (m->name, KERNEL_MODNAME)) + { + start = m->low_addr; + end = m->high_addr; + return report () == NULL ? -1 : 0; + } + + /* Try to figure out the bounds of the kernel image without + looking for any vmlinux file. */ + Dwarf_Addr notes; + /* The compiler cannot deduce that if intuit_kernel_bounds returns + zero NOTES will be initialized. Fake the initialization. */ + asm ("" : "=m" (notes)); + int result = intuit_kernel_bounds (&start, &end, ¬es); + if (result == 0) + { + Dwfl_Module *mod = report (); + return unlikely (mod == NULL) ? -1 : check_kernel_notes (mod, notes); + } + if (result != ENOENT) + return result; + + /* Find the ELF file for the running kernel and dwfl_report_elf it. */ + return report_kernel (dwfl, NULL, NULL); +} +INTDEF (dwfl_linux_kernel_report_kernel) + + +/* Dwfl_Callbacks.find_elf for the running Linux kernel and its modules. */ + +int +dwfl_linux_kernel_find_elf (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *module_name, + Dwarf_Addr base __attribute__ ((unused)), + char **file_name, Elf **elfp) +{ + if (mod->build_id_len > 0) + { + int fd = INTUSE(dwfl_build_id_find_elf) (mod, NULL, NULL, 0, + file_name, elfp); + if (fd >= 0 || errno != 0) + return fd; + } + + const char *release = kernel_release (); + if (release == NULL) + return errno; + + if (!strcmp (module_name, KERNEL_MODNAME)) + return find_kernel_elf (mod->dwfl, release, file_name); + + /* Do "find /lib/modules/`uname -r` -name MODULE_NAME.ko". */ + + char *modulesdir[] = { NULL, NULL }; + if (asprintf (&modulesdir[0], MODULEDIRFMT, release) < 0) + return -1; + + FTS *fts = fts_open (modulesdir, FTS_NOSTAT | FTS_LOGICAL, NULL); + if (fts == NULL) + { + free (modulesdir[0]); + return -1; + } + + size_t namelen = strlen (module_name); + + /* This is a kludge. There is no actual necessary relationship between + the name of the .ko file installed and the module name the kernel + knows it by when it's loaded. The kernel's only idea of the module + name comes from the name embedded in the object's magic + .gnu.linkonce.this_module section. + + In practice, these module names match the .ko file names except for + some using '_' and some using '-'. So our cheap kludge is to look for + two files when either a '_' or '-' appears in a module name, one using + only '_' and one only using '-'. */ + + char alternate_name[namelen + 1]; + inline bool subst_name (char from, char to) + { + const char *n = memchr (module_name, from, namelen); + if (n == NULL) + return false; + char *a = mempcpy (alternate_name, module_name, n - module_name); + *a++ = to; + ++n; + const char *p; + while ((p = memchr (n, from, namelen - (n - module_name))) != NULL) + { + a = mempcpy (a, n, p - n); + *a++ = to; + n = p + 1; + } + memcpy (a, n, namelen - (n - module_name) + 1); + return true; + } + if (!subst_name ('-', '_') && !subst_name ('_', '-')) + alternate_name[0] = '\0'; + + FTSENT *f; + int error = ENOENT; + while ((f = fts_read (fts)) != NULL) + { + error = ENOENT; + switch (f->fts_info) + { + case FTS_F: + case FTS_SL: + case FTS_NSOK: + /* See if this file name is "MODULE_NAME.ko". */ + if (f->fts_namelen == namelen + 3 + && !memcmp (f->fts_name + namelen, ".ko", 4) + && (!memcmp (f->fts_name, module_name, namelen) + || !memcmp (f->fts_name, alternate_name, namelen))) + { + int fd = open64 (f->fts_accpath, O_RDONLY); + *file_name = strdup (f->fts_path); + fts_close (fts); + free (modulesdir[0]); + if (fd < 0) + free (*file_name); + else if (*file_name == NULL) + { + close (fd); + fd = -1; + } + return fd; + } + break; + + case FTS_ERR: + case FTS_DNR: + case FTS_NS: + error = f->fts_errno; + break; + + case FTS_SLNONE: + default: + break; + } + } + + fts_close (fts); + free (modulesdir[0]); + errno = error; + return -1; +} +INTDEF (dwfl_linux_kernel_find_elf) + + +/* Dwfl_Callbacks.section_address for kernel modules in the running Linux. + We read the information from /sys/module directly. */ + +int +dwfl_linux_kernel_module_section_address +(Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *modname, Dwarf_Addr base __attribute__ ((unused)), + const char *secname, Elf32_Word shndx __attribute__ ((unused)), + const GElf_Shdr *shdr __attribute__ ((unused)), + Dwarf_Addr *addr) +{ + char *sysfile; + if (asprintf (&sysfile, SECADDRDIRFMT "%s", modname, secname) < 0) + return DWARF_CB_ABORT; + + FILE *f = fopen (sysfile, "r"); + free (sysfile); + + if (f == NULL) + { + if (errno == ENOENT) + { + /* The .modinfo and .data.percpu sections are never kept + loaded in the kernel. If the kernel was compiled without + CONFIG_MODULE_UNLOAD, the .exit.* sections are not + actually loaded at all. + + Setting *ADDR to -1 tells the caller this section is + actually absent from memory. */ + + if (!strcmp (secname, ".modinfo") + || !strcmp (secname, ".data.percpu") + || !strncmp (secname, ".exit", 5)) + { + *addr = (Dwarf_Addr) -1l; + return DWARF_CB_OK; + } + + /* The goofy PPC64 module_frob_arch_sections function tweaks + the section names as a way to control other kernel code's + behavior, and this cruft leaks out into the /sys information. + The file name for ".init*" may actually look like "_init*". */ + + const bool is_init = !strncmp (secname, ".init", 5); + if (is_init) + { + if (asprintf (&sysfile, SECADDRDIRFMT "_%s", + modname, &secname[1]) < 0) + return ENOMEM; + f = fopen (sysfile, "r"); + free (sysfile); + if (f != NULL) + goto ok; + } + + /* The kernel truncates section names to MODULE_SECT_NAME_LEN - 1. + In case that size increases in the future, look for longer + truncated names first. */ + size_t namelen = strlen (secname); + if (namelen >= MODULE_SECT_NAME_LEN) + { + int len = asprintf (&sysfile, SECADDRDIRFMT "%s", + modname, secname); + if (len < 0) + return DWARF_CB_ABORT; + char *end = sysfile + len; + do + { + *--end = '\0'; + f = fopen (sysfile, "r"); + if (is_init && f == NULL && errno == ENOENT) + { + sysfile[len - namelen] = '_'; + f = fopen (sysfile, "r"); + sysfile[len - namelen] = '.'; + } + } + while (f == NULL && errno == ENOENT + && end - &sysfile[len - namelen] >= MODULE_SECT_NAME_LEN); + free (sysfile); + + if (f != NULL) + goto ok; + } + } + + return DWARF_CB_ABORT; + } + + ok: + (void) __fsetlocking (f, FSETLOCKING_BYCALLER); + + int result = (fscanf (f, "%" PRIx64 "\n", addr) == 1 ? 0 + : ferror_unlocked (f) ? errno : ENOEXEC); + fclose (f); + + if (result == 0) + return DWARF_CB_OK; + + errno = result; + return DWARF_CB_ABORT; +} +INTDEF (dwfl_linux_kernel_module_section_address) + +int +dwfl_linux_kernel_report_modules (Dwfl *dwfl) +{ + FILE *f = fopen (MODULELIST, "r"); + if (f == NULL) + return errno; + + (void) __fsetlocking (f, FSETLOCKING_BYCALLER); + + int result = 0; + Dwarf_Addr modaddr; + unsigned long int modsz; + char modname[128]; + char *line = NULL; + size_t linesz = 0; + /* We can't just use fscanf here because it's not easy to distinguish \n + from other whitespace so as to take the optional word following the + address but always stop at the end of the line. */ + while (getline (&line, &linesz, f) > 0 + && sscanf (line, "%128s %lu %*s %*s %*s %" PRIx64 " %*s\n", + modname, &modsz, &modaddr) == 3) + { + Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, modname, + modaddr, modaddr + modsz); + if (mod == NULL) + { + result = -1; + break; + } + + result = check_module_notes (mod); + } + free (line); + + if (result == 0) + result = ferror_unlocked (f) ? errno : feof_unlocked (f) ? 0 : ENOEXEC; + + fclose (f); + + return result; +} +INTDEF (dwfl_linux_kernel_report_modules) diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c new file mode 100644 index 00000000..2206f63c --- /dev/null +++ b/libdwfl/linux-proc-maps.c @@ -0,0 +1,336 @@ +/* Standard libdwfl callbacks for debugging a live Linux process. + Copyright (C) 2005, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <inttypes.h> +#include <sys/types.h> +#include <errno.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdbool.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include <assert.h> +#include <endian.h> + + +#define PROCMAPSFMT "/proc/%d/maps" +#define PROCMEMFMT "/proc/%d/mem" +#define PROCAUXVFMT "/proc/%d/auxv" + + +/* Search /proc/PID/auxv for the AT_SYSINFO_EHDR tag. */ + +static int +find_sysinfo_ehdr (pid_t pid, GElf_Addr *sysinfo_ehdr) +{ + char *fname; + if (asprintf (&fname, PROCAUXVFMT, pid) < 0) + return ENOMEM; + + int fd = open64 (fname, O_RDONLY); + free (fname); + if (fd < 0) + return errno == ENOENT ? 0 : errno; + + ssize_t nread; + do + { + union + { + char buffer[sizeof (long int) * 2 * 64]; + Elf64_auxv_t a64[sizeof (long int) * 2 * 64 / sizeof (Elf64_auxv_t)]; + Elf32_auxv_t a32[sizeof (long int) * 2 * 32 / sizeof (Elf32_auxv_t)]; + } d; + nread = read (fd, &d, sizeof d); + if (nread > 0) + { + switch (sizeof (long int)) + { + case 4: + for (size_t i = 0; (char *) &d.a32[i] < &d.buffer[nread]; ++i) + if (d.a32[i].a_type == AT_SYSINFO_EHDR) + { + *sysinfo_ehdr = d.a32[i].a_un.a_val; + nread = 0; + break; + } + break; + case 8: + for (size_t i = 0; (char *) &d.a64[i] < &d.buffer[nread]; ++i) + if (d.a64[i].a_type == AT_SYSINFO_EHDR) + { + *sysinfo_ehdr = d.a64[i].a_un.a_val; + nread = 0; + break; + } + break; + default: + abort (); + break; + } + } + } + while (nread > 0); + + close (fd); + + return nread < 0 ? errno : 0; +} + +static int +proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid) +{ + unsigned int last_dmajor = -1, last_dminor = -1; + uint64_t last_ino = -1; + char *last_file = NULL; + Dwarf_Addr low = 0, high = 0; + + inline bool report (void) + { + if (last_file != NULL) + { + Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, last_file, + low, high); + free (last_file); + last_file = NULL; + if (unlikely (mod == NULL)) + return true; + } + return false; + } + + char *line = NULL; + size_t linesz; + ssize_t len; + while ((len = getline (&line, &linesz, f)) > 0) + { + if (line[len - 1] == '\n') + line[len - 1] = '\0'; + + Dwarf_Addr start, end, offset; + unsigned int dmajor, dminor; + uint64_t ino; + int nread = -1; + if (sscanf (line, "%" PRIx64 "-%" PRIx64 " %*s %" PRIx64 + " %x:%x %" PRIi64 " %n", + &start, &end, &offset, &dmajor, &dminor, &ino, &nread) < 6 + || nread <= 0) + { + free (line); + return ENOEXEC; + } + + /* If this is the special mapping AT_SYSINFO_EHDR pointed us at, + report the last one and then this special one. */ + if (start == sysinfo_ehdr && start != 0) + { + if (report ()) + { + bad_report: + free (line); + fclose (f); + return -1; + } + + low = start; + high = end; + if (asprintf (&last_file, "[vdso: %d]", (int) pid) < 0 + || report ()) + goto bad_report; + } + + char *file = line + nread + strspn (line + nread, " \t"); + if (file[0] == '\0' || (ino == 0 && dmajor == 0 && dminor == 0)) + /* This line doesn't indicate a file mapping. */ + continue; + + if (last_file != NULL + && ino == last_ino && dmajor == last_dmajor && dminor == last_dminor) + { + /* This is another portion of the same file's mapping. */ + assert (!strcmp (last_file, file)); + high = end; + } + else + { + /* This is a different file mapping. Report the last one. */ + if (report ()) + goto bad_report; + low = start; + high = end; + last_file = strdup (file); + last_ino = ino; + last_dmajor = dmajor; + last_dminor = dminor; + } + } + free (line); + + int result = ferror_unlocked (f) ? errno : feof_unlocked (f) ? 0 : ENOEXEC; + + /* Report the final one. */ + bool lose = report (); + + return result != 0 ? result : lose ? -1 : 0; +} + +int +dwfl_linux_proc_maps_report (Dwfl *dwfl, FILE *f) +{ + return proc_maps_report (dwfl, f, 0, 0); +} +INTDEF (dwfl_linux_proc_maps_report) + +int +dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid) +{ + if (dwfl == NULL) + return -1; + + /* We'll notice the AT_SYSINFO_EHDR address specially when we hit it. */ + GElf_Addr sysinfo_ehdr = 0; + int result = find_sysinfo_ehdr (pid, &sysinfo_ehdr); + if (result != 0) + return result; + + char *fname; + if (asprintf (&fname, PROCMAPSFMT, pid) < 0) + return ENOMEM; + + FILE *f = fopen (fname, "r"); + free (fname); + if (f == NULL) + return errno; + + (void) __fsetlocking (f, FSETLOCKING_BYCALLER); + + result = proc_maps_report (dwfl, f, sysinfo_ehdr, pid); + + fclose (f); + + return result; +} +INTDEF (dwfl_linux_proc_report) + +static ssize_t +read_proc_memory (void *arg, void *data, GElf_Addr address, + size_t minread, size_t maxread) +{ + const int fd = *(const int *) arg; + ssize_t nread = pread64 (fd, data, maxread, (off64_t) address); + /* Some kernels don't actually let us do this read, ignore those errors. */ + if (nread < 0 && (errno == EINVAL || errno == EPERM)) + return 0; + if (nread > 0 && (size_t) nread < minread) + nread = 0; + return nread; +} + +extern Elf *elf_from_remote_memory (GElf_Addr ehdr_vma, + GElf_Addr *loadbasep, + ssize_t (*read_memory) (void *arg, + void *data, + GElf_Addr address, + size_t minread, + size_t maxread), + void *arg); + + +/* Dwfl_Callbacks.find_elf */ + +int +dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *module_name, Dwarf_Addr base, + char **file_name, Elf **elfp) +{ + if (module_name[0] == '/') + { + int fd = open64 (module_name, O_RDONLY); + if (fd >= 0) + { + *file_name = strdup (module_name); + if (*file_name == NULL) + { + close (fd); + return ENOMEM; + } + } + return fd; + } + + int pid; + if (sscanf (module_name, "[vdso: %d]", &pid) == 1) + { + /* Special case for in-memory ELF image. */ + + char *fname; + if (asprintf (&fname, PROCMEMFMT, pid) < 0) + return -1; + + int fd = open64 (fname, O_RDONLY); + free (fname); + if (fd < 0) + return -1; + + *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, &fd); + + close (fd); + + *file_name = NULL; + return -1; + } + + abort (); + return -1; +} +INTDEF (dwfl_linux_proc_find_elf) diff --git a/libdwfl/offline.c b/libdwfl/offline.c new file mode 100644 index 00000000..ba8f47c8 --- /dev/null +++ b/libdwfl/offline.c @@ -0,0 +1,327 @@ +/* Recover relocatibility for addresses computed from debug information. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" +#include <fcntl.h> +#include <unistd.h> + +/* ANDROID_CHANGE_BEGIN */ +#include <AndroidFixup.h> +/* ANDROID_CHANGE_END */ + +/* Since dwfl_report_elf lays out the sections already, this will only be + called when the section headers of the debuginfo file are being + consulted instead, or for the section placed at 0. With binutils + strip-to-debug, the symbol table is in the debuginfo file and relocation + looks there. */ +int +dwfl_offline_section_address (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *modname __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + const char *secname __attribute__ ((unused)), + Elf32_Word shndx, + const GElf_Shdr *shdr __attribute__ ((unused)), + Dwarf_Addr *addr) +{ + assert (mod->e_type == ET_REL); + assert (shdr->sh_addr == 0); + assert (shdr->sh_flags & SHF_ALLOC); + + if (mod->debug.elf == NULL) + /* We are only here because sh_addr is zero even though layout is complete. + The first section in the first file under -e is placed at 0. */ + return 0; + + /* The section numbers might not match between the two files. + The best we can rely on is the order of SHF_ALLOC sections. */ + + Elf_Scn *ourscn = elf_getscn (mod->debug.elf, shndx); + Elf_Scn *scn = NULL; + uint_fast32_t skip_alloc = 0; + while ((scn = elf_nextscn (mod->debug.elf, scn)) != ourscn) + { + assert (scn != NULL); + GElf_Shdr shdr_mem; + GElf_Shdr *sh = gelf_getshdr (scn, &shdr_mem); + if (unlikely (sh == NULL)) + return -1; + if (sh->sh_flags & SHF_ALLOC) + ++skip_alloc; + } + + scn = NULL; + while ((scn = elf_nextscn (mod->main.elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *main_shdr = gelf_getshdr (scn, &shdr_mem); + if (unlikely (main_shdr == NULL)) + return -1; + if ((main_shdr->sh_flags & SHF_ALLOC) && skip_alloc-- == 0) + { + assert (main_shdr->sh_flags == shdr->sh_flags); + *addr = main_shdr->sh_addr; + return 0; + } + } + + /* This should never happen. */ + return -1; +} +INTDEF (dwfl_offline_section_address) + +/* Forward declarations. */ +static Dwfl_Module *process_elf (Dwfl *dwfl, const char *name, + const char *file_name, int fd, Elf *elf); +static Dwfl_Module *process_archive (Dwfl *dwfl, const char *name, + const char *file_name, int fd, Elf *elf, + int (*predicate) (const char *module, + const char *file)); + +/* Report one module for an ELF file, or many for an archive. + Always consumes ELF and FD. */ +static Dwfl_Module * +process_file (Dwfl *dwfl, const char *name, const char *file_name, int fd, + Elf *elf, int (*predicate) (const char *module, + const char *file)) +{ + switch (elf_kind (elf)) + { + default: + case ELF_K_NONE: + __libdwfl_seterrno (elf == NULL ? DWFL_E_LIBELF : DWFL_E_BADELF); + return NULL; + + case ELF_K_ELF: + return process_elf (dwfl, name, file_name, fd, elf); + + case ELF_K_AR: + return process_archive (dwfl, name, file_name, fd, elf, predicate); + } +} + +/* Report the open ELF file as a module. Always consumes ELF and FD. */ +static Dwfl_Module * +process_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, + Elf *elf) +{ + Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, fd, elf, + dwfl->offline_next_address); + if (mod != NULL) + { + /* If this is an ET_EXEC file with fixed addresses, the address range + it consumed may or may not intersect with the arbitrary range we + will use for relocatable modules. Make sure we always use a free + range for the offline allocations. If this module did use + offline_next_address, it may have rounded it up for the module's + alignment requirements. */ + if ((dwfl->offline_next_address >= mod->low_addr + || mod->low_addr - dwfl->offline_next_address < OFFLINE_REDZONE) + && dwfl->offline_next_address < mod->high_addr + OFFLINE_REDZONE) + dwfl->offline_next_address = mod->high_addr + OFFLINE_REDZONE; + + /* Don't keep the file descriptor around. */ + if (mod->main.fd != -1 && elf_cntl (mod->main.elf, ELF_C_FDREAD) == 0) + { + close (mod->main.fd); + mod->main.fd = -1; + } + } + + return mod; +} + +/* Always consumes MEMBER. Returns elf_next result on success. + For errors returns ELF_C_NULL with *MOD set to null. */ +static Elf_Cmd +process_archive_member (Dwfl *dwfl, const char *name, const char *file_name, + int (*predicate) (const char *module, const char *file), + int fd, Elf *member, Dwfl_Module **mod) +{ + const Elf_Arhdr *h = elf_getarhdr (member); + if (unlikely (h == NULL)) + { + __libdwfl_seterrno (DWFL_E_LIBELF); + fail: + elf_end (member); + *mod = NULL; + return ELF_C_NULL; + } + + if (!strcmp (h->ar_name, "/") || !strcmp (h->ar_name, "//")) + { + skip:; + /* Skip this and go to the next. */ + Elf_Cmd result = elf_next (member); + elf_end (member); + return result; + } + + char *member_name; + if (unlikely (asprintf (&member_name, "%s(%s)", file_name, h->ar_name) < 0)) + { + nomem: + __libdwfl_seterrno (DWFL_E_NOMEM); + elf_end (member); + *mod = NULL; + return ELF_C_NULL; + } + + char *module_name = NULL; + if (name == NULL || name[0] == '\0') + name = h->ar_name; + else if (unlikely (asprintf (&module_name, "%s:%s", name, h->ar_name) < 0)) + { + free (member_name); + goto nomem; + } + else + name = module_name; + + if (predicate != NULL) + { + /* Let the predicate decide whether to use this one. */ + int want = (*predicate) (name, member_name); + if (want <= 0) + { + free (member_name); + free (module_name); + if (unlikely (want < 0)) + { + __libdwfl_seterrno (DWFL_E_CB); + goto fail; + } + goto skip; + } + } + + /* We let __libdwfl_report_elf cache the fd in mod->main.fd, + though it's the same fd for all the members. + On module teardown we will close it only on the last Elf reference. */ + *mod = process_file (dwfl, name, member_name, fd, member, predicate); + free (member_name); + free (module_name); + + if (*mod == NULL) /* process_file called elf_end. */ + return ELF_C_NULL; + + /* Advance the archive-reading offset for the next iteration. */ + return elf_next (member); +} + +/* Report each member of the archive as its own module. */ +static Dwfl_Module * +process_archive (Dwfl *dwfl, const char *name, const char *file_name, int fd, + Elf *archive, + int (*predicate) (const char *module, const char *file)) + +{ + Dwfl_Module *mod = NULL; + Elf *member = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, archive); + if (unlikely (member == NULL)) /* Empty archive. */ + { + __libdwfl_seterrno (DWFL_E_BADELF); + return NULL; + } + + while (process_archive_member (dwfl, name, file_name, predicate, + fd, member, &mod) != ELF_C_NULL) + member = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, archive); + + /* We can drop the archive Elf handle even if we're still using members + in live modules. When the last module's elf_end on a member returns + zero, that module will close FD. If no modules survived the predicate, + we are all done with the file right here. */ + if (mod != NULL /* If no modules, caller will clean up. */ + && elf_end (archive) == 0) + close (fd); + + return mod; +} + +Dwfl_Module * +internal_function +__libdwfl_report_offline (Dwfl *dwfl, const char *name, + const char *file_name, int fd, bool closefd, + int (*predicate) (const char *module, + const char *file)) +{ + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + Dwfl_Module *mod = process_file (dwfl, name, file_name, fd, elf, predicate); + if (mod == NULL) + { + elf_end (elf); + if (closefd) + close (fd); + } + return mod; +} + +Dwfl_Module * +dwfl_report_offline (Dwfl *dwfl, const char *name, + const char *file_name, int fd) +{ + if (dwfl == NULL) + return NULL; + + bool closefd = false; + if (fd < 0) + { + closefd = true; + fd = open64 (file_name, O_RDONLY); + if (fd < 0) + { + __libdwfl_seterrno (DWFL_E_ERRNO); + return NULL; + } + } + + return __libdwfl_report_offline (dwfl, name, file_name, fd, closefd, NULL); +} +INTDEF (dwfl_report_offline) diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c new file mode 100644 index 00000000..abacc041 --- /dev/null +++ b/libdwfl/relocate.c @@ -0,0 +1,628 @@ +/* Relocate debug information. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +typedef uint8_t GElf_Byte; + +/* Adjust *VALUE to add the load address of the SHNDX section. + We update the section header in place to cache the result. */ + +Dwfl_Error +internal_function +__libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf, size_t *shstrndx, + Elf32_Word shndx, GElf_Addr *value) +{ + Elf_Scn *refscn = elf_getscn (elf, shndx); + GElf_Shdr refshdr_mem, *refshdr = gelf_getshdr (refscn, &refshdr_mem); + if (refshdr == NULL) + return DWFL_E_LIBELF; + + if (refshdr->sh_addr == 0 && (refshdr->sh_flags & SHF_ALLOC)) + { + /* This is a loaded section. Find its actual + address and update the section header. */ + + if (*shstrndx == SHN_UNDEF + && unlikely (elf_getshstrndx (elf, shstrndx) < 0)) + return DWFL_E_LIBELF; + + const char *name = elf_strptr (elf, *shstrndx, refshdr->sh_name); + if (unlikely (name == NULL)) + return DWFL_E_LIBELF; + + if ((*mod->dwfl->callbacks->section_address) (MODCB_ARGS (mod), + name, shndx, refshdr, + &refshdr->sh_addr)) + return CBFAIL; + + if (refshdr->sh_addr == (Dwarf_Addr) -1l) + /* The callback indicated this section wasn't really loaded but we + don't really care. */ + refshdr->sh_addr = 0; /* Make no adjustment below. */ + + /* Update the in-core file's section header to show the final + load address (or unloadedness). This serves as a cache, + so we won't get here again for the same section. */ + if (likely (refshdr->sh_addr != 0) + && unlikely (! gelf_update_shdr (refscn, refshdr))) + return DWFL_E_LIBELF; + } + + /* Apply the adjustment. */ + *value += refshdr->sh_addr; + return DWFL_E_NOERROR; +} + + +/* Cache used by relocate_getsym. */ +struct reloc_symtab_cache +{ + Elf *symelf; + Elf_Data *symdata; + Elf_Data *symxndxdata; + Elf_Data *symstrdata; + size_t symshstrndx; + size_t strtabndx; +}; +#define RELOC_SYMTAB_CACHE(cache) \ + struct reloc_symtab_cache cache = \ + { NULL, NULL, NULL, NULL, SHN_UNDEF, SHN_UNDEF } + +/* This is just doing dwfl_module_getsym, except that we must always use + the symbol table in RELOCATED itself when it has one, not MOD->symfile. */ +static Dwfl_Error +relocate_getsym (Dwfl_Module *mod, + Elf *relocated, struct reloc_symtab_cache *cache, + int symndx, GElf_Sym *sym, GElf_Word *shndx) +{ + if (cache->symdata == NULL) + { + if (mod->symfile == NULL || mod->symfile->elf != relocated) + { + /* We have to look up the symbol table in the file we are + relocating, if it has its own. These reloc sections refer to + the symbol table in this file, and a symbol table in the main + file might not match. However, some tools did produce ET_REL + .debug files with relocs but no symtab of their own. */ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (relocated, scn)) != NULL) + { + GElf_Shdr shdr_mem, *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL) + switch (shdr->sh_type) + { + default: + continue; + case SHT_SYMTAB: + cache->symelf = relocated; + cache->symdata = elf_getdata (scn, NULL); + cache->strtabndx = shdr->sh_link; + if (unlikely (cache->symdata == NULL)) + return DWFL_E_LIBELF; + break; + case SHT_SYMTAB_SHNDX: + cache->symxndxdata = elf_getdata (scn, NULL); + if (unlikely (cache->symxndxdata == NULL)) + return DWFL_E_LIBELF; + break; + } + if (cache->symdata != NULL && cache->symxndxdata != NULL) + break; + } + } + if (cache->symdata == NULL) + { + /* We might not have looked for a symbol table file yet, + when coming from __libdwfl_relocate_section. */ + if (unlikely (mod->symfile == NULL) + && unlikely (INTUSE(dwfl_module_getsymtab) (mod) < 0)) + return dwfl_errno (); + + /* The symbol table we have already cached is the one from + the file being relocated, so it's what we need. Or else + this is an ET_REL .debug file with no .symtab of its own; + the symbols refer to the section indices in the main file. */ + cache->symelf = mod->symfile->elf; + cache->symdata = mod->symdata; + cache->symxndxdata = mod->symxndxdata; + cache->symstrdata = mod->symstrdata; + } + } + + if (unlikely (gelf_getsymshndx (cache->symdata, cache->symxndxdata, + symndx, sym, shndx) == NULL)) + return DWFL_E_LIBELF; + + if (sym->st_shndx != SHN_XINDEX) + *shndx = sym->st_shndx; + + switch (*shndx) + { + case SHN_ABS: + case SHN_UNDEF: + case SHN_COMMON: + return DWFL_E_NOERROR; + } + + return __libdwfl_relocate_value (mod, cache->symelf, &cache->symshstrndx, + *shndx, &sym->st_value); +} + +/* Handle an undefined symbol. We really only support ET_REL for Linux + kernel modules, and offline archives. The behavior of the Linux module + loader is very simple and easy to mimic. It only matches magically + exported symbols, and we match any defined symbols. But we get the same + answer except when the module's symbols are undefined and would prevent + it from being loaded. */ +static Dwfl_Error +resolve_symbol (Dwfl_Module *referer, struct reloc_symtab_cache *symtab, + GElf_Sym *sym, GElf_Word shndx) +{ + /* First we need its name. */ + if (sym->st_name != 0) + { + if (symtab->symstrdata == NULL) + { + /* Cache the strtab for this symtab. */ + assert (referer->symfile == NULL + || referer->symfile->elf != symtab->symelf); + symtab->symstrdata = elf_getdata (elf_getscn (symtab->symelf, + symtab->strtabndx), + NULL); + if (unlikely (symtab->symstrdata == NULL)) + return DWFL_E_LIBELF; + } + if (unlikely (sym->st_name >= symtab->symstrdata->d_size)) + return DWFL_E_BADSTROFF; + + const char *name = symtab->symstrdata->d_buf; + name += sym->st_name; + + for (Dwfl_Module *m = referer->dwfl->modulelist; m != NULL; m = m->next) + if (m != referer) + { + /* Get this module's symtab. + If we got a fresh error reading the table, report it. + If we just have no symbols in this module, no harm done. */ + if (m->symdata == NULL + && m->symerr == DWFL_E_NOERROR + && INTUSE(dwfl_module_getsymtab) (m) < 0 + && m->symerr != DWFL_E_NO_SYMTAB) + return m->symerr; + + for (size_t ndx = 1; ndx < m->syments; ++ndx) + { + sym = gelf_getsymshndx (m->symdata, m->symxndxdata, + ndx, sym, &shndx); + if (unlikely (sym == NULL)) + return DWFL_E_LIBELF; + if (sym->st_shndx != SHN_XINDEX) + shndx = sym->st_shndx; + + /* We are looking for a defined global symbol with a name. */ + if (shndx == SHN_UNDEF || shndx == SHN_COMMON + || GELF_ST_BIND (sym->st_info) == STB_LOCAL + || sym->st_name == 0) + continue; + + /* Get this candidate symbol's name. */ + if (unlikely (sym->st_name >= m->symstrdata->d_size)) + return DWFL_E_BADSTROFF; + const char *n = m->symstrdata->d_buf; + n += sym->st_name; + + /* Does the name match? */ + if (strcmp (name, n)) + continue; + + /* We found it! */ + if (shndx == SHN_ABS) + return DWFL_E_NOERROR; + + /* In an ET_REL file, the symbol table values are relative + to the section, not to the module's load base. */ + size_t symshstrndx = SHN_UNDEF; + return __libdwfl_relocate_value (m, m->symfile->elf, + &symshstrndx, + shndx, &sym->st_value); + } + } + } + + return DWFL_E_RELUNDEF; +} + +static Dwfl_Error +relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, + size_t shstrndx, struct reloc_symtab_cache *reloc_symtab, + Elf_Scn *scn, GElf_Shdr *shdr, + Elf_Scn *tscn, bool debugscn, bool partial) +{ + /* First, fetch the name of the section these relocations apply to. */ + GElf_Shdr tshdr_mem; + GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem); + const char *tname = elf_strptr (relocated, shstrndx, tshdr->sh_name); + if (tname == NULL) + return DWFL_E_LIBELF; + + if (debugscn && ! ebl_debugscn_p (mod->ebl, tname)) + /* This relocation section is not for a debugging section. + Nothing to do here. */ + return DWFL_E_NOERROR; + + /* Fetch the section data that needs the relocations applied. */ + Elf_Data *tdata = elf_rawdata (tscn, NULL); + if (tdata == NULL) + return DWFL_E_LIBELF; + + /* Apply one relocation. Returns true for any invalid data. */ + Dwfl_Error relocate (GElf_Addr offset, const GElf_Sxword *addend, + int rtype, int symndx) + { + /* First see if this is a reloc we can handle. + If we are skipping it, don't bother resolving the symbol. */ + Elf_Type type = ebl_reloc_simple_type (mod->ebl, rtype); + if (unlikely (type == ELF_T_NUM)) + return DWFL_E_BADRELTYPE; + + /* First, resolve the symbol to an absolute value. */ + GElf_Addr value; + + if (symndx == STN_UNDEF) + /* When strip removes a section symbol referring to a + section moved into the debuginfo file, it replaces + that symbol index in relocs with STN_UNDEF. We + don't actually need the symbol, because those relocs + are always references relative to the nonallocated + debugging sections, which start at zero. */ + value = 0; + else + { + GElf_Sym sym; + GElf_Word shndx; + Dwfl_Error error = relocate_getsym (mod, relocated, reloc_symtab, + symndx, &sym, &shndx); + if (unlikely (error != DWFL_E_NOERROR)) + return error; + + if (shndx == SHN_UNDEF || shndx == SHN_COMMON) + { + /* Maybe we can figure it out anyway. */ + error = resolve_symbol (mod, reloc_symtab, &sym, shndx); + if (error != DWFL_E_NOERROR) + return error; + } + + value = sym.st_value; + } + + /* These are the types we can relocate. */ +#define TYPES DO_TYPE (BYTE, Byte); DO_TYPE (HALF, Half); \ + DO_TYPE (WORD, Word); DO_TYPE (SWORD, Sword); \ + DO_TYPE (XWORD, Xword); DO_TYPE (SXWORD, Sxword) + size_t size; + switch (type) + { +#define DO_TYPE(NAME, Name) \ + case ELF_T_##NAME: \ + size = sizeof (GElf_##Name); \ + break + TYPES; +#undef DO_TYPE + default: + return DWFL_E_BADRELTYPE; + } + + if (offset + size > tdata->d_size) + return DWFL_E_BADRELOFF; + +#define DO_TYPE(NAME, Name) GElf_##Name Name; + union { TYPES; } tmpbuf; +#undef DO_TYPE + Elf_Data tmpdata = + { + .d_type = type, + .d_buf = &tmpbuf, + .d_size = size, + .d_version = EV_CURRENT, + }; + Elf_Data rdata = + { + .d_type = type, + .d_buf = tdata->d_buf + offset, + .d_size = size, + .d_version = EV_CURRENT, + }; + + /* XXX check for overflow? */ + if (addend) + { + /* For the addend form, we have the value already. */ + value += *addend; + switch (type) + { +#define DO_TYPE(NAME, Name) \ + case ELF_T_##NAME: \ + tmpbuf.Name = value; \ + break + TYPES; +#undef DO_TYPE + default: + abort (); + } + } + else + { + /* Extract the original value and apply the reloc. */ + Elf_Data *d = gelf_xlatetom (relocated, &tmpdata, &rdata, + ehdr->e_ident[EI_DATA]); + if (d == NULL) + return DWFL_E_LIBELF; + assert (d == &tmpdata); + switch (type) + { +#define DO_TYPE(NAME, Name) \ + case ELF_T_##NAME: \ + tmpbuf.Name += (GElf_##Name) value; \ + break + TYPES; +#undef DO_TYPE + default: + abort (); + } + } + + /* Now convert the relocated datum back to the target + format. This will write into rdata.d_buf, which + points into the raw section data being relocated. */ + Elf_Data *s = gelf_xlatetof (relocated, &rdata, &tmpdata, + ehdr->e_ident[EI_DATA]); + if (s == NULL) + return DWFL_E_LIBELF; + assert (s == &rdata); + + /* We have applied this relocation! */ + return DWFL_E_NOERROR; + } + + /* Fetch the relocation section and apply each reloc in it. */ + Elf_Data *reldata = elf_getdata (scn, NULL); + if (reldata == NULL) + return DWFL_E_LIBELF; + + Dwfl_Error result = DWFL_E_NOERROR; + bool first_badreltype = true; + inline void check_badreltype (void) + { + if (first_badreltype) + { + first_badreltype = false; + if (ebl_get_elfmachine (mod->ebl) == EM_NONE) + /* This might be because ebl_openbackend failed to find + any libebl_CPU.so library. Diagnose that clearly. */ + result = DWFL_E_UNKNOWN_MACHINE; + } + } + + size_t nrels = shdr->sh_size / shdr->sh_entsize; + size_t complete = 0; + if (shdr->sh_type == SHT_REL) + for (size_t relidx = 0; !result && relidx < nrels; ++relidx) + { + GElf_Rel rel_mem, *r = gelf_getrel (reldata, relidx, &rel_mem); + if (r == NULL) + return DWFL_E_LIBELF; + result = relocate (r->r_offset, NULL, + GELF_R_TYPE (r->r_info), + GELF_R_SYM (r->r_info)); + check_badreltype (); + if (partial) + switch (result) + { + case DWFL_E_NOERROR: + /* We applied the relocation. Elide it. */ + memset (&rel_mem, 0, sizeof rel_mem); + gelf_update_rel (reldata, relidx, &rel_mem); + ++complete; + break; + case DWFL_E_BADRELTYPE: + case DWFL_E_RELUNDEF: + /* We couldn't handle this relocation. Skip it. */ + result = DWFL_E_NOERROR; + break; + default: + break; + } + } + else + for (size_t relidx = 0; !result && relidx < nrels; ++relidx) + { + GElf_Rela rela_mem, *r = gelf_getrela (reldata, relidx, + &rela_mem); + if (r == NULL) + return DWFL_E_LIBELF; + result = relocate (r->r_offset, &r->r_addend, + GELF_R_TYPE (r->r_info), + GELF_R_SYM (r->r_info)); + check_badreltype (); + if (partial) + switch (result) + { + case DWFL_E_NOERROR: + /* We applied the relocation. Elide it. */ + memset (&rela_mem, 0, sizeof rela_mem); + gelf_update_rela (reldata, relidx, &rela_mem); + ++complete; + break; + case DWFL_E_BADRELTYPE: + case DWFL_E_RELUNDEF: + /* We couldn't handle this relocation. Skip it. */ + result = DWFL_E_NOERROR; + break; + default: + break; + } + } + + if (likely (result == DWFL_E_NOERROR)) + { + if (!partial || complete == nrels) + /* Mark this relocation section as being empty now that we have + done its work. This affects unstrip -R, so e.g. it emits an + empty .rela.debug_info along with a .debug_info that has + already been fully relocated. */ + nrels = 0; + else if (complete != 0) + { + /* We handled some of the relocations but not all. + We've zeroed out the ones we processed. + Now remove them from the section. */ + + size_t next = 0; + if (shdr->sh_type == SHT_REL) + for (size_t relidx = 0; relidx < nrels; ++relidx) + { + GElf_Rel rel_mem; + GElf_Rel *r = gelf_getrel (reldata, relidx, &rel_mem); + if (r->r_info != 0 || r->r_offset != 0) + { + if (next != relidx) + gelf_update_rel (reldata, next, r); + ++next; + } + } + else + for (size_t relidx = 0; relidx < nrels; ++relidx) + { + GElf_Rela rela_mem; + GElf_Rela *r = gelf_getrela (reldata, relidx, &rela_mem); + if (r->r_info != 0 || r->r_offset != 0 || r->r_addend != 0) + { + if (next != relidx) + gelf_update_rela (reldata, next, r); + ++next; + } + } + nrels = next; + } + + shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize; + gelf_update_shdr (scn, shdr); + } + + return result; +} + +Dwfl_Error +internal_function +__libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile, bool debug) +{ + assert (mod->e_type == ET_REL); + + GElf_Ehdr ehdr_mem; + const GElf_Ehdr *ehdr = gelf_getehdr (debugfile, &ehdr_mem); + if (ehdr == NULL) + return DWFL_E_LIBELF; + + size_t d_shstrndx; + if (elf_getshstrndx (debugfile, &d_shstrndx) < 0) + return DWFL_E_LIBELF; + + RELOC_SYMTAB_CACHE (reloc_symtab); + + /* Look at each section in the debuginfo file, and process the + relocation sections for debugging sections. */ + Dwfl_Error result = DWFL_E_NOERROR; + Elf_Scn *scn = NULL; + while (result == DWFL_E_NOERROR + && (scn = elf_nextscn (debugfile, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if ((shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) + && shdr->sh_size != 0) + { + /* It's a relocation section. */ + + Elf_Scn *tscn = elf_getscn (debugfile, shdr->sh_info); + if (unlikely (tscn == NULL)) + result = DWFL_E_LIBELF; + else + result = relocate_section (mod, debugfile, ehdr, d_shstrndx, + &reloc_symtab, scn, shdr, tscn, + debug, !debug); + } + } + + return result; +} + +Dwfl_Error +internal_function +__libdwfl_relocate_section (Dwfl_Module *mod, Elf *relocated, + Elf_Scn *relocscn, Elf_Scn *tscn, bool partial) +{ + GElf_Ehdr ehdr_mem; + GElf_Shdr shdr_mem; + + RELOC_SYMTAB_CACHE (reloc_symtab); + + size_t shstrndx; + if (elf_getshstrndx (relocated, &shstrndx) < 0) + return DWFL_E_LIBELF; + + return (__libdwfl_module_getebl (mod) + ?: relocate_section (mod, relocated, + gelf_getehdr (relocated, &ehdr_mem), shstrndx, + &reloc_symtab, + relocscn, gelf_getshdr (relocscn, &shdr_mem), + tscn, false, partial)); +} diff --git a/libdwfl/segment.c b/libdwfl/segment.c new file mode 100644 index 00000000..cb520e64 --- /dev/null +++ b/libdwfl/segment.c @@ -0,0 +1,322 @@ +/* Manage address space lookup table for libdwfl. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "libdwflP.h" + +static GElf_Addr +segment_start (Dwfl *dwfl, GElf_Addr start) +{ + if (dwfl->segment_align > 1) + start &= -dwfl->segment_align; + return start; +} + +static GElf_Addr +segment_end (Dwfl *dwfl, GElf_Addr end) +{ + if (dwfl->segment_align > 1) + end = (end + dwfl->segment_align - 1) & -dwfl->segment_align; + return end; +} + +static bool +insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx) +{ + bool need_start = (i == 0 || dwfl->lookup_addr[i - 1] != start); + bool need_end = (i >= dwfl->lookup_elts || dwfl->lookup_addr[i + 1] != end); + size_t need = need_start + need_end; + if (need == 0) + return false; + + if (dwfl->lookup_alloc - dwfl->lookup_elts < need) + { + size_t n = dwfl->lookup_alloc == 0 ? 16 : dwfl->lookup_alloc * 2; + GElf_Addr *naddr = realloc (dwfl->lookup_addr, sizeof naddr[0] * n); + if (unlikely (naddr == NULL)) + return true; + int *nsegndx = realloc (dwfl->lookup_segndx, sizeof nsegndx[0] * n); + if (unlikely (nsegndx == NULL)) + { + if (naddr != dwfl->lookup_addr) + free (naddr); + return true; + } + dwfl->lookup_alloc = n; + dwfl->lookup_addr = naddr; + dwfl->lookup_segndx = nsegndx; + + if (dwfl->lookup_module != NULL) + { + /* Make sure this array is big enough too. */ + Dwfl_Module **old = dwfl->lookup_module; + dwfl->lookup_module = realloc (dwfl->lookup_module, + sizeof dwfl->lookup_module[0] * n); + if (unlikely (dwfl->lookup_module == NULL)) + { + free (old); + return true; + } + } + } + + if (unlikely (i < dwfl->lookup_elts)) + { + memcpy (&dwfl->lookup_addr[i + need], &dwfl->lookup_addr[i], + need * sizeof dwfl->lookup_addr[0]); + memcpy (&dwfl->lookup_segndx[i + need], &dwfl->lookup_segndx[i], + need * sizeof dwfl->lookup_segndx[0]); + if (dwfl->lookup_module != NULL) + memcpy (&dwfl->lookup_module[i + need], &dwfl->lookup_module[i], + need * sizeof dwfl->lookup_module[0]); + } + + if (need_start) + { + dwfl->lookup_addr[i] = start; + dwfl->lookup_segndx[i] = segndx; + ++i; + } + else + dwfl->lookup_segndx[i - 1] = segndx; + + if (need_end) + { + dwfl->lookup_addr[i] = end; + dwfl->lookup_segndx[i] = -1; + } + + dwfl->lookup_elts += need; + + return false; +} + +static int +lookup (Dwfl *dwfl, GElf_Addr address, int hint) +{ + if (hint >= 0 + && address >= dwfl->lookup_addr[hint] + && ((size_t) hint + 1 == dwfl->lookup_elts + || address <= dwfl->lookup_addr[hint + 1])) + return hint; + + /* Do binary search on the array indexed by module load address. */ + size_t l = 0, u = dwfl->lookup_elts; + while (l < u) + { + size_t idx = (l + u) / 2; + if (address < dwfl->lookup_addr[idx]) + u = idx; + else + { + l = idx + 1; + if (l == dwfl->lookup_elts || address < dwfl->lookup_addr[l]) + return idx; + } + } + + return -1; +} + +static bool +reify_segments (Dwfl *dwfl) +{ + int hint = -1; + for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; mod = mod->next) + if (! mod->gc) + { + const GElf_Addr start = segment_start (dwfl, mod->low_addr); + const GElf_Addr end = segment_end (dwfl, mod->high_addr); + + int idx = lookup (dwfl, start, hint); + if (unlikely (idx < 0)) + { + /* Module starts below any segment. Insert a low one. */ + if (unlikely (insert (dwfl, 0, start, end, -1))) + return true; + idx = 0; + } + else if (dwfl->lookup_addr[idx] > start) + { + /* The module starts in the middle of this segment. Split it. */ + if (unlikely (insert (dwfl, idx + 1, start, end, + dwfl->lookup_segndx[idx]))) + return true; + ++idx; + } + else if (dwfl->lookup_addr[idx] < start) + { + /* The module starts past the end of this segment. + Add a new one. */ + if (unlikely (insert (dwfl, idx + 1, start, end, -1))) + return true; + ++idx; + } + + if ((size_t) idx + 1 < dwfl->lookup_elts + && end < dwfl->lookup_addr[idx + 1] + /* The module ends in the middle of this segment. Split it. */ + && unlikely (insert (dwfl, idx + 1, + end, dwfl->lookup_addr[idx + 1], -1))) + return true; + + if (dwfl->lookup_module == NULL) + { + dwfl->lookup_module = calloc (dwfl->lookup_alloc, + sizeof dwfl->lookup_module[0]); + if (unlikely (dwfl->lookup_module == NULL)) + return true; + } + + /* Cache a backpointer in the module. */ + mod->segment = idx; + + /* Put MOD in the table for each segment that's inside it. */ + do + dwfl->lookup_module[idx++] = mod; + while ((size_t) idx < dwfl->lookup_elts + && dwfl->lookup_addr[idx] < end); + hint = (size_t) idx < dwfl->lookup_elts ? idx : -1; + } + + return false; +} + +int +dwfl_addrsegment (Dwfl *dwfl, Dwarf_Addr address, Dwfl_Module **mod) +{ + if (unlikely (dwfl == NULL)) + return -1; + + if (unlikely (dwfl->lookup_module == NULL) + && mod != NULL + && unlikely (reify_segments (dwfl))) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + + int idx = lookup (dwfl, address, -1); + if (likely (mod != NULL)) + { + if (unlikely (idx < 0) || unlikely (dwfl->lookup_module == NULL)) + *mod = NULL; + else + { + *mod = dwfl->lookup_module[idx]; + + /* If this segment does not have a module, but the address is + the upper boundary of the previous segment's module, use that. */ + if (*mod == NULL && idx > 0 && dwfl->lookup_addr[idx] == address) + { + *mod = dwfl->lookup_module[idx - 1]; + if (*mod != NULL && (*mod)->high_addr != address) + *mod = NULL; + } + } + } + + if (likely (idx >= 0)) + /* Translate internal segment table index to user segment index. */ + idx = dwfl->lookup_segndx[idx]; + + return idx; +} +INTDEF (dwfl_addrsegment) + +int +dwfl_report_segment (Dwfl *dwfl, int ndx, const GElf_Phdr *phdr, GElf_Addr bias, + const void *ident) +{ + if (dwfl == NULL) + return -1; + + if (ndx < 0) + ndx = dwfl->lookup_tail_ndx; + + if (phdr->p_align > 1 && (dwfl->segment_align <= 1 || + phdr->p_align < dwfl->segment_align)) + dwfl->segment_align = phdr->p_align; + + if (unlikely (dwfl->lookup_module != NULL)) + { + free (dwfl->lookup_module); + dwfl->lookup_module = NULL; + } + + GElf_Addr start = segment_start (dwfl, bias + phdr->p_vaddr); + GElf_Addr end = segment_end (dwfl, bias + phdr->p_vaddr + phdr->p_memsz); + + /* Coalesce into the last one if contiguous and matching. */ + if (ndx != dwfl->lookup_tail_ndx + || ident == NULL + || ident != dwfl->lookup_tail_ident + || start != dwfl->lookup_tail_vaddr + || phdr->p_offset != dwfl->lookup_tail_offset) + { + /* Normally just appending keeps us sorted. */ + + size_t i = dwfl->lookup_elts; + while (i > 0 && unlikely (start < dwfl->lookup_addr[i - 1])) + --i; + + if (unlikely (insert (dwfl, i, start, end, ndx))) + { + __libdwfl_seterrno (DWFL_E_NOMEM); + return -1; + } + } + + dwfl->lookup_tail_ident = ident; + dwfl->lookup_tail_vaddr = end; + dwfl->lookup_tail_offset = end - bias - phdr->p_vaddr + phdr->p_offset; + dwfl->lookup_tail_ndx = ndx + 1; + + return ndx; +} +INTDEF (dwfl_report_segment) diff --git a/libebl/ChangeLog b/libebl/ChangeLog index e749c226..51b3b705 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,700 @@ +2008-08-01 Roland McGrath <roland@redhat.com> + + * eblcorenotetypename.c: Handle NT_386_IOPERM. + +2008-07-28 Roland McGrath <roland@redhat.com> + + * eblauxvinfo.c (AUXV_TYPES): Add EXECFN. + + * eblauxvinfo.c (ebl_auxv_info): Handle missing elements of standard + table. + +2008-07-04 Roland McGrath <roland@redhat.com> + + * libebl.h: Declare ebl_syscall_abi. + * ebl_syscall_abi.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * ebl-hooks.h: New hook syscall_abi. + * eblopenbackend.c (default_syscall_abi): New function. + (fill_defaults): Use it. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * ebldynamictagname.c (ebl_dynamic_tag_name): Use hex for unknown tag. + + * ebl-hooks.h: Add check_special_section hook. + * eblopenbackend.c (fill_defaults): Set new hook to ... + (default_check_special_section): ... this, new function. + * ebl_check_special_section.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * libebl.h: Declare it. + +2008-02-20 Roland McGrath <roland@redhat.com> + + * libebl.h: Declare ebl_check_object_attribute. + * eblcheckobjattr.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * ebl-hooks.h: Add check_object_attribute hook. + * eblopenbackend.c (default_check_object_attribute): New function. + (fill_defaults): Initialize pointer to it. + +2008-02-19 Roland McGrath <roland@redhat.com> + + * eblsectiontypename.c (ebl_section_type_name): + Handle SHT_GNU_ATTRIBUTES. + +2008-02-08 Roland McGrath <roland@redhat.com> + + * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PPC_SPE. + +2008-01-30 Roland McGrath <roland@redhat.com> + + * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_386_TLS. + +2007-10-18 Roland McGrath <roland@redhat.com> + + * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PPC_VMX. + +2007-10-11 Roland McGrath <roland@redhat.com> + + * eblobjnote.c (ebl_object_note): Translate target format (byte-swap) + for NT_GNU_ABI_TAG contents. + +2007-08-22 Roland McGrath <roland@redhat.com> + + * libebl.h (Ebl_Core_Item): New member `group'. + +2007-08-19 Roland McGrath <roland@redhat.com> + + * ebl-hooks.h: Add new hook auxv_info. + * eblopenbackend.c (default_auxv_info): New function. + (fill_defaults): Initialize auxv_info hook. + * eblauxvinfo.c : New file. + * Makefile.am (gen_SOURCES): Add it. + * libebl.h: Declare ebl_auxv_info. + + * eblcorenote.c: Rewritten with new signature. + * Makefile.am (gen_SOURCES): Add it. + * libebl.h (Ebl_Register_Location, Ebl_Core_Item): New types. + (ebl_core_note_info): Completely revamp signature. + * ebl-hooks.h: Update decl. + * eblopenbackend.c (default_core_note): Update signature. + +2007-07-09 Roland McGrath <roland@redhat.com> + + * eblobjnotetypename.c (ebl_object_note_type_name): Handle + NT_GNU_HWCAP, NT_GNU_BUILD_ID. + + * eblobjnote.c (ebl_object_note): Handle NT_GNU_BUILD_ID. + +2007-04-22 Roland McGrath <roland@redhat.com> + + * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PRXFPREG. + +2007-03-10 Roland McGrath <roland@redhat.com> + + * eblcorenote.c (ebl_core_note): For normally-zero types, + print in hex if not zero. + +2007-01-11 Roland McGrath <roland@redhat.com> + + * ebl-hooks.h (machine_section_flag_check): New hook. + * libebl.h: Declare ebl_machine_section_flag_check. + * eblmachinesectionflagcheck.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * eblopenbackend.c (default_machine_section_flag_check): New function. + (fill_defaults): Use it. + +2006-09-04 Roland McGrath <roland@redhat.com> + + * ebl-hooks.h: Replace register_name hook with register_info. + Also yield natural bit width and base type encoding. + * eblopenbackend.c (default_register_name): Renamed + default_register_info, new args added. + (fill_defaults): Update initialization. + * eblregname.c: File renamed ... + * eblreginfo.c: ... to this. + (ebl_register_name): Renamed to ebl_register_info, new args added. + * libebl.h: Update decl. + + * Makefile.am (gen_SOURCES): Update list. + +2006-07-06 Ulrich Drepper <drepper@redhat.com> + + * ebldynamictagname.c: Add support for DT_GNU_HASH. + * ebldynamictagcheck.c: Likewise. + * eblsectiontypename.c: Add support for SHT_GNU_HASH. + +2006-07-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (gen_SOURCES): Add eblsysvhashentrysize.c. + * libeblP.h (struct ebl): Add sysvhash_entrysize element. + * eblopenbackend.c (fill_defaults): Initialize sysvhash_entrysize. + + * eblopenbackend.c (openbackend): If possible, fill machine, class, + and data values in from the ELF file. + +2006-07-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (gen_SOURCES): Add eblrelativerelocp.c. + * eblrelativerelocp.c: New file. + * ebl-hooks.c: Add relative_reloc_p. + * eblopenbackend.c (default_relative_reloc_p): New function. + (fill_defaults): Hook it up. + * libebl.h: Declare ebl_relative_reloc_p. + +2006-06-12 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (gen_SOURCES): Add eblnonerelocp.c. + * eblnonerelocp.c: New file. + * ebl-hooks.c: Add none_reloc_p. + * eblopenbackend.c (default_none_reloc_p): New function. + (fill_defaults): Hook it up. + * libebl.h: Declare ebl_none_reloc_p. + +2006-05-27 Ulrich Drepper <drepper@redhat.com> + + * libebl.h: Add extern "C". + +2005-11-25 Roland McGrath <roland@redhat.com> + + * eblregname.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * ebl-hooks.h: Declare register_name hook. + * libebl.h: Declare ebl_register_name. + * eblopenbackend.c (default_register_name): New function. + (fill_defaults): Use it. + +2005-11-16 Roland McGrath <roland@redhat.com> + + * libebl.h: Use "" for elf-knowledge.h, not <>. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * Makefile.am: Removed everything for building libebl_*.so modules, + now in ../backends/Makefile.am instead. + * alpha_init.c: Moved to ../backends. + * alpha_reloc.def: Likewise. + * alpha_retval.c: Likewise. + * alpha_symbol.c: Likewise. + * arm_init.c: Likewise. + * arm_reloc.def: Likewise. + * arm_symbol.c: Likewise. + * common-reloc.c: Likewise. + * i386_corenote.c: Likewise. + * i386_init.c: Likewise. + * i386_reloc.def: Likewise. + * i386_retval.c: Likewise. + * i386_symbol.c: Likewise. + * ia64_init.c: Likewise. + * ia64_reloc.def: Likewise. + * ia64_symbol.c: Likewise. + * libebl_CPU.h: Likewise. + * ppc64_init.c: Likewise. + * ppc64_reloc.def: Likewise. + * ppc64_retval.c: Likewise. + * ppc64_symbol.c: Likewise. + * ppc_init.c: Likewise. + * ppc_reloc.def: Likewise. + * ppc_retval.c: Likewise. + * ppc_symbol.c: Likewise. + * s390_init.c: Likewise. + * s390_reloc.def: Likewise. + * s390_symbol.c: Likewise. + * sh_init.c: Likewise. + * sh_reloc.def: Likewise. + * sh_symbol.c: Likewise. + * sparc_init.c: Likewise. + * sparc_reloc.def: Likewise. + * sparc_symbol.c: Likewise. + * x86_64_corenote.c: Likewise. + * x86_64_init.c: Likewise. + * x86_64_reloc.def: Likewise. + * x86_64_retval.c: Likewise. + * x86_64_symbol.c: Likewise. + + * libebl.h: Comment fixes. + + * alpha_retval.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize return_value_location hook. + + * ppc64_retval.c: New file. + * Makefile.am (ppc64_SRCS): Add it. + * ppc64_init.c (ppc64_init): Initialize return_value_location hook. + + * ppc_retval.c: New file. + * Makefile.am (ppc_SRCS): Add it. + * ppc_init.c (ppc_init): Initialize return_value_location hook. + +2005-11-14 Roland McGrath <roland@redhat.com> + + * ia64_init.c (ia64_init): Initialize EH->reloc_simple_type. + * sh_init.c (sh_init): Likewise. + * x86_64_init.c (x86_64_init): Likewise. + + * sparc_symbol.c (sparc_reloc_simple_type): New function. + * sparc_init.c (sparc_init): Use it. + + * arm_symbol.c (arm_reloc_simple_type): New function. + * arm_init.c (arm_init): Use it. + + * alpha_symbol.c (alpha_reloc_simple_type): New function. + * alpha_init.c (alpha_init): Use it. + + * ia64_reloc.def: Update bits per H. J. Lu <hjl@lucon.org>. + + * arm_reloc.def: Update bits per Daniel Jacobowitz <drow@false.org>. + + * alpha_reloc.def: Update bits per Richard Henderson <rth@redhat.com>. + +2005-11-13 Roland McGrath <roland@redhat.com> + + * x86_64_retval.c: New file. + * Makefile.am (x86_64_SRCS): Add it. + * x86_64_init.c (x86_64_init): Use x86_64_return_value_location. + + * i386_retval.c: New file. + * Makefile.am (i386_SRCS): Add it. + (libdw): New variable. + (libebl_%.so): Use $(libdw) in link; use --as-needed. + * i386_init.c (i386_init): Use i386_return_value_location. + + * eblretval.c: New file. + * Makefile.am (gen_SOURCES): Add it. + (INCLUDES): Search in libdw. + * libebl.h: Include <libdw.h>. Declare ebl_return_value_location. + * ebl-hooks.h: Declare return_value_location hook. + * eblopenbackend.c (default_return_value_location): New function. + (fill_defaults): Use it. + +2005-11-10 Roland McGrath <roland@redhat.com> + + * s390_init.c: New file. + * s390_reloc.def: New file. + * s390_symbol.c: New file. + * Makefile.am (modules, libebl_pic): Add s390. + (s390_SRCS, libebl_s390_pic_a_SOURCES): New variables. + (am_libebl_s390_pic_a_OBJECTS): New variable. + + * ppc64_init.c: Use common-reloc.c. + * ppc64_symbol.c (ppc64_backend_name): Removed. + (ppc64_reloc_type_check, ppc64_reloc_type_name): Likewise. + (ppc64_copy_reloc_p, ppc64_reloc_valid_use): Likewise. + + * ppc_init.c: Use common-reloc.c. + * ppc_symbol.c (ppc_backend_name): Removed. + (ppc_reloc_type_name, ppc_reloc_type_check): Likewise. + (ppc_reloc_valid_use, ppc_copy_reloc_p): Likewise. + + * sparc_init.c: Use common-reloc.c. + * sparc_symbol.c (sparc_backend_name): Removed. + (sparc_reloc_type_name, sparc_reloc_type_check): Likewise. + (sparc_copy_reloc_p): Likewise. + + * arm_init.c: Use common-reloc.c. + * arm_symbol.c (arm_backend_name): Removed. + (arm_reloc_type_name, arm_reloc_type_check, arm_copy_reloc_p): Removed. + + * alpha_init.c: Use common-reloc.c. + * alpha_symbol.c (alpha_backend_name): Removed. + (alpha_reloc_type_name, alpha_reloc_type_check): Likewise. + (alpha_copy_reloc_p): Likewise. + + * ia64_symbol.c (ia64_backend_name): Removed. + (ia64_reloc_type_name, ia64_reloc_type_check): Likewise. + (ia64_copy_reloc_p): Likewise. + + * x86_64_init.c: Use common-reloc.c. + * x86_64_symbol.c (x86_64_backend_name): Removed. + (x86_64_copy_reloc_p, x86_64_reloc_valid_use): Likewise. + (x86_64_reloc_type_check, x86_64_reloc_type_name): Likewise. + + * sh_init.c: Use common-reloc.c. + * sh_symbol.c: All functions removed. + (sh_reloc_simple_type): New function. + (sh_gotpc_reloc_check): New function. + + * common-reloc.c: New file. + * Makefile.am (noinst_HEADERS): Add it. + * i386_init.c: Include it. + + * sh_reloc.def: New file. + * i386_reloc.def: New file. + * alpha_reloc.def: New file. + * arm_reloc.def: New file. + * i386_reloc.def: New file. + * ia64_reloc.def: New file. + * ppc64_reloc.def: New file. + * ppc_reloc.def: New file. + * sh_reloc.def: New file. + * sparc_reloc.def: New file. + * x86_64_reloc.def: New file. + * Makefile.am (EXTRA_DIST): Add $(modules:=_reloc.def). + + * libebl_alpha.map: Removed. + * libebl_ia64.map: Removed. + * libebl_ppc.map: Removed. + * libebl_sparc.map: Removed. + * libebl_arm.map: Removed. + * libebl_i386.map: Removed. + * libebl_ppc64.map: Removed. + * libebl_sh.map: Removed. + * libebl_x86_64.map: Removed. + * Makefile.am (EXTRA_DIST): Remove them. + (libebl_%.map, libebl_%.so): New pattern rules. + + * libebl_alpha.h: Removed. + * libebl_ia64.h: Removed. + * libebl_ppc.h: Removed. + * libebl_sparc.h: Removed. + * libebl_arm.h: Removed. + * libebl_i386.h: Removed. + * libebl_ppc64.h: Removed. + * libebl_sh.h: Removed. + * libebl_x86_64.h: Removed. + * Makefile.am (noinst_HEADERS): Remove them. + + * x86_64_corenote.c: Use libebl_CPU.h instead. + * x86_64_symbol.c: Likewise. + * i386_corenote.c: Likewise. + +2005-11-09 Roland McGrath <roland@redhat.com> + + * ia64_symbol.c (ia64_reloc_simple_type): New function. + + * ebl-hooks.h (reloc_simple_type): Take the Ebl handle, not Elf handle. + * eblrelocsimpletype.c (ebl_reloc_simple_type): Update caller. + * eblopenbackend.c (default_reloc_simple_type): Update signature. + * i386_symbol.c (i386_reloc_simple_type): Likewise. + * ppc64_symbol.c (ppc64_reloc_simple_type): Likewise. + * ppc_symbol.c (ppc_reloc_simple_type): Likewise. + * x86_64_symbol.c (x86_64_reloc_simple_type): Likewise. + + * i386_symbol.c (i386_backend_name): Removed. + (i386_reloc_type_name, i386_reloc_type_check): Likewise. + (i386_reloc_valid_use): Removed. + (i386_copy_reloc_p): Removed. + + * alpha_destr.c: Removed. + * arm_destr.c: Removed. + * i386_destr.c: Removed. + * ia64_destr.c: Removed. + * ppc64_destr.c: Removed. + * ppc_destr.c: Removed. + * sh_destr.c: Removed. + * sparc_destr.c: Removed. + * x86_64_destr.c: Removed. + + * ebl-hooks.h: New file, broken out of ... + * libeblP.h (struct ebl): ... here. #include that for hook + declarations, after defining EBLHOOK macro. + * libebl_CPU.h: New file. + * Makefile.am (noinst_HEADERS): Add them. + + * libeblP.h (struct ebl): Use uint_fast16_t for machine, + and uint_fast8_t for class and data. + +2005-08-14 Roland McGrath <roland@redhat.com> + + * ia64_symbol.c (ia64_section_type_name): New function. + (ia64_dynamic_tag_check): New function. + (ia64_reloc_valid_use): New function. + * libebl_ia64.h: Declare them. + * ia64_init.c (ia64_init): Use them. + * Makefile.am (libebl_ia64.so): Link with libelf. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Use $(LINK) not $(CC) when creating DSOs. + +2005-08-13 Roland McGrath <roland@redhat.com> + + * ia64_symbol.c (ia64_machine_flag_check): New function. + * libebl_ia64.h: Declare it. + * ia64_init.c (ia64_init): Use it. + +2005-08-13 Ulrich Drepper <drepper@redhat.com> + + * libebl.h: Add ehdr parameter to ebl_bss_plt_p and + ebl_check_special_symbol. + * libeblP.h (struct ebl): Adjust callback functions. + * eblopenbackend.c: Adjust dummy functions. + * ebl_check_special_symbol.c: Add parameter and pass it on. + * eblbsspltp.c: Likewise. + * ppc_symbol.c (find_dyn_got): With ehdr passed, simplify search for + the dynamic section entry. + (ppc_check_special_symbol): Add ehdr parameter. + (ppc_bss_plt_p): Likewise. + * libebl_ppc.h: Adjust prototypes. + * ppc64_symbol.c (ppc_check_special_symbol): Add ehdr parameter. + (ppc_bss_plt_p): Likewise. + * libebl_ppc64.h: Adjust prototypes. + +2005-08-12 Roland McGrath <roland@redhat.com> + + * ppc_symbol.c (find_dyn_got): New function, broken out of ... + (ppc_bss_plt_p): ... here. Call that. + (ppc_check_special_symbol): Use find_dyn_got to fetch value to check + against _GLOBAL_OFFSET_TABLE_. + + * libeblP.h (struct ebl): Add bss_plt_p hook. + * eblopenbackend.c (default_bss_plt_p): New function. + (fill_defaults): Use it. + * eblbsspltp.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * libebl.h: Declare ebl_bss_plt_p. + * ppc_symbol.c (ppc_bss_plt_p): New function. + * libebl_ppc.h: Declare it. + * ppc_init.c (ppc_init): Use it. + * ppc64_symbol.c (ppc64_bss_plt_p): New function. + * libebl_ppc64.h: Declare it. + * ppc64_init.c (ppc64_init): Use it. + + * ebl_check_special_symbol.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * libebl.h: Declare ebl_check_special_symbol. + * libeblP.h (struct ebl): Add check_special_symbol hook. + * eblopenbackend.c (default_check_special_symbol): New function. + (fill_defaults): Use it. + * ppc_symbol.c (ppc_check_special_symbol): New function. + * libebl_ppc.h: Add prototype. + * ppc_init.c (ppc_init): Use it. + * ppc64_symbol.c (ppc64_check_special_symbol): New function. + * libebl_ppc64.h: Add prototype. + * ppc64_init.c (ppc64_init): Use it. + +2005-08-07 Ulrich Drepper <drepper@redhat.com> + + * ppc_init.c: Add support for new DT_PPC_* and R_PPC_* values. + * ppc_symbol.c: Likewise. + * libebl_ppc.h: Likewise. + * ppc64_init.c: There is now also a dynamic_tag_check functions + * ppc64_symbol.c: Add dynamic_tag_check. + * libebl_ppc64.h: Add prototype. + * alpha_init.c: Add support for new DT_ALPHA_* value. + * alpha_symbol.c: Likewise. + * libebl_alpha.h: Likewise. + +2005-08-03 Ulrich Drepper <drepper@redhat.com> + + * libebl_alpha.map: Remove unnecessary exports. + * libebl_arm.map: Likewise. + * libebl_i386.map: Likewise. + * libebl_ia64.map: Likewise. + * libebl_ppc.map: Likewise. + * libebl_ppc64.map: Likewise. + * libebl_sh.map: Likewise. + * libebl_sparc.map: Likewise. + * libebl_x86_64.map: Likewise. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libebl_a_SOURCES): Add eblelfclass.c, eblelfdata.c, + and eblelfmachine.c. + * elbopenbackend.c (machines): Add class and data fields. Initialize + them. + (ebl_openbackend): Initialize machine, class, data fields in result. + * libebl.h: Declare Add eblelfclass, eblelfdata, and eblelfmachine. + * libeblP.h (Ebl): Add machine, class, data fields. + +2005-07-23 Ulrich Drepper <drepper@redhat.com> + + * eblsectionstripp.c: New file. + * Makefile.am (gen_SOURCES): Add eblsectionstripp.c. + * i386_init.c (i386_init): Install specific debugscn_p callback. + * i386_symbol.c (i386_debugscn_p): New function. + * libebl.h: Declare ebl_section_strip_p. + * libebl_i386.h: Declare i386_debugscn_p. + + * libebl.h: Move Ebl definition to... + * libeblP.h: ...here. + +2005-07-21 Roland McGrath <roland@redhat.com> + + * Makefile.am (install-ebl-modules): New target, commands from ... + (install): ... here. Make this depend on it. + (LIBEBL_SUBDIR): New variable, substituted by configure. + (install-ebl-modules): Install in $(libdir)/$(LIBEBL_SUBDIR). + * eblopenbackend.c (openbackend): Use LIBEBL_SUBDIR in module name. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * eblcopyrelocp.c: New file. + * Makefile.am (gen_SOURCES): Add eblcopyrelocp.c. + * libebl.h: Declare ebl_copy_reloc_p. + * eblopenbackend.c (fill_defaults): Fill in copy_reloc_p. + (default_copy_reloc_p): New function. + * alpha_init.c: Define and use arch-specific copy_reloc_p function. + * alpha_symbol.c: Likewise. + * arm_init.c: Likewise. + * arm_symbol.c: Likewise. + * i386_init.c: Likewise. + * i386_symbol.c: Likewise. + * ia64_init.c: Likewise. + * ia64_symbol.c: Likewise. + * ppc64_init.c: Likewise. + * ppc64_symbol.c: Likewise. + * ppc_init.c: Likewise. + * ppc_symbol.c: Likewise. + * sh_init.c: Likewise. + * sh_symbol.c: Likewise. + * sparc_init.c: Likewise. + * sparc_symbol.c: Likewise. + * x86_64_init.c: Likewise. + * x86_64_symbol.c: Likewise. + * libebl_alpha.h: Declare the copy_reloc_p function. + * libebl_arm.h: Likewise. + * libebl_i386.h: Likewise. + * libebl_ia64.h: Likewise. + * libebl_ppc.h: Likewise. + * libebl_ppc64.h: Likewise. + * libebl_sh.h: Likewise. + * libebl_sparc.h: Likewise. + * libebl_x86_64.h: Likewise. + +2005-05-31 Roland McGrath <roland@redhat.com> + + * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency + tracking works right. + +2005-05-21 Ulrich Drepper <drepper@redhat.com> + + * libebl_x86_64.map: Add x86_64_core_note. + +2005-05-19 Roland McGrath <roland@redhat.com> + + * libebl_i386.map: Add i386_reloc_valid_use, i386_reloc_simple_type. + * libebl_ppc.map: Add ppc_reloc_simple_type. + * libebl_ppc64.map: Add ppc64_reloc_simple_type. + * libebl_x86_64.map: Add x86_64_reloc_simple_type. + +2005-05-11 Ulrich Drepper <drepper@redhat.com> + + * eblcorenote.c: Handle new AT_* values and files with different + endianess. + * Makefile.am (x86_64_SRCS): Add x86_64_corenote.c. + * x86-64_corenote.c: New file. + * x86_64_init.c: Hook in x86_64_corenote. + * i386_corenote.c: Make file usable on 64-bit platforms. + + * eblopenbackend.c: If modules version comparison fails, reinitialize + hooks. + +2005-05-10 Ulrich Drepper <drepper@redhat.com> + + * eblopenbackend.c: Require the init function to return a string. + Compare it with MODVERSION from config.h. + * alpha_init.c: Change return type. Return MODVERSION or NULL. + * arm_init.c: Likewise. + * eblopenbackend.c: Likewise. + * i386_init.c: Likewise. + * ia64_init.c: Likewise. + * ppc64_init.c: Likewise. + * ppc_init.c: Likewise. + * sh_init.c: Likewise. + * sparc_init.c: Likewise. + * x86_64_init.c: Likewise. + * libeblP.h: Adjust ebl_bhinit_t. + * libebl_alpha.h: Adjust init function prototype. + * libebl_arm.h: Likewise. + * libebl_i386.h: Likewise. + * libebl_ia64.h: Likewise. + * libebl_ppc.h: Likewise. + * libebl_ppc64.h: Likewise. + * libebl_sh.h: Likewise. + * libebl_sparc.h: Likewise. + * libebl_x86_64.h: Likewise. + + * mips_destr.c: Removed. + * mips_init.c: Removed. + * mips_symbol.c: Removed. + * libebl_mips.h: Removed. + * libebl_mips.map: Removed. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * libebl.h (Ebl): Add `reloc_simple_type' member. + * eblopenbackend.c (default_reloc_simple_type): New function. + (openbackend): Use that as default reloc_simple_type callback. + * eblrelocsimpletype.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * i386_symbol.c (i386_reloc_simple_type): New function. + * libebl_i386.h: Declare it. + * i386_init.c (i386_init): Use it. + * x86_64_symbol.c (x86_64_reloc_simple_type): New function. + * libebl_x86_64.h: Declare it. + * x86_64_init.c (x86_64_init): Use it. + * ppc_symbol.c (ppc_reloc_simple_type): New function. + * libebl_ppc.h: Declare it. + * ppc_init.c (ppc_init): Use it. + * ppc64_symbol.c (ppc64_reloc_simple_type): New function. + * libebl_ppc64.h: Declare it. + * ppc64_init.c (ppc64_init): Use it. + +2005-03-17 Ulrich Drepper <drepper@redhat.com> + + * eblcorenote.c (ebl_core_note): Add support for AT_SECURE. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (AM_CFLAGS): Add -Wformat=2. + +2005-02-14 Ulrich Drepper <drepper@redhat.com> + + * alpha_destr.c: Add __attribute__((unused)) where needed. + * alpha_init.c: Likewise. + * alpha_symbol.c: Likewise. + * arm_destr.c: Likewise. + * arm_init.c: Likewise. + * arm_symbol.c: Likewise. + * i386_corenote.c: Likewise. + * i386_destr.c: Likewise. + * i386_init.c: Likewise. + * i386_symbol.c: Likewise. + * ia64_destr.c: Likewise. + * ia64_init.c: Likewise. + * ia64_symbol.c: Likewise. + * mips_destr.c: Likewise. + * mips_init.c: Likewise. + * mips_symbol.c: Likewise. + * ppc64_destr.c: Likewise. + * ppc64_init.c: Likewise. + * ppc64_symbol.c: Likewise. + * ppc_destr.c: Likewise. + * ppc_init.c: Likewise. + * ppc_symbol.c: Likewise. + * sh_destr.c: Likewise. + * sh_init.c: Likewise. + * sh_symbol.c: Likewise. + * sparc_destr.c: Likewise. + * sparc_init.c: Likewise. + * sparc_symbol.c: Likewise. + * x86_64_destr.c: Likewise. + * x86_64_init.c: Likewise. + * x86_64_symbol.c: Likewise. + + * x86_64_symbol.c (reloc_map_table): Fix entries for R_X86_64_64 + and R_X86_64_32.. + +2005-02-06 Ulrich Drepper <drepper@redhat.com> + + * eblstrtab.c: A few cleanups. + + * eblopenbackend.c: Mark unused parameters. + + * eblgstrtab.c: Cleanups a few printf format strings. + + * Makefile.am: Cleanup AM_CFLAGS handling. Add -Wunused -Wextra. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Check for text relocations in constructed DSOs. + + * eblstrtab.c: Minor cleanups. + + * Makefile.am (AM_CFLAGS): Add -std=gnu99 and -fmudflap for MUDFLAP. + 2004-08-16 Ulrich Drepper <drepper@redhat.com> * Makefile.am (AM_CFLAGS): Add LIBSTR definition with base name of diff --git a/libebl/Makefile b/libebl/Makefile deleted file mode 100644 index a425eb04..00000000 --- a/libebl/Makefile +++ /dev/null @@ -1,787 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# libebl/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - - -SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) $(libebl_x86_64_so_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -noinst_PROGRAMS = $(am__EXEEXT_1) -subdir = libebl -DIST_COMMON = $(euinclude_HEADERS) $(noinst_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" -libLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libebl_a_AR = $(AR) $(ARFLAGS) -libebl_a_LIBADD = -am__objects_1 = eblopenbackend.$(OBJEXT) eblclosebackend.$(OBJEXT) \ - eblstrtab.$(OBJEXT) eblreloctypename.$(OBJEXT) \ - eblsegmenttypename.$(OBJEXT) eblsectiontypename.$(OBJEXT) \ - eblmachineflagname.$(OBJEXT) eblsymboltypename.$(OBJEXT) \ - ebldynamictagname.$(OBJEXT) eblsectionname.$(OBJEXT) \ - eblobjecttypename.$(OBJEXT) eblsymbolbindingname.$(OBJEXT) \ - eblbackendname.$(OBJEXT) eblshflagscombine.$(OBJEXT) \ - eblwstrtab.$(OBJEXT) eblgstrtab.$(OBJEXT) \ - eblosabiname.$(OBJEXT) eblmachineflagcheck.$(OBJEXT) \ - eblreloctypecheck.$(OBJEXT) eblrelocvaliduse.$(OBJEXT) \ - ebldynamictagcheck.$(OBJEXT) eblcorenotetypename.$(OBJEXT) \ - eblobjnotetypename.$(OBJEXT) eblcorenote.$(OBJEXT) \ - eblobjnote.$(OBJEXT) ebldebugscnp.$(OBJEXT) \ - eblgotpcreloccheck.$(OBJEXT) -am_libebl_a_OBJECTS = $(am__objects_1) -libebl_a_OBJECTS = $(am_libebl_a_OBJECTS) -libebl_alpha_pic_a_AR = $(AR) $(ARFLAGS) -libebl_alpha_pic_a_LIBADD = -libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) -libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) -libebl_arm_pic_a_LIBADD = -libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) -libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) -libebl_i386_pic_a_LIBADD = -libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS) -libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ia64_pic_a_LIBADD = -libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS) -libebl_mips_pic_a_AR = $(AR) $(ARFLAGS) -libebl_mips_pic_a_LIBADD = -libebl_mips_pic_a_OBJECTS = $(am_libebl_mips_pic_a_OBJECTS) -libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ppc64_pic_a_LIBADD = -libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) -libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ppc_pic_a_LIBADD = -libebl_ppc_pic_a_OBJECTS = $(am_libebl_ppc_pic_a_OBJECTS) -libebl_sh_pic_a_AR = $(AR) $(ARFLAGS) -libebl_sh_pic_a_LIBADD = -libebl_sh_pic_a_OBJECTS = $(am_libebl_sh_pic_a_OBJECTS) -libebl_sparc_pic_a_AR = $(AR) $(ARFLAGS) -libebl_sparc_pic_a_LIBADD = -libebl_sparc_pic_a_OBJECTS = $(am_libebl_sparc_pic_a_OBJECTS) -libebl_x86_64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_x86_64_pic_a_LIBADD = -libebl_x86_64_pic_a_OBJECTS = $(am_libebl_x86_64_pic_a_OBJECTS) -am__EXEEXT_1 = libebl_i386.so$(EXEEXT) libebl_sh.so$(EXEEXT) \ - libebl_mips.so$(EXEEXT) libebl_x86_64.so$(EXEEXT) \ - libebl_ia64.so$(EXEEXT) libebl_alpha.so$(EXEEXT) \ - libebl_arm.so$(EXEEXT) libebl_sparc.so$(EXEEXT) \ - libebl_ppc.so$(EXEEXT) libebl_ppc64.so$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am_libebl_alpha_so_OBJECTS = -libebl_alpha_so_OBJECTS = $(am_libebl_alpha_so_OBJECTS) -libebl_alpha_so_LDADD = $(LDADD) -am_libebl_arm_so_OBJECTS = -libebl_arm_so_OBJECTS = $(am_libebl_arm_so_OBJECTS) -libebl_arm_so_LDADD = $(LDADD) -am_libebl_i386_so_OBJECTS = -libebl_i386_so_OBJECTS = $(am_libebl_i386_so_OBJECTS) -libebl_i386_so_LDADD = $(LDADD) -am_libebl_ia64_so_OBJECTS = -libebl_ia64_so_OBJECTS = $(am_libebl_ia64_so_OBJECTS) -libebl_ia64_so_LDADD = $(LDADD) -am_libebl_mips_so_OBJECTS = -libebl_mips_so_OBJECTS = $(am_libebl_mips_so_OBJECTS) -libebl_mips_so_LDADD = $(LDADD) -am_libebl_ppc_so_OBJECTS = -libebl_ppc_so_OBJECTS = $(am_libebl_ppc_so_OBJECTS) -libebl_ppc_so_LDADD = $(LDADD) -am_libebl_ppc64_so_OBJECTS = -libebl_ppc64_so_OBJECTS = $(am_libebl_ppc64_so_OBJECTS) -libebl_ppc64_so_LDADD = $(LDADD) -am_libebl_sh_so_OBJECTS = -libebl_sh_so_OBJECTS = $(am_libebl_sh_so_OBJECTS) -libebl_sh_so_LDADD = $(LDADD) -am_libebl_sparc_so_OBJECTS = -libebl_sparc_so_OBJECTS = $(am_libebl_sparc_so_OBJECTS) -libebl_sparc_so_LDADD = $(LDADD) -am_libebl_x86_64_so_OBJECTS = -libebl_x86_64_so_OBJECTS = $(am_libebl_x86_64_so_OBJECTS) -libebl_x86_64_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) \ - $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ - $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) \ - $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ - $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ - $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) \ - $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) \ - $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) \ - $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) \ - $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) \ - $(libebl_x86_64_so_SOURCES) -DIST_SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) \ - $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ - $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) \ - $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ - $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ - $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) \ - $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) \ - $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) \ - $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) \ - $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) \ - $(libebl_x86_64_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 1 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Werror -Wshadow -fpic \ - -DLIBSTR=\"$$(basename $(libdir))\" -#AM_CFLAGS = -Wall -Wshadow -fpic -DLIBSTR=\"$$(basename \ -# $(libdir))\" -INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I.. -lib_LIBRARIES = libebl.a -modules = i386 sh mips x86_64 ia64 alpha arm sparc ppc ppc64 -noinst_LIBRARIES = libebl_i386_pic.a libebl_sh_pic.a libebl_mips_pic.a \ - libebl_x86_64_pic.a libebl_ia64_pic.a libebl_alpha_pic.a \ - libebl_arm_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ - libebl_ppc64_pic.a - -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = libebl.h -gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ - eblreloctypename.c eblsegmenttypename.c \ - eblsectiontypename.c eblmachineflagname.c \ - eblsymboltypename.c ebldynamictagname.c eblsectionname.c \ - eblobjecttypename.c eblsymbolbindingname.c \ - eblbackendname.c eblshflagscombine.c eblwstrtab.c \ - eblgstrtab.c eblosabiname.c eblmachineflagcheck.c \ - eblreloctypecheck.c eblrelocvaliduse.c ebldynamictagcheck.c \ - eblcorenotetypename.c eblobjnotetypename.c \ - eblcorenote.c eblobjnote.c ebldebugscnp.c \ - eblgotpcreloccheck.c - -libebl_a_SOURCES = $(gen_SOURCES) - -# -# XXX Use --enable-new-dtags as soon as ld.so handles DT_RUNPATH when -# using dlopen correctly. -# -Wl,--rpath,\$$ORIGIN/elfutils \ -# -i386_SRCS = i386_init.c i386_destr.c i386_symbol.c i386_corenote.c -libebl_i386_pic_a_SOURCES = -am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) -libelf = ../libelf/libelf.so -#libelf = ../libelf/libelf.a -libmudflap = -#libmudflap = -lmudflap -libebl_i386_so_SOURCES = -sh_SRCS = sh_init.c sh_destr.c sh_symbol.c -libebl_sh_pic_a_SOURCES = -am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) -libebl_sh_so_SOURCES = -mips_SRCS = mips_init.c mips_destr.c mips_symbol.c -libebl_mips_pic_a_SOURCES = -am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os) -libebl_mips_so_SOURCES = -x86_64_SRCS = x86_64_init.c x86_64_destr.c x86_64_symbol.c -libebl_x86_64_pic_a_SOURCES = -am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) -libebl_x86_64_so_SOURCES = -ia64_SRCS = ia64_init.c ia64_destr.c ia64_symbol.c -libebl_ia64_pic_a_SOURCES = -am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) -libebl_ia64_so_SOURCES = -alpha_SRCS = alpha_init.c alpha_destr.c alpha_symbol.c -libebl_alpha_pic_a_SOURCES = -am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) -libebl_alpha_so_SOURCES = -arm_SRCS = arm_init.c arm_destr.c arm_symbol.c -libebl_arm_pic_a_SOURCES = -am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) -libebl_arm_so_SOURCES = -sparc_SRCS = sparc_init.c sparc_destr.c sparc_symbol.c -libebl_sparc_pic_a_SOURCES = -am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) -libebl_sparc_so_SOURCES = -ppc_SRCS = ppc_init.c ppc_destr.c ppc_symbol.c -libebl_ppc_pic_a_SOURCES = -am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) -libebl_ppc_so_SOURCES = -ppc64_SRCS = ppc64_init.c ppc64_destr.c ppc64_symbol.c -libebl_ppc64_pic_a_SOURCES = -am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) -libebl_ppc64_so_SOURCES = -noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h) -EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \ - $(foreach m,$(modules),$($(m)_SRCS)) - -CLEANFILES = $(am_libebl_pic_a_OBJECTS) \ - $(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS)) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libebl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits libebl/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - p=$(am__strip_dir) \ - echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ - $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ - else :; fi; \ - done - -uninstall-libLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libebl.a: $(libebl_a_OBJECTS) $(libebl_a_DEPENDENCIES) - -rm -f libebl.a - $(libebl_a_AR) libebl.a $(libebl_a_OBJECTS) $(libebl_a_LIBADD) - $(RANLIB) libebl.a -libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) - -rm -f libebl_alpha_pic.a - $(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) - $(RANLIB) libebl_alpha_pic.a -libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) - -rm -f libebl_arm_pic.a - $(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) - $(RANLIB) libebl_arm_pic.a -libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) - -rm -f libebl_i386_pic.a - $(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) - $(RANLIB) libebl_i386_pic.a -libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) - -rm -f libebl_ia64_pic.a - $(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) - $(RANLIB) libebl_ia64_pic.a -libebl_mips_pic.a: $(libebl_mips_pic_a_OBJECTS) $(libebl_mips_pic_a_DEPENDENCIES) - -rm -f libebl_mips_pic.a - $(libebl_mips_pic_a_AR) libebl_mips_pic.a $(libebl_mips_pic_a_OBJECTS) $(libebl_mips_pic_a_LIBADD) - $(RANLIB) libebl_mips_pic.a -libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) - -rm -f libebl_ppc64_pic.a - $(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) - $(RANLIB) libebl_ppc64_pic.a -libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) - -rm -f libebl_ppc_pic.a - $(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) - $(RANLIB) libebl_ppc_pic.a -libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) - -rm -f libebl_sh_pic.a - $(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) - $(RANLIB) libebl_sh_pic.a -libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) - -rm -f libebl_sparc_pic.a - $(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) - $(RANLIB) libebl_sparc_pic.a -libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) - -rm -f libebl_x86_64_pic.a - $(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) - $(RANLIB) libebl_x86_64_pic.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/eblbackendname.Po -include ./$(DEPDIR)/eblclosebackend.Po -include ./$(DEPDIR)/eblcorenote.Po -include ./$(DEPDIR)/eblcorenotetypename.Po -include ./$(DEPDIR)/ebldebugscnp.Po -include ./$(DEPDIR)/ebldynamictagcheck.Po -include ./$(DEPDIR)/ebldynamictagname.Po -include ./$(DEPDIR)/eblgotpcreloccheck.Po -include ./$(DEPDIR)/eblgstrtab.Po -include ./$(DEPDIR)/eblmachineflagcheck.Po -include ./$(DEPDIR)/eblmachineflagname.Po -include ./$(DEPDIR)/eblobjecttypename.Po -include ./$(DEPDIR)/eblobjnote.Po -include ./$(DEPDIR)/eblobjnotetypename.Po -include ./$(DEPDIR)/eblopenbackend.Po -include ./$(DEPDIR)/eblosabiname.Po -include ./$(DEPDIR)/eblreloctypecheck.Po -include ./$(DEPDIR)/eblreloctypename.Po -include ./$(DEPDIR)/eblrelocvaliduse.Po -include ./$(DEPDIR)/eblsectionname.Po -include ./$(DEPDIR)/eblsectiontypename.Po -include ./$(DEPDIR)/eblsegmenttypename.Po -include ./$(DEPDIR)/eblshflagscombine.Po -include ./$(DEPDIR)/eblstrtab.Po -include ./$(DEPDIR)/eblsymbolbindingname.Po -include ./$(DEPDIR)/eblsymboltypename.Po -include ./$(DEPDIR)/eblwstrtab.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install-exec: install-exec-am -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-euincludeHEADERS - -install-exec-am: install-libLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ - ctags distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-info install-info-am install-libLIBRARIES install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-euincludeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -libebl_i386.so: libebl_i386_pic.a libebl_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_i386.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_sh.so: libebl_sh_pic.a libebl_sh.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sh.map \ - -Wl,-z,defs $(libmudflap) -libebl_mips.so: libebl_mips_pic.a libebl_mips.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_mips.map \ - -Wl,-z,defs $(libmudflap) -libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_x86_64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ia64.map \ - -Wl,-z,defs $(libmudflap) -libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_alpha.map \ - -Wl,-z,defs $(libmudflap) -libebl_arm.so: libebl_arm_pic.a libebl_arm.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_arm.map \ - -Wl,-z,defs $(libmudflap) -libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sparc.map \ - -Wl,-z,defs $(libmudflap) -libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) - -%.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ - -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ - then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ - rm -f "$(DEPDIR)/$*.Tpo"; \ - else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ - fi - -install: install-am - $(mkinstalldirs) $(DESTDIR)$(libdir)/elfutils - for m in $(modules); do \ - $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - -uninstall: uninstall-am - for m in $(modules); do \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/elfutils - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils -# 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/libebl/Makefile.am b/libebl/Makefile.am index 71514c85..c4e4a076 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -1,40 +1,47 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" if MUDFLAP -AM_CFLAGS = -Wall -Wshadow -fpic +AM_CFLAGS = -fmudflap else -AM_CFLAGS = -Wall -Werror -Wshadow -fpic +AM_CFLAGS = endif -AM_CFLAGS += -DLIBSTR=\"$$(basename $(libdir))\" +AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \ + -std=gnu99 -INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I.. +INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. -I$(srcdir)/../libasm VERSION = 1 PACKAGE_VERSION = @PACKAGE_VERSION@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ lib_LIBRARIES = libebl.a -modules = i386 sh mips x86_64 ia64 alpha arm sparc ppc ppc64 -noinst_LIBRARIES = libebl_i386_pic.a libebl_sh_pic.a libebl_mips_pic.a \ - libebl_x86_64_pic.a libebl_ia64_pic.a libebl_alpha_pic.a \ - libebl_arm_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ - libebl_ppc64_pic.a -noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = libebl.h +pkginclude_HEADERS = libebl.h gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblreloctypename.c eblsegmenttypename.c \ @@ -42,136 +49,20 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblsymboltypename.c ebldynamictagname.c eblsectionname.c \ eblobjecttypename.c eblsymbolbindingname.c \ eblbackendname.c eblshflagscombine.c eblwstrtab.c \ - eblgstrtab.c eblosabiname.c eblmachineflagcheck.c \ - eblreloctypecheck.c eblrelocvaliduse.c ebldynamictagcheck.c \ - eblcorenotetypename.c eblobjnotetypename.c \ + eblgstrtab.c eblosabiname.c \ + eblmachineflagcheck.c eblmachinesectionflagcheck.c \ + eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletype.c \ + ebldynamictagcheck.c eblcorenotetypename.c eblobjnotetypename.c \ eblcorenote.c eblobjnote.c ebldebugscnp.c \ - eblgotpcreloccheck.c + eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \ + eblelfclass.c eblelfdata.c eblelfmachine.c \ + ebl_check_special_symbol.c eblbsspltp.c eblretval.c \ + eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \ + eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ + ebl_check_special_section.c ebl_syscall_abi.c libebl_a_SOURCES = $(gen_SOURCES) -# -# XXX Use --enable-new-dtags as soon as ld.so handles DT_RUNPATH when -# using dlopen correctly. -# -Wl,--rpath,\$$ORIGIN/elfutils \ -# -i386_SRCS = i386_init.c i386_destr.c i386_symbol.c i386_corenote.c -libebl_i386_pic_a_SOURCES = -am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) - -if MUDFLAP -libelf = ../libelf/libelf.a -libmudflap = -lmudflap -else -libelf = ../libelf/libelf.so -libmudflap = -endif - -libebl_i386_so_SOURCES = -libebl_i386.so: libebl_i386_pic.a libebl_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_i386.map \ - -Wl,-z,defs $(libelf) $(libmudflap) - - -sh_SRCS = sh_init.c sh_destr.c sh_symbol.c -libebl_sh_pic_a_SOURCES = -am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) - -libebl_sh_so_SOURCES = -libebl_sh.so: libebl_sh_pic.a libebl_sh.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sh.map \ - -Wl,-z,defs $(libmudflap) - - -mips_SRCS = mips_init.c mips_destr.c mips_symbol.c -libebl_mips_pic_a_SOURCES = -am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os) - -libebl_mips_so_SOURCES = -libebl_mips.so: libebl_mips_pic.a libebl_mips.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_mips.map \ - -Wl,-z,defs $(libmudflap) - - -x86_64_SRCS = x86_64_init.c x86_64_destr.c x86_64_symbol.c -libebl_x86_64_pic_a_SOURCES = -am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) - -libebl_x86_64_so_SOURCES = -libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_x86_64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) - - -ia64_SRCS = ia64_init.c ia64_destr.c ia64_symbol.c -libebl_ia64_pic_a_SOURCES = -am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) - -libebl_ia64_so_SOURCES = -libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ia64.map \ - -Wl,-z,defs $(libmudflap) - - -alpha_SRCS = alpha_init.c alpha_destr.c alpha_symbol.c -libebl_alpha_pic_a_SOURCES = -am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) - -libebl_alpha_so_SOURCES = -libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_alpha.map \ - -Wl,-z,defs $(libmudflap) - - -arm_SRCS = arm_init.c arm_destr.c arm_symbol.c -libebl_arm_pic_a_SOURCES = -am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) - -libebl_arm_so_SOURCES = -libebl_arm.so: libebl_arm_pic.a libebl_arm.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_arm.map \ - -Wl,-z,defs $(libmudflap) - - -sparc_SRCS = sparc_init.c sparc_destr.c sparc_symbol.c -libebl_sparc_pic_a_SOURCES = -am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) - -libebl_sparc_so_SOURCES = -libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sparc.map \ - -Wl,-z,defs $(libmudflap) - - -ppc_SRCS = ppc_init.c ppc_destr.c ppc_symbol.c -libebl_ppc_pic_a_SOURCES = -am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) - -libebl_ppc_so_SOURCES = -libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc.map \ - -Wl,-z,defs $(libelf) $(libmudflap) - - -ppc64_SRCS = ppc64_init.c ppc64_destr.c ppc64_symbol.c -libebl_ppc64_pic_a_SOURCES = -am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) - -libebl_ppc64_so_SOURCES = -libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) - %.os: %.c %.o if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @@ -181,24 +72,6 @@ libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ fi -install: install-am - $(mkinstalldirs) $(DESTDIR)$(libdir)/elfutils - for m in $(modules); do \ - $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - -uninstall: uninstall-am - for m in $(modules); do \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/elfutils - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils - -noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h) -EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \ - $(foreach m,$(modules),$($(m)_SRCS)) +noinst_HEADERS = libeblP.h ebl-hooks.h -CLEANFILES = $(am_libebl_pic_a_OBJECTS) \ - $(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS)) +CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda diff --git a/libebl/Makefile.in b/libebl/Makefile.in index aaff3fe7..5f1228b4 100644 --- a/libebl/Makefile.in +++ b/libebl/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -15,18 +15,11 @@ @SET_MAKE@ - -SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) $(libebl_x86_64_so_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -40,18 +33,15 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = $(am__EXEEXT_1) subdir = libebl -DIST_COMMON = $(euinclude_HEADERS) $(noinst_HEADERS) \ +DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -60,9 +50,9 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) +LIBRARIES = $(lib_LIBRARIES) AR = ar ARFLAGS = cru libebl_a_AR = $(AR) $(ARFLAGS) @@ -76,116 +66,37 @@ am__objects_1 = eblopenbackend.$(OBJEXT) eblclosebackend.$(OBJEXT) \ eblbackendname.$(OBJEXT) eblshflagscombine.$(OBJEXT) \ eblwstrtab.$(OBJEXT) eblgstrtab.$(OBJEXT) \ eblosabiname.$(OBJEXT) eblmachineflagcheck.$(OBJEXT) \ + eblmachinesectionflagcheck.$(OBJEXT) \ eblreloctypecheck.$(OBJEXT) eblrelocvaliduse.$(OBJEXT) \ - ebldynamictagcheck.$(OBJEXT) eblcorenotetypename.$(OBJEXT) \ - eblobjnotetypename.$(OBJEXT) eblcorenote.$(OBJEXT) \ - eblobjnote.$(OBJEXT) ebldebugscnp.$(OBJEXT) \ - eblgotpcreloccheck.$(OBJEXT) + eblrelocsimpletype.$(OBJEXT) ebldynamictagcheck.$(OBJEXT) \ + eblcorenotetypename.$(OBJEXT) eblobjnotetypename.$(OBJEXT) \ + eblcorenote.$(OBJEXT) eblobjnote.$(OBJEXT) \ + ebldebugscnp.$(OBJEXT) eblgotpcreloccheck.$(OBJEXT) \ + eblcopyrelocp.$(OBJEXT) eblsectionstripp.$(OBJEXT) \ + eblelfclass.$(OBJEXT) eblelfdata.$(OBJEXT) \ + eblelfmachine.$(OBJEXT) ebl_check_special_symbol.$(OBJEXT) \ + eblbsspltp.$(OBJEXT) eblretval.$(OBJEXT) eblreginfo.$(OBJEXT) \ + eblnonerelocp.$(OBJEXT) eblrelativerelocp.$(OBJEXT) \ + eblsysvhashentrysize.$(OBJEXT) eblauxvinfo.$(OBJEXT) \ + eblcheckobjattr.$(OBJEXT) ebl_check_special_section.$(OBJEXT) \ + ebl_syscall_abi.$(OBJEXT) am_libebl_a_OBJECTS = $(am__objects_1) libebl_a_OBJECTS = $(am_libebl_a_OBJECTS) -libebl_alpha_pic_a_AR = $(AR) $(ARFLAGS) -libebl_alpha_pic_a_LIBADD = -libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) -libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) -libebl_arm_pic_a_LIBADD = -libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) -libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) -libebl_i386_pic_a_LIBADD = -libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS) -libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ia64_pic_a_LIBADD = -libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS) -libebl_mips_pic_a_AR = $(AR) $(ARFLAGS) -libebl_mips_pic_a_LIBADD = -libebl_mips_pic_a_OBJECTS = $(am_libebl_mips_pic_a_OBJECTS) -libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ppc64_pic_a_LIBADD = -libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) -libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) -libebl_ppc_pic_a_LIBADD = -libebl_ppc_pic_a_OBJECTS = $(am_libebl_ppc_pic_a_OBJECTS) -libebl_sh_pic_a_AR = $(AR) $(ARFLAGS) -libebl_sh_pic_a_LIBADD = -libebl_sh_pic_a_OBJECTS = $(am_libebl_sh_pic_a_OBJECTS) -libebl_sparc_pic_a_AR = $(AR) $(ARFLAGS) -libebl_sparc_pic_a_LIBADD = -libebl_sparc_pic_a_OBJECTS = $(am_libebl_sparc_pic_a_OBJECTS) -libebl_x86_64_pic_a_AR = $(AR) $(ARFLAGS) -libebl_x86_64_pic_a_LIBADD = -libebl_x86_64_pic_a_OBJECTS = $(am_libebl_x86_64_pic_a_OBJECTS) -am__EXEEXT_1 = libebl_i386.so$(EXEEXT) libebl_sh.so$(EXEEXT) \ - libebl_mips.so$(EXEEXT) libebl_x86_64.so$(EXEEXT) \ - libebl_ia64.so$(EXEEXT) libebl_alpha.so$(EXEEXT) \ - libebl_arm.so$(EXEEXT) libebl_sparc.so$(EXEEXT) \ - libebl_ppc.so$(EXEEXT) libebl_ppc64.so$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am_libebl_alpha_so_OBJECTS = -libebl_alpha_so_OBJECTS = $(am_libebl_alpha_so_OBJECTS) -libebl_alpha_so_LDADD = $(LDADD) -am_libebl_arm_so_OBJECTS = -libebl_arm_so_OBJECTS = $(am_libebl_arm_so_OBJECTS) -libebl_arm_so_LDADD = $(LDADD) -am_libebl_i386_so_OBJECTS = -libebl_i386_so_OBJECTS = $(am_libebl_i386_so_OBJECTS) -libebl_i386_so_LDADD = $(LDADD) -am_libebl_ia64_so_OBJECTS = -libebl_ia64_so_OBJECTS = $(am_libebl_ia64_so_OBJECTS) -libebl_ia64_so_LDADD = $(LDADD) -am_libebl_mips_so_OBJECTS = -libebl_mips_so_OBJECTS = $(am_libebl_mips_so_OBJECTS) -libebl_mips_so_LDADD = $(LDADD) -am_libebl_ppc_so_OBJECTS = -libebl_ppc_so_OBJECTS = $(am_libebl_ppc_so_OBJECTS) -libebl_ppc_so_LDADD = $(LDADD) -am_libebl_ppc64_so_OBJECTS = -libebl_ppc64_so_OBJECTS = $(am_libebl_ppc64_so_OBJECTS) -libebl_ppc64_so_LDADD = $(LDADD) -am_libebl_sh_so_OBJECTS = -libebl_sh_so_OBJECTS = $(am_libebl_sh_so_OBJECTS) -libebl_sh_so_LDADD = $(LDADD) -am_libebl_sparc_so_OBJECTS = -libebl_sparc_so_OBJECTS = $(am_libebl_sparc_so_OBJECTS) -libebl_sparc_so_LDADD = $(LDADD) -am_libebl_x86_64_so_OBJECTS = -libebl_x86_64_so_OBJECTS = $(am_libebl_x86_64_so_OBJECTS) -libebl_x86_64_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) \ - $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ - $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) \ - $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ - $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ - $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) \ - $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) \ - $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) \ - $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) \ - $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) \ - $(libebl_x86_64_so_SOURCES) -DIST_SOURCES = $(libebl_a_SOURCES) $(libebl_alpha_pic_a_SOURCES) \ - $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ - $(libebl_ia64_pic_a_SOURCES) $(libebl_mips_pic_a_SOURCES) \ - $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ - $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ - $(libebl_x86_64_pic_a_SOURCES) $(libebl_alpha_so_SOURCES) \ - $(libebl_arm_so_SOURCES) $(libebl_i386_so_SOURCES) \ - $(libebl_ia64_so_SOURCES) $(libebl_mips_so_SOURCES) \ - $(libebl_ppc_so_SOURCES) $(libebl_ppc64_so_SOURCES) \ - $(libebl_sh_so_SOURCES) $(libebl_sparc_so_SOURCES) \ - $(libebl_x86_64_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(noinst_HEADERS) +SOURCES = $(libebl_a_SOURCES) +DIST_SOURCES = $(libebl_a_SOURCES) +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -194,43 +105,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -239,7 +146,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -247,12 +153,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -265,117 +173,76 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -fpic \ -@MUDFLAP_FALSE@ -DLIBSTR=\"$$(basename $(libdir))\" -@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Wshadow -fpic -DLIBSTR=\"$$(basename \ -@MUDFLAP_TRUE@ $(libdir))\" -INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I.. +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 -std=gnu99 +INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. -I$(srcdir)/../libasm + lib_LIBRARIES = libebl.a -modules = i386 sh mips x86_64 ia64 alpha arm sparc ppc ppc64 -noinst_LIBRARIES = libebl_i386_pic.a libebl_sh_pic.a libebl_mips_pic.a \ - libebl_x86_64_pic.a libebl_ia64_pic.a libebl_alpha_pic.a \ - libebl_arm_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ - libebl_ppc64_pic.a - -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = libebl.h +pkginclude_HEADERS = libebl.h gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblreloctypename.c eblsegmenttypename.c \ eblsectiontypename.c eblmachineflagname.c \ eblsymboltypename.c ebldynamictagname.c eblsectionname.c \ eblobjecttypename.c eblsymbolbindingname.c \ eblbackendname.c eblshflagscombine.c eblwstrtab.c \ - eblgstrtab.c eblosabiname.c eblmachineflagcheck.c \ - eblreloctypecheck.c eblrelocvaliduse.c ebldynamictagcheck.c \ - eblcorenotetypename.c eblobjnotetypename.c \ + eblgstrtab.c eblosabiname.c \ + eblmachineflagcheck.c eblmachinesectionflagcheck.c \ + eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletype.c \ + ebldynamictagcheck.c eblcorenotetypename.c eblobjnotetypename.c \ eblcorenote.c eblobjnote.c ebldebugscnp.c \ - eblgotpcreloccheck.c + eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \ + eblelfclass.c eblelfdata.c eblelfmachine.c \ + ebl_check_special_symbol.c eblbsspltp.c eblretval.c \ + eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \ + eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ + ebl_check_special_section.c ebl_syscall_abi.c libebl_a_SOURCES = $(gen_SOURCES) - -# -# XXX Use --enable-new-dtags as soon as ld.so handles DT_RUNPATH when -# using dlopen correctly. -# -Wl,--rpath,\$$ORIGIN/elfutils \ -# -i386_SRCS = i386_init.c i386_destr.c i386_symbol.c i386_corenote.c -libebl_i386_pic_a_SOURCES = -am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) -@MUDFLAP_FALSE@libelf = ../libelf/libelf.so -@MUDFLAP_TRUE@libelf = ../libelf/libelf.a -@MUDFLAP_FALSE@libmudflap = -@MUDFLAP_TRUE@libmudflap = -lmudflap -libebl_i386_so_SOURCES = -sh_SRCS = sh_init.c sh_destr.c sh_symbol.c -libebl_sh_pic_a_SOURCES = -am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) -libebl_sh_so_SOURCES = -mips_SRCS = mips_init.c mips_destr.c mips_symbol.c -libebl_mips_pic_a_SOURCES = -am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os) -libebl_mips_so_SOURCES = -x86_64_SRCS = x86_64_init.c x86_64_destr.c x86_64_symbol.c -libebl_x86_64_pic_a_SOURCES = -am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) -libebl_x86_64_so_SOURCES = -ia64_SRCS = ia64_init.c ia64_destr.c ia64_symbol.c -libebl_ia64_pic_a_SOURCES = -am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) -libebl_ia64_so_SOURCES = -alpha_SRCS = alpha_init.c alpha_destr.c alpha_symbol.c -libebl_alpha_pic_a_SOURCES = -am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) -libebl_alpha_so_SOURCES = -arm_SRCS = arm_init.c arm_destr.c arm_symbol.c -libebl_arm_pic_a_SOURCES = -am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) -libebl_arm_so_SOURCES = -sparc_SRCS = sparc_init.c sparc_destr.c sparc_symbol.c -libebl_sparc_pic_a_SOURCES = -am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) -libebl_sparc_so_SOURCES = -ppc_SRCS = ppc_init.c ppc_destr.c ppc_symbol.c -libebl_ppc_pic_a_SOURCES = -am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) -libebl_ppc_so_SOURCES = -ppc64_SRCS = ppc64_init.c ppc64_destr.c ppc64_symbol.c -libebl_ppc64_pic_a_SOURCES = -am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) -libebl_ppc64_so_SOURCES = -noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h) -EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \ - $(foreach m,$(modules),$($(m)_SRCS)) - -CLEANFILES = $(am_libebl_pic_a_OBJECTS) \ - $(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS)) - +noinst_HEADERS = libeblP.h ebl-hooks.h +CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -400,13 +267,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -433,56 +300,10 @@ uninstall-libLIBRARIES: clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libebl.a: $(libebl_a_OBJECTS) $(libebl_a_DEPENDENCIES) -rm -f libebl.a $(libebl_a_AR) libebl.a $(libebl_a_OBJECTS) $(libebl_a_LIBADD) $(RANLIB) libebl.a -libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) - -rm -f libebl_alpha_pic.a - $(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) - $(RANLIB) libebl_alpha_pic.a -libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) - -rm -f libebl_arm_pic.a - $(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) - $(RANLIB) libebl_arm_pic.a -libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) - -rm -f libebl_i386_pic.a - $(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) - $(RANLIB) libebl_i386_pic.a -libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) - -rm -f libebl_ia64_pic.a - $(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) - $(RANLIB) libebl_ia64_pic.a -libebl_mips_pic.a: $(libebl_mips_pic_a_OBJECTS) $(libebl_mips_pic_a_DEPENDENCIES) - -rm -f libebl_mips_pic.a - $(libebl_mips_pic_a_AR) libebl_mips_pic.a $(libebl_mips_pic_a_OBJECTS) $(libebl_mips_pic_a_LIBADD) - $(RANLIB) libebl_mips_pic.a -libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) - -rm -f libebl_ppc64_pic.a - $(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) - $(RANLIB) libebl_ppc64_pic.a -libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) - -rm -f libebl_ppc_pic.a - $(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) - $(RANLIB) libebl_ppc_pic.a -libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) - -rm -f libebl_sh_pic.a - $(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) - $(RANLIB) libebl_sh_pic.a -libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) - -rm -f libebl_sparc_pic.a - $(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) - $(RANLIB) libebl_sparc_pic.a -libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) - -rm -f libebl_x86_64_pic.a - $(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) - $(RANLIB) libebl_x86_64_pic.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -490,64 +311,81 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_check_special_section.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_check_special_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebl_syscall_abi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblauxvinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblbackendname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblbsspltp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcheckobjattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblclosebackend.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcopyrelocp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcorenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblcorenotetypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldebugscnp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldynamictagcheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebldynamictagname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfclass.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfdata.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblelfmachine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblgotpcreloccheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblgstrtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagcheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachineflagname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblmachinesectionflagcheck.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblnonerelocp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjecttypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblobjnotetypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblopenbackend.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblosabiname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreginfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelativerelocp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelocsimpletype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypecheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblreloctypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblrelocvaliduse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblretval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectionname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectionstripp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsectiontypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsegmenttypename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblshflagscombine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblstrtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymbolbindingname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsymboltypename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblsysvhashentrysize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eblwstrtab.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) +install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ done -uninstall-euincludeHEADERS: +uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -555,8 +393,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -568,8 +406,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -579,13 +417,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -599,22 +436,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -627,13 +463,15 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done +install: install-am install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @@ -657,8 +495,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am +clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -676,14 +513,22 @@ info: info-am info-am: -install-data-am: install-euincludeHEADERS +install-data-am: install-pkgincludeHEADERS + +install-dvi: install-dvi-am install-exec-am: install-libLIBRARIES +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -703,62 +548,24 @@ ps: ps-am ps-am: -uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES +uninstall-am: uninstall-libLIBRARIES uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ - ctags distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-info install-info-am install-libLIBRARIES install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-euincludeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -libebl_i386.so: libebl_i386_pic.a libebl_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_i386.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_sh.so: libebl_sh_pic.a libebl_sh.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sh.map \ - -Wl,-z,defs $(libmudflap) -libebl_mips.so: libebl_mips_pic.a libebl_mips.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_mips.map \ - -Wl,-z,defs $(libmudflap) -libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_x86_64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ia64.map \ - -Wl,-z,defs $(libmudflap) -libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_alpha.map \ - -Wl,-z,defs $(libmudflap) -libebl_arm.so: libebl_arm_pic.a libebl_arm.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_arm.map \ - -Wl,-z,defs $(libmudflap) -libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_sparc.map \ - -Wl,-z,defs $(libmudflap) -libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc.map \ - -Wl,-z,defs $(libelf) $(libmudflap) -libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libebl_ppc64.map \ - -Wl,-z,defs $(libelf) $(libmudflap) + clean-libLIBRARIES ctags distclean distclean-compile \ + distclean-generic 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-libLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgincludeHEADERS install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-libLIBRARIES \ + uninstall-pkgincludeHEADERS + %.os: %.c %.o if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @@ -767,21 +574,6 @@ libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map rm -f "$(DEPDIR)/$*.Tpo"; \ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ fi - -install: install-am - $(mkinstalldirs) $(DESTDIR)$(libdir)/elfutils - for m in $(modules); do \ - $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - -uninstall: uninstall-am - for m in $(modules); do \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \ - rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \ - done - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/elfutils - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils # 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/libebl/alpha_destr.c b/libebl/alpha_destr.c deleted file mode 100644 index c599d591..00000000 --- a/libebl/alpha_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for Alpha specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_alpha.h> - - -void -alpha_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/alpha_init.c b/libebl/alpha_init.c deleted file mode 100644 index b688bb73..00000000 --- a/libebl/alpha_init.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Initialization of Alpha specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_alpha.h> - - -int -alpha_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "Alpha"; - eh->reloc_type_name = alpha_reloc_type_name; - eh->reloc_type_check = alpha_reloc_type_check; - eh->destr = alpha_destr; - - return 0; -} diff --git a/libebl/alpha_symbol.c b/libebl/alpha_symbol.c deleted file mode 100644 index 749f4f55..00000000 --- a/libebl/alpha_symbol.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Alpha specific symbolic name handling. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_alpha.h> - - -/* Return of the backend. */ -const char * -alpha_backend_name (void) -{ - return "alpha"; -} - - -/* Relocation mapping table. */ -static const char *reloc_map_table[] = - { - [R_ALPHA_NONE] = "R_ALPHA_NONE", - [R_ALPHA_REFLONG] = "R_ALPHA_REFLONG", - [R_ALPHA_REFQUAD] = "R_ALPHA_REFQUAD", - [R_ALPHA_GPREL32] = "R_ALPHA_GPREL32", - [R_ALPHA_LITERAL] = "R_ALPHA_LITERAL", - [R_ALPHA_LITUSE] = "R_ALPHA_LITUSE", - [R_ALPHA_GPDISP] = "R_ALPHA_GPDISP", - [R_ALPHA_BRADDR] = "R_ALPHA_BRADDR", - [R_ALPHA_HINT] = "R_ALPHA_HINT", - [R_ALPHA_SREL16] = "R_ALPHA_SREL16", - [R_ALPHA_SREL32] = "R_ALPHA_SREL32", - [R_ALPHA_SREL64] = "R_ALPHA_SREL64", - [R_ALPHA_GPRELHIGH] = "R_ALPHA_GPRELHIGH", - [R_ALPHA_GPRELLOW] = "R_ALPHA_GPRELLOW", - [R_ALPHA_GPREL16] = "R_ALPHA_GPREL16", - [R_ALPHA_COPY] = "R_ALPHA_COPY", - [R_ALPHA_GLOB_DAT] = "R_ALPHA_GLOB_DAT", - [R_ALPHA_JMP_SLOT] = "R_ALPHA_JMP_SLOT", - [R_ALPHA_RELATIVE] = "R_ALPHA_RELATIVE", - [R_ALPHA_TLS_GD_HI] = "R_ALPHA_TLS_GD_HI", - [R_ALPHA_TLSGD] = "R_ALPHA_TLSGD", - [R_ALPHA_TLS_LDM] = "R_ALPHA_TLS_LDM", - [R_ALPHA_DTPMOD64] = "R_ALPHA_DTPMOD64", - [R_ALPHA_GOTDTPREL] = "R_ALPHA_GOTDTPREL", - [R_ALPHA_DTPREL64] = "R_ALPHA_DTPREL64", - [R_ALPHA_DTPRELHI] = "R_ALPHA_DTPRELHI", - [R_ALPHA_DTPRELLO] = "R_ALPHA_DTPRELLO", - [R_ALPHA_DTPREL16] = "R_ALPHA_DTPREL16", - [R_ALPHA_GOTTPREL] = "R_ALPHA_GOTTPREL", - [R_ALPHA_TPREL64] = "R_ALPHA_TPREL64", - [R_ALPHA_TPRELHI] = "R_ALPHA_TPRELHI", - [R_ALPHA_TPRELLO] = "R_ALPHA_TPRELLO", - [R_ALPHA_TPREL16] = "R_ALPHA_TPREL16" - }; - - -/* Determine relocation type string for Alpha. */ -const char * -alpha_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < 0 - || ((size_t) type - >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0]))) - return NULL; - - return reloc_map_table[type]; -} - - -/* Check for correct relocation type. */ -bool -alpha_reloc_type_check (int type) -{ - return (type >= R_ALPHA_NONE - && ((size_t) type - < sizeof (reloc_map_table) / sizeof (reloc_map_table[0])) - && reloc_map_table[type] != NULL) ? true : false; -} diff --git a/libebl/arm_destr.c b/libebl/arm_destr.c deleted file mode 100644 index 3851240a..00000000 --- a/libebl/arm_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for Arm specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_arm.h> - - -void -arm_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/arm_init.c b/libebl/arm_init.c deleted file mode 100644 index 3dee75a7..00000000 --- a/libebl/arm_init.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Initialization of Arm specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_arm.h> - - -int -arm_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "Arm"; - eh->reloc_type_name = arm_reloc_type_name; - eh->reloc_type_check = arm_reloc_type_check; - eh->destr = arm_destr; - - return 0; -} diff --git a/libebl/arm_symbol.c b/libebl/arm_symbol.c deleted file mode 100644 index 224beea3..00000000 --- a/libebl/arm_symbol.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Arm specific symbolic name handling. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_arm.h> - - -/* Return of the backend. */ -const char * -arm_backend_name (void) -{ - return "arm"; -} - - -/* Relocation mapping table. */ -static const char *reloc_map_table[] = - { - [R_ARM_NONE] = "R_ARM_NONE", - [R_ARM_PC24] = "R_ARM_PC24", - [R_ARM_ABS32] = "R_ARM_ABS32", - [R_ARM_REL32] = "R_ARM_REL32", - [R_ARM_PC13] = "R_ARM_PC13", - [R_ARM_ABS16] = "R_ARM_ABS16", - [R_ARM_ABS12] = "R_ARM_ABS12", - [R_ARM_THM_ABS5] = "R_ARM_THM_ABS5", - [R_ARM_ABS8] = "R_ARM_ABS8", - [R_ARM_SBREL32] = "R_ARM_SBREL32", - [R_ARM_THM_PC22] = "R_ARM_THM_PC22", - [R_ARM_THM_PC8] = "R_ARM_THM_PC8", - [R_ARM_AMP_VCALL9] = "R_ARM_AMP_VCALL9", - [R_ARM_SWI24] = "R_ARM_SWI24", - [R_ARM_THM_SWI8] = "R_ARM_THM_SWI8", - [R_ARM_XPC25] = "R_ARM_XPC25", - [R_ARM_THM_XPC22] = "R_ARM_THM_XPC22", - [R_ARM_COPY] = "R_ARM_COPY", - [R_ARM_GLOB_DAT] = "R_ARM_GLOB_DAT", - [R_ARM_JUMP_SLOT] = "R_ARM_JUMP_SLOT", - [R_ARM_RELATIVE] = "R_ARM_RELATIVE", - [R_ARM_GOTOFF] = "R_ARM_GOTOFF", - [R_ARM_GOTPC] = "R_ARM_GOTPC", - [R_ARM_GOT32] = "R_ARM_GOT32", - [R_ARM_PLT32] = "R_ARM_PLT32", - [R_ARM_ALU_PCREL_7_0] = "R_ARM_ALU_PCREL_7_0", - [R_ARM_ALU_PCREL_15_8] = "R_ARM_ALU_PCREL_15_8", - [R_ARM_ALU_PCREL_23_15] = "R_ARM_ALU_PCREL_23_15", - [R_ARM_LDR_SBREL_11_0] = "R_ARM_LDR_SBREL_11_0", - [R_ARM_ALU_SBREL_19_12] = "R_ARM_ALU_SBREL_19_12", - [R_ARM_ALU_SBREL_27_20] = "R_ARM_ALU_SBREL_27_20" - }; - -static const char *reloc_map_table2[] = - { - [R_ARM_GNU_VTENTRY] = "R_ARM_GNU_VTENTRY", - [R_ARM_GNU_VTINHERIT] = "R_ARM_GNU_VTINHERIT", - [R_ARM_THM_PC11] = "R_ARM_THM_PC11", - [R_ARM_THM_PC9] = "R_ARM_THM_PC9" - }; - -static const char *reloc_map_table3[] = - { - [R_ARM_RXPC25] = "R_ARM_RXPC25", - [R_ARM_RSBREL32] = "R_ARM_RSBREL32", - [R_ARM_THM_RPC22] = "R_ARM_THM_RPC22", - [R_ARM_RREL32] = "R_ARM_RREL32", - [R_ARM_RABS22] = "R_ARM_RABS22", - [R_ARM_RPC24] = "R_ARM_RPC24", - [R_ARM_RBASE] = "R_ARM_RBASE" - }; - - -/* Determine relocation type string for Alpha. */ -const char * -arm_reloc_type_name (int type, char *buf, size_t len) -{ - if (type >= R_ARM_NONE && type <= R_ARM_ALU_SBREL_27_20) - return reloc_map_table[type]; - - if (type >= R_ARM_GNU_VTENTRY && type <= R_ARM_THM_PC9) - return reloc_map_table2[type - R_ARM_GNU_VTENTRY]; - - if (type >= R_ARM_RXPC25 && type <= R_ARM_RBASE) - return reloc_map_table3[type - R_ARM_RXPC25]; - - return NULL; -} - - -/* Check for correct relocation type. */ -bool -arm_reloc_type_check (int type) -{ - return ((type >= R_ARM_NONE && type <= R_ARM_ALU_SBREL_27_20) - || (type >= R_ARM_GNU_VTENTRY && type <= R_ARM_THM_PC9) - || (type >= R_ARM_RXPC25 && type <= R_ARM_RBASE)) ? true : false; -} diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h new file mode 100644 index 00000000..2db1e208 --- /dev/null +++ b/libebl/ebl-hooks.h @@ -0,0 +1,172 @@ +/* Backend hook signatures internal interface for libebl. + Copyright (C) 2000,2001,2002,2004,2005,2006,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* Return symbol representaton of object file type. */ +const char *EBLHOOK(object_type_name) (int, char *, size_t); + +/* Return symbolic representation of relocation type. */ +const char *EBLHOOK(reloc_type_name) (int, char *, size_t); + +/* Check relocation type. */ +bool EBLHOOK(reloc_type_check) (int); + +/* Check if relocation type is for simple absolute relocations. */ +Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int); + +/* Check relocation type use. */ +bool EBLHOOK(reloc_valid_use) (Elf *, int); + +/* Return true if the symbol type is that referencing the GOT. */ +bool EBLHOOK(gotpc_reloc_check) (Elf *, int); + +/* Return symbolic representation of segment type. */ +const char *EBLHOOK(segment_type_name) (int, char *, size_t); + +/* Return symbolic representation of section type. */ +const char *EBLHOOK(section_type_name) (int, char *, size_t); + +/* Return section name. */ +const char *EBLHOOK(section_name) (int, int, char *, size_t); + +/* Return next machine flag name. */ +const char *EBLHOOK(machine_flag_name) (GElf_Word *); + +/* Check whether machine flags are valid. */ +bool EBLHOOK(machine_flag_check) (GElf_Word); + +/* Check whether SHF_MASKPROC flag bits are valid. */ +bool EBLHOOK(machine_section_flag_check) (GElf_Xword); + +/* Check whether the section with the given index, header, and name + is a special machine section that is valid despite a combination + of flags or other details that are not generically valid. */ +bool EBLHOOK(check_special_section) (Ebl *, int, + const GElf_Shdr *, const char *); + +/* Return symbolic representation of symbol type. */ +const char *EBLHOOK(symbol_type_name) (int, char *, size_t); + +/* Return symbolic representation of symbol binding. */ +const char *EBLHOOK(symbol_binding_name) (int, char *, size_t); + +/* Return symbolic representation of dynamic tag. */ +const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t); + +/* Check dynamic tag. */ +bool EBLHOOK(dynamic_tag_check) (int64_t); + +/* Combine section header flags values. */ +GElf_Word EBLHOOK(sh_flags_combine) (GElf_Word, GElf_Word); + +/* Return symbolic representation of OS ABI. */ +const char *EBLHOOK(osabi_name) (int, char *, size_t); + +/* Name of a note entry type for core files. */ +const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t); + +/* Name of a note entry type for object files. */ +const char *EBLHOOK(object_note_type_name) (uint32_t, char *, size_t); + +/* Describe core note format. */ +int EBLHOOK(core_note) (GElf_Word, GElf_Word, GElf_Word *, size_t *, + const Ebl_Register_Location **, + size_t *, const Ebl_Core_Item **); + +/* Handle object file note. */ +bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *); + +/* Check object attribute. */ +bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t, + const char **, const char **); + +/* Describe auxv element type. */ +int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **); + +/* Check section name for being that of a debug informatino section. */ +bool EBLHOOK(debugscn_p) (const char *); + +/* Check whether given relocation is a copy relocation. */ +bool EBLHOOK(copy_reloc_p) (int); + +/* Check whether given relocation is a no-op relocation. */ +bool EBLHOOK(none_reloc_p) (int); + +/* Check whether given relocation is a relative relocation. */ +bool EBLHOOK(relative_reloc_p) (int); + +/* Check whether given symbol's value is ok despite normal checks. */ +bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, + const char *, const GElf_Shdr *); + +/* Check if backend uses a bss PLT in this file. */ +bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *); + +/* Return location expression to find return value given the + DW_AT_type DIE of a DW_TAG_subprogram DIE. */ +int EBLHOOK(return_value_location) (Dwarf_Die *functypedie, + const Dwarf_Op **locp); + +/* Return register name information. */ +ssize_t EBLHOOK(register_info) (Ebl *ebl, + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type); + +/* Return system call ABI registers. */ +int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); + +/* Disassembler function. */ +int EBLHOOK(disasm) (const uint8_t **startp, const uint8_t *end, + GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, + DisasmGetSymCB_t symcb, void *outcbarg, void *symcbarg); + + +/* Destructor for ELF backend handle. */ +void EBLHOOK(destr) (struct ebl *); diff --git a/libebl/ebl_check_special_section.c b/libebl/ebl_check_special_section.c new file mode 100644 index 00000000..d1f3c6e3 --- /dev/null +++ b/libebl/ebl_check_special_section.c @@ -0,0 +1,65 @@ +/* Check for a special section allowed to violate generic constraints. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_check_special_section (ebl, ndx, shdr, sname) + Ebl *ebl; + int ndx; + const GElf_Shdr *shdr; + const char *sname; +{ + return ebl != NULL && ebl->check_special_section (ebl, ndx, shdr, sname); +} diff --git a/libebl/ebl_check_special_symbol.c b/libebl/ebl_check_special_symbol.c new file mode 100644 index 00000000..875ed1ca --- /dev/null +++ b/libebl/ebl_check_special_symbol.c @@ -0,0 +1,70 @@ +/* Check special symbol's st_value. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <libeblP.h> + + +bool +ebl_check_special_symbol (ebl, ehdr, sym, name, destshdr) + Ebl *ebl; + GElf_Ehdr *ehdr; + const GElf_Sym *sym; + const char *name; + const GElf_Shdr *destshdr; +{ + if (ebl == NULL) + return false; + + return ebl->check_special_symbol (ebl->elf, ehdr, sym, name, destshdr); +} diff --git a/libebl/ebl_syscall_abi.c b/libebl/ebl_syscall_abi.c new file mode 100644 index 00000000..2d9a26b6 --- /dev/null +++ b/libebl/ebl_syscall_abi.c @@ -0,0 +1,66 @@ +/* Return system call ABI mapped to DWARF register numbers. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +int +ebl_syscall_abi (ebl, sp, pc, callno, args) + Ebl *ebl; + int *sp; + int *pc; + int *callno; + int args[6]; +{ + return ebl != NULL ? ebl->syscall_abi (ebl, sp, pc, callno, args) : -1; +} diff --git a/libebl/eblauxvinfo.c b/libebl/eblauxvinfo.c new file mode 100644 index 00000000..af65c47b --- /dev/null +++ b/libebl/eblauxvinfo.c @@ -0,0 +1,122 @@ +/* Describe known auxv types. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <byteswap.h> +#include <endian.h> +#include <inttypes.h> +#include <stdio.h> +#include <stddef.h> +#include <libeblP.h> + +#define AUXV_TYPES \ + TYPE (NULL, "") \ + TYPE (IGNORE, "") \ + TYPE (EXECFD, "d") \ + TYPE (EXECFN, "s") \ + TYPE (PHDR, "p") \ + TYPE (PHENT, "u") \ + TYPE (PHNUM, "u") \ + TYPE (PAGESZ, "u") \ + TYPE (BASE, "p") \ + TYPE (FLAGS, "x") \ + TYPE (ENTRY, "p") \ + TYPE (NOTELF, "") \ + TYPE (UID, "u") \ + TYPE (EUID, "u") \ + TYPE (GID, "u") \ + TYPE (EGID, "u") \ + TYPE (CLKTCK, "u") \ + TYPE (PLATFORM, "s") \ + TYPE (HWCAP, "x") \ + TYPE (FPUCW, "x") \ + TYPE (DCACHEBSIZE, "d") \ + TYPE (ICACHEBSIZE, "d") \ + TYPE (UCACHEBSIZE, "d") \ + TYPE (IGNOREPPC, "") \ + TYPE (SECURE, "u") \ + TYPE (SYSINFO, "p") \ + TYPE (SYSINFO_EHDR, "p") \ + TYPE (L1I_CACHESHAPE, "d") \ + TYPE (L1D_CACHESHAPE, "d") \ + TYPE (L2_CACHESHAPE, "d") \ + TYPE (L3_CACHESHAPE, "d") + +static const struct +{ + const char *name, *format; +} auxv_types[] = + { +#define TYPE(name, fmt) [AT_##name] = { #name, fmt }, + AUXV_TYPES +#undef TYPE + }; +#define nauxv_types (sizeof auxv_types / sizeof auxv_types[0]) + +int +ebl_auxv_info (ebl, a_type, name, format) + Ebl *ebl; + GElf_Xword a_type; + const char **name; + const char **format; +{ + int result = ebl->auxv_info (a_type, name, format); + if (result == 0 && a_type < nauxv_types && auxv_types[a_type].name != NULL) + { + /* The machine specific function did not know this type. */ + *name = auxv_types[a_type].name; + *format = auxv_types[a_type].format; + result = 1; + } + return result; +} diff --git a/libebl/eblbackendname.c b/libebl/eblbackendname.c index 03830ebe..daec8805 100644 --- a/libebl/eblbackendname.c +++ b/libebl/eblbackendname.c @@ -1,16 +1,52 @@ /* Return backend name. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblbsspltp.c b/libebl/eblbsspltp.c new file mode 100644 index 00000000..14b6f099 --- /dev/null +++ b/libebl/eblbsspltp.c @@ -0,0 +1,64 @@ +/* Check if backend uses a bss PLT. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <libeblP.h> + + +bool +ebl_bss_plt_p (ebl, ehdr) + Ebl *ebl; + GElf_Ehdr *ehdr; +{ + return ebl == NULL ? false : ebl->bss_plt_p (ebl->elf, ehdr); +} diff --git a/libebl/eblcheckobjattr.c b/libebl/eblcheckobjattr.c new file mode 100644 index 00000000..fe75de74 --- /dev/null +++ b/libebl/eblcheckobjattr.c @@ -0,0 +1,81 @@ +/* Check object attributes. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <libeblP.h> + + +bool +ebl_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) + Ebl *ebl; + const char *vendor; + int tag; + uint64_t value; + const char **tag_name; + const char **value_name; +{ + if (ebl->check_object_attribute (ebl, vendor, tag, value, + tag_name, value_name)) + return true; + + if (strcmp (vendor, "gnu")) + return false; + + if (tag == 32) + { + *tag_name = "compatibility"; + return true; + } + + return false; +} diff --git a/libebl/eblclosebackend.c b/libebl/eblclosebackend.c index c5579612..a0fb3448 100644 --- a/libebl/eblclosebackend.c +++ b/libebl/eblclosebackend.c @@ -1,15 +1,51 @@ /* Free ELF backend handle. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblcopyrelocp.c b/libebl/eblcopyrelocp.c new file mode 100644 index 00000000..a7aea880 --- /dev/null +++ b/libebl/eblcopyrelocp.c @@ -0,0 +1,64 @@ +/* Check whether given relocation is a copy relocation. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_copy_reloc_p (ebl, reloc) + Ebl *ebl; + int reloc; +{ + return ebl->copy_reloc_p (reloc); +} diff --git a/libebl/eblcorenote.c b/libebl/eblcorenote.c index 6cc384fa..553d5ba9 100644 --- a/libebl/eblcorenote.c +++ b/libebl/eblcorenote.c @@ -1,151 +1,107 @@ -/* Print contents of core note. - Copyright (C) 2002, 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ +/* Describe known core note formats. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <assert.h> +#include <byteswap.h> +#include <endian.h> #include <inttypes.h> #include <stdio.h> #include <stddef.h> #include <libeblP.h> -void -ebl_core_note (ebl, name, type, descsz, desc) +int +ebl_core_note (ebl, n_type, descsz, + regs_offset, nregloc, reglocs, nitems, items) Ebl *ebl; - const char *name; - uint32_t type; - uint32_t descsz; - const char *desc; + GElf_Word n_type; + GElf_Word descsz; + GElf_Word *regs_offset; + size_t *nregloc; + const Ebl_Register_Location **reglocs; + size_t *nitems; + const Ebl_Core_Item **items; { - int class = gelf_getclass (ebl->elf); - - if (! ebl->core_note (name, type, descsz, desc)) - /* The machine specific function did not know this type. */ - switch (type) - { - case NT_PLATFORM: - printf (gettext (" Platform: %.*s\n"), (int) descsz, desc); - break; - - case NT_AUXV: - ; - size_t cnt; - size_t elsize = (class == ELFCLASS32 - ? sizeof (Elf32_auxv_t) : sizeof (Elf64_auxv_t)); - - for (cnt = 0; (cnt + 1) * elsize <= descsz; ++cnt) - { - unsigned long int atype; - unsigned long int val; - - if (class == ELFCLASS32) - { - Elf32_auxv_t *auxv = &((Elf32_auxv_t *) desc)[cnt]; - - atype = auxv->a_type; - val = auxv->a_un.a_val; - } - else - { - Elf64_auxv_t *auxv = &((Elf64_auxv_t *) desc)[cnt]; - - atype = auxv->a_type; - val = auxv->a_un.a_val; - } - - /* XXX Do we need the auxiliary vector info anywhere - else? If yes, move code into a separate function. */ - const char *at; - - switch (atype) - { -#define NEW_AT(name) case AT_##name: at = #name; break - NEW_AT (NULL); - NEW_AT (IGNORE); - NEW_AT (EXECFD); - NEW_AT (PHDR); - NEW_AT (PHENT); - NEW_AT (PHNUM); - NEW_AT (PAGESZ); - NEW_AT (BASE); - NEW_AT (FLAGS); - NEW_AT (ENTRY); - NEW_AT (NOTELF); - NEW_AT (UID); - NEW_AT (EUID); - NEW_AT (GID); - NEW_AT (EGID); - NEW_AT (CLKTCK); - NEW_AT (PLATFORM); - NEW_AT (HWCAP); - NEW_AT (FPUCW); - NEW_AT (DCACHEBSIZE); - NEW_AT (ICACHEBSIZE); - NEW_AT (UCACHEBSIZE); - NEW_AT (IGNOREPPC); - - default: - at = "???"; - break; - } - - switch (atype) + int result = ebl->core_note (n_type, descsz, regs_offset, nregloc, reglocs, + nitems, items); + if (result == 0) + { + /* The machine specific function did not know this type. */ + + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + switch (n_type) + { +#define ITEMS(type, table) \ + case type: \ + *items = table; \ + *nitems = sizeof table / sizeof table[0]; \ + result = 1; \ + break + + static const Ebl_Core_Item platform[] = + { { - case AT_NULL: - case AT_IGNORE: - case AT_IGNOREPPC: - case AT_NOTELF: - default: - printf (" %s\n", at); - break; - - case AT_EXECFD: - case AT_PHENT: - case AT_PHNUM: - case AT_PAGESZ: - case AT_UID: - case AT_EUID: - case AT_GID: - case AT_EGID: - case AT_CLKTCK: - case AT_FPUCW: - case AT_DCACHEBSIZE: - case AT_ICACHEBSIZE: - case AT_UCACHEBSIZE: - printf (" %s: %" PRId64 "\n", at, (int64_t) val); - break; - - case AT_PHDR: - case AT_BASE: - case AT_FLAGS: /* XXX Print flags? */ - case AT_ENTRY: - case AT_PLATFORM: /* XXX Get string? */ - case AT_HWCAP: /* XXX Print flags? */ - printf (" %s: %" PRIx64 "\n", at, (uint64_t) val); - break; + .name = "Platform", + .type = ELF_T_BYTE, .count = 0, .format = 's' } + }; + ITEMS (NT_PLATFORM, platform); - if (atype == AT_NULL) - /* Reached the end. */ - break; - } - break; +#undef ITEMS + } + } - default: - /* Unknown type. */ - break; - } + return result; } diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c index 4a94d2ba..9376cf57 100644 --- a/libebl/eblcorenotetypename.c +++ b/libebl/eblcorenotetypename.c @@ -1,16 +1,52 @@ /* Return note type name. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -20,7 +56,6 @@ #include <stdio.h> #include <libeblP.h> - const char * ebl_core_note_type_name (ebl, type, buf, len) Ebl *ebl; @@ -50,6 +85,7 @@ ebl_core_note_type_name (ebl, type, buf, len) KNOWNSTYPE (LWPSTATUS), KNOWNSTYPE (LWPSINFO), KNOWNSTYPE (PRFPXREG) +#undef KNOWNSTYPE }; /* Handle standard names. */ @@ -57,11 +93,21 @@ ebl_core_note_type_name (ebl, type, buf, len) && knowntypes[type] != NULL) res = knowntypes[type]; else - { - snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); + switch (type) + { +#define KNOWNSTYPE(name) case NT_##name: res = #name; break + KNOWNSTYPE (PRXFPREG); + KNOWNSTYPE (PPC_VMX); + KNOWNSTYPE (PPC_SPE); + KNOWNSTYPE (386_TLS); + KNOWNSTYPE (386_IOPERM); +#undef KNOWNSTYPE + + default: + snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); - res = buf; - } + res = buf; + } } return res; diff --git a/libebl/ebldebugscnp.c b/libebl/ebldebugscnp.c index 59310b51..c96622c5 100644 --- a/libebl/ebldebugscnp.c +++ b/libebl/ebldebugscnp.c @@ -1,16 +1,52 @@ /* Check section name for being that of a debug informatino section. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/ebldynamictagcheck.c b/libebl/ebldynamictagcheck.c index 68b41691..1953a9c0 100644 --- a/libebl/ebldynamictagcheck.c +++ b/libebl/ebldynamictagcheck.c @@ -1,16 +1,52 @@ /* Check dynamic tag. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -30,7 +66,7 @@ ebl_dynamic_tag_check (ebl, tag) if (!res && ((tag >= 0 && tag < DT_NUM) || (tag >= DT_GNU_PRELINKED && tag <= DT_SYMINENT) - || (tag >= DT_GNU_CONFLICT && tag <= DT_SYMINFO) + || (tag >= DT_GNU_HASH && tag <= DT_SYMINFO) || tag == DT_VERSYM || (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM) || tag == DT_AUXILIARY diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c index 464c1e2a..e0972ede 100644 --- a/libebl/ebldynamictagname.c +++ b/libebl/ebldynamictagname.c @@ -1,16 +1,52 @@ /* Return dynamic tag name. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -60,15 +96,16 @@ ebl_dynamic_tag_name (ebl, tag, buf, len) res = valrntags[tag - DT_GNU_PRELINKED]; } - else if (tag >= DT_GNU_CONFLICT && tag <= DT_SYMINFO) + else if (tag >= DT_GNU_HASH && tag <= DT_SYMINFO) { static const char *addrrntags[] = { + "GNU_HASH", "TLSDESC_PLT", "TLSDESC_DOT", "GNU_CONFLICT", "GNU_LIBLIST", "CONFIG", "DEPAUDIT", "AUDIT", "PLTPAD", "MOVETAB", "SYMINFO" }; - res = addrrntags[tag - DT_GNU_CONFLICT]; + res = addrrntags[tag - DT_GNU_HASH]; } else if (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM) { @@ -86,7 +123,7 @@ ebl_dynamic_tag_name (ebl, tag, buf, len) res = "FILTER"; else { - snprintf (buf, len, gettext ("<unknown>: %" PRId64), tag); + snprintf (buf, len, gettext ("<unknown>: %#" PRIx64), tag); res = buf; diff --git a/libebl/eblelfclass.c b/libebl/eblelfclass.c new file mode 100644 index 00000000..222307e7 --- /dev/null +++ b/libebl/eblelfclass.c @@ -0,0 +1,63 @@ +/* Return ELF class. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +int +ebl_get_elfclass (ebl) + Ebl *ebl; +{ + return ebl->class; +} diff --git a/libebl/eblelfdata.c b/libebl/eblelfdata.c new file mode 100644 index 00000000..f84ae165 --- /dev/null +++ b/libebl/eblelfdata.c @@ -0,0 +1,63 @@ +/* Return ELF data encoding. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +int +ebl_get_elfdata (ebl) + Ebl *ebl; +{ + return ebl->data; +} diff --git a/libebl/eblelfmachine.c b/libebl/eblelfmachine.c new file mode 100644 index 00000000..9839fefe --- /dev/null +++ b/libebl/eblelfmachine.c @@ -0,0 +1,63 @@ +/* Return ELF machine. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +int +ebl_get_elfmachine (ebl) + Ebl *ebl; +{ + return ebl->machine; +} diff --git a/libebl/eblgotpcreloccheck.c b/libebl/eblgotpcreloccheck.c index 8ae8b7b8..e70fcb19 100644 --- a/libebl/eblgotpcreloccheck.c +++ b/libebl/eblgotpcreloccheck.c @@ -1,17 +1,53 @@ /* Return true if the symbol type is that referencing the GOT. E.g., R_386_GOTPC. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblgstrtab.c b/libebl/eblgstrtab.c index 1fee0e89..73f0d278 100644 --- a/libebl/eblgstrtab.c +++ b/libebl/eblgstrtab.c @@ -1,16 +1,52 @@ /* Generic string table handling. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -139,16 +175,11 @@ ebl_gstrtabfree (struct Ebl_GStrtab *st) static struct Ebl_GStrent * newstring (struct Ebl_GStrtab *st, const char *str, size_t len) { - struct Ebl_GStrent *newstr; - size_t align; - size_t i; - size_t j; - /* Compute the amount of padding needed to make the structure aligned. */ - align = ((__alignof__ (struct Ebl_GStrent) - - (((uintptr_t) st->backp) - & (__alignof__ (struct Ebl_GStrent) - 1))) - & (__alignof__ (struct Ebl_GStrent) - 1)); + size_t align = ((__alignof__ (struct Ebl_GStrent) + - (((uintptr_t) st->backp) + & (__alignof__ (struct Ebl_GStrent) - 1))) + & (__alignof__ (struct Ebl_GStrent) - 1)); /* Make sure there is enough room in the memory block. */ if (st->left < align + sizeof (struct Ebl_GStrent) + len * st->width) @@ -158,7 +189,7 @@ newstring (struct Ebl_GStrtab *st, const char *str, size_t len) } /* Create the reserved string. */ - newstr = (struct Ebl_GStrent *) (st->backp + align); + struct Ebl_GStrent *newstr = (struct Ebl_GStrent *) (st->backp + align); newstr->string = str; newstr->len = len; newstr->width = st->width; @@ -166,10 +197,10 @@ newstring (struct Ebl_GStrtab *st, const char *str, size_t len) newstr->left = NULL; newstr->right = NULL; newstr->offset = 0; - for (i = len - 2; i >= 0; --i) - for (j = st->width - 1; j >= 0; --j) + for (int i = len - 2; i >= 0; --i) + for (int j = st->width - 1; j >= 0; --j) newstr->reverse[i * st->width + j] = str[(len - 2 - i) * st->width + j]; - for (j = 0; j < st->width; ++j) + for (size_t j = 0; j < st->width; ++j) newstr->reverse[(len - 1) * st->width + j] = '\0'; st->backp += align + sizeof (struct Ebl_GStrent) + len * st->width; st->left -= align + sizeof (struct Ebl_GStrent) + len * st->width; diff --git a/libebl/eblmachineflagcheck.c b/libebl/eblmachineflagcheck.c index abc8d302..ac383f60 100644 --- a/libebl/eblmachineflagcheck.c +++ b/libebl/eblmachineflagcheck.c @@ -1,16 +1,52 @@ /* Check machine flag. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblmachineflagname.c b/libebl/eblmachineflagname.c index 228a9945..88a8da83 100644 --- a/libebl/eblmachineflagname.c +++ b/libebl/eblmachineflagname.c @@ -1,16 +1,52 @@ /* Return machine flag names. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblmachinesectionflagcheck.c b/libebl/eblmachinesectionflagcheck.c new file mode 100644 index 00000000..9eb6d386 --- /dev/null +++ b/libebl/eblmachinesectionflagcheck.c @@ -0,0 +1,63 @@ +/* Check SHF_MASKPROC flags. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_machine_section_flag_check (ebl, flags) + Ebl *ebl; + GElf_Xword flags; +{ + return ebl != NULL ? ebl->machine_section_flag_check (flags) : (flags == 0); +} diff --git a/libebl/eblnonerelocp.c b/libebl/eblnonerelocp.c new file mode 100644 index 00000000..3bca98b1 --- /dev/null +++ b/libebl/eblnonerelocp.c @@ -0,0 +1,64 @@ +/* Check whether given relocation is a no-op relocation. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2006. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_none_reloc_p (ebl, reloc) + Ebl *ebl; + int reloc; +{ + return ebl->none_reloc_p (reloc); +} diff --git a/libebl/eblobjecttypename.c b/libebl/eblobjecttypename.c index c099c71d..ce100e7f 100644 --- a/libebl/eblobjecttypename.c +++ b/libebl/eblobjecttypename.c @@ -1,16 +1,52 @@ /* Return object file type name. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index 5adff18e..836ac8dc 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -1,16 +1,52 @@ /* Print contents of object file note. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -34,48 +70,71 @@ ebl_object_note (ebl, name, type, descsz, desc) /* The machine specific function did not know this type. */ switch (type) { - case NT_VERSION: - if (strcmp (name, "GNU") == 0 && descsz >= 8) + case NT_GNU_BUILD_ID: + if (strcmp (name, "GNU") == 0 && descsz > 0) + { + printf (gettext (" Build ID: ")); + uint_fast32_t i; + for (i = 0; i < descsz - 1; ++i) + printf ("%02" PRIx8, (uint8_t) desc[i]); + printf ("%02" PRIx8 "\n", (uint8_t) desc[i]); + } + break; + + case NT_GNU_ABI_TAG: + if (strcmp (name, "GNU") == 0 && descsz >= 8 && descsz % 4 == 0) { - struct - { - uint32_t os; - uint32_t version[descsz / 4 - 1]; - } *tag = (__typeof (tag)) desc; - - const char *os; - switch (tag->os) + Elf_Data in = + { + .d_version = EV_CURRENT, + .d_type = ELF_T_WORD, + .d_size = descsz, + .d_buf = (void *) desc + }; + uint32_t buf[descsz / 4]; + Elf_Data out = + { + .d_version = EV_CURRENT, + .d_type = ELF_T_WORD, + .d_size = descsz, + .d_buf = buf + }; + + if (elf32_xlatetom (&out, &in, ebl->data) != NULL) { - case ELF_NOTE_OS_LINUX: - os = "Linux"; - break; + const char *os; + switch (buf[0]) + { + case ELF_NOTE_OS_LINUX: + os = "Linux"; + break; - case ELF_NOTE_OS_GNU: - os = "GNU"; - break; + case ELF_NOTE_OS_GNU: + os = "GNU"; + break; - case ELF_NOTE_OS_SOLARIS2: - os = "Solaris"; - break; + case ELF_NOTE_OS_SOLARIS2: + os = "Solaris"; + break; - case ELF_NOTE_OS_FREEBSD: - os = "FreeBSD"; - break; + case ELF_NOTE_OS_FREEBSD: + os = "FreeBSD"; + break; - default: - os = "???"; - break; - } + default: + os = "???"; + break; + } - printf (gettext (" OS: %s, ABI: "), os); - size_t cnt; - for (cnt = 0; cnt < descsz / 4 - 1; ++cnt) - { - if (cnt != 0) - putchar_unlocked ('.'); - printf ("%" PRIu32, tag->version[cnt]); + printf (gettext (" OS: %s, ABI: "), os); + for (size_t cnt = 1; cnt < descsz / 4; ++cnt) + { + if (cnt > 1) + putchar_unlocked ('.'); + printf ("%" PRIu32, buf[cnt]); + } + putchar_unlocked ('\n'); } - putchar_unlocked ('\n'); break; } /* FALLTHROUGH */ diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index a963cefb..ff9330f9 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -1,16 +1,52 @@ /* Return note type name. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -36,6 +72,8 @@ ebl_object_note_type_name (ebl, type, buf, len) { #define KNOWNSTYPE(name) [NT_##name] = #name KNOWNSTYPE (VERSION), + KNOWNSTYPE (GNU_HWCAP), + KNOWNSTYPE (GNU_BUILD_ID), }; /* Handle standard names. */ diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index c801a6a0..8cf42189 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -1,15 +1,51 @@ /* Generate ELF backend handle. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -18,9 +54,11 @@ #include <assert.h> #include <dlfcn.h> #include <error.h> -#include <gelf.h> +#include <libelfP.h> +#include <dwarf.h> #include <stdlib.h> #include <string.h> +#include <stdio.h> #include <libeblP.h> @@ -36,83 +74,83 @@ static const struct const char *prefix; int prefix_len; int em; + int class; + int data; } machines[] = { - { "i386", "elf_i386", "i386", 4, EM_386 }, - { "ia64", "elf_ia64", "ia64", 4, EM_IA_64 }, - { "alpha", "elf_alpha", "alpha", 5, EM_ALPHA }, - { "x86_64", "elf_x86_64", "x86_64", 6, EM_X86_64 }, - { "sh", "elf_sh", "sh", 2, EM_SH }, - { "arm", "ebl_arm", "arm", 3, EM_ARM }, - { "sparc", "elf_sparcv9", "sparc", 5, EM_SPARCV9 }, - { "sparc", "elf_sparc", "sparc", 5, EM_SPARC }, - { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS }, - - { "m32", "elf_m32", "m32", 3, EM_M32 }, - { "m68k", "elf_m68k", "m68k", 4, EM_68K }, - { "m88k", "elf_m88k", "m88k", 4, EM_88K }, - { "i860", "elf_i860", "i860", 4, EM_860 }, - { "mips", "elf_mips", "mips", 4, EM_MIPS }, - { "s370", "ebl_s370", "s370", 4, EM_S370 }, - { "mips", "elf_mipsel", "mips", 4, EM_MIPS_RS3_LE }, - { "parisc", "elf_parisc", "parisc", 6, EM_PARISC }, - { "vpp500", "elf_vpp500", "vpp500", 5, EM_VPP500 }, - { "sparc", "elf_v8plus", "v8plus", 6, EM_SPARC32PLUS }, - { "i960", "elf_i960", "i960", 4, EM_960 }, - { "ppc", "elf_ppc", "ppc", 3, EM_PPC }, - { "ppc64", "elf_ppc64", "ppc64", 5, EM_PPC64 }, - { "s390", "ebl_s390", "s390", 4, EM_S390 }, - { "v800", "ebl_v800", "v800", 4, EM_V800 }, - { "fr20", "ebl_fr20", "fr20", 4, EM_FR20 }, - { "rh32", "ebl_rh32", "rh32", 4, EM_RH32 }, - { "rce", "ebl_rce", "rce", 3, EM_RCE }, - { "tricore", "elf_tricore", "tricore", 7, EM_TRICORE }, - { "arc", "elf_arc", "arc", 3, EM_ARC }, - { "h8", "elf_h8_300", "h8_300", 6, EM_H8_300 }, - { "h8", "elf_h8_300h", "h8_300h", 6, EM_H8_300H }, - { "h8", "elf_h8s", "h8s", 6, EM_H8S }, - { "h8", "elf_h8_500", "h8_500", 6, EM_H8_500 }, - { "mips_x", "elf_mips_x", "mips_x", 6, EM_MIPS_X }, - { "coldfire", "elf_coldfire", "coldfire", 8, EM_COLDFIRE }, - { "m68k", "elf_68hc12", "68hc12", 6, EM_68HC12 }, - { "mma", "elf_mma", "mma", 3, EM_MMA }, - { "pcp", "elf_pcp", "pcp", 3, EM_PCP }, - { "ncpu", "elf_ncpu", "ncpu", 4, EM_NCPU }, - { "ndr1", "elf_ndr1", "ndr1", 4, EM_NDR1 }, - { "starcore", "elf_starcore", "starcore", 8, EM_STARCORE }, - { "me16", "elf_me16", "em16", 4, EM_ME16 }, - { "st100", "elf_st100", "st100", 5, EM_ST100 }, - { "tinyj", "elf_tinyj", "tinyj", 5, EM_TINYJ }, - { "pdsp", "elf_pdsp", "pdsp", 4, EM_PDSP }, - { "fx66", "elf_fx66", "fx66", 4, EM_FX66 }, - { "st9plus", "elf_st9plus", "st9plus", 7, EM_ST9PLUS }, - { "st7", "elf_st7", "st7", 3, EM_ST7 }, - { "m68k", "elf_68hc16", "68hc16", 6, EM_68HC16 }, - { "m68k", "elf_68hc11", "68hc11", 6, EM_68HC11 }, - { "m68k", "elf_68hc08", "68hc08", 6, EM_68HC08 }, - { "m68k", "elf_68hc05", "68hc05", 6, EM_68HC05 }, - { "svx", "elf_svx", "svx", 3, EM_SVX }, - { "st19", "elf_st19", "st19", 4, EM_ST19 }, - { "vax", "elf_vax", "vax", 3, EM_VAX }, - { "cris", "elf_cris", "cris", 4, EM_CRIS }, - { "javelin", "elf_javelin", "javelin", 7, EM_JAVELIN }, - { "firepath", "elf_firepath", "firepath", 8, EM_FIREPATH }, - { "zsp", "elf_zsp", "zsp", 3, EM_ZSP}, - { "mmix", "elf_mmix", "mmix", 4, EM_MMIX }, - { "hunay", "elf_huany", "huany", 5, EM_HUANY }, - { "prism", "elf_prism", "prism", 5, EM_PRISM }, - { "avr", "elf_avr", "avr", 3, EM_AVR }, - { "fr30", "elf_fr30", "fr30", 4, EM_FR30 }, - { "dv10", "elf_dv10", "dv10", 4, EM_D10V }, - { "dv30", "elf_dv30", "dv30", 4, EM_D30V }, - { "v850", "elf_v850", "v850", 4, EM_V850 }, - { "m32r", "elf_m32r", "m32r", 4, EM_M32R }, - { "mn10300", "elf_mn10300", "mn10300", 7, EM_MN10300 }, - { "mn10200", "elf_mn10200", "mn10200", 7, EM_MN10200 }, - { "pj", "elf_pj", "pj", 2, EM_PJ }, - { "openrisc", "elf_openrisc", "openrisc", 8, EM_OPENRISC }, - { "arc", "elf_arc_a5", "arc_a5", 6, EM_ARC_A5 }, - { "xtensa", "elf_xtensa", "xtensa", 6, EM_XTENSA }, + { "i386", "elf_i386", "i386", 4, EM_386, ELFCLASS32, ELFDATA2LSB }, + { "ia64", "elf_ia64", "ia64", 4, EM_IA_64, ELFCLASS64, ELFDATA2LSB }, + { "alpha", "elf_alpha", "alpha", 5, EM_ALPHA, ELFCLASS64, ELFDATA2LSB }, + { "x86_64", "elf_x86_64", "x86_64", 6, EM_X86_64, ELFCLASS64, ELFDATA2LSB }, + { "ppc", "elf_ppc", "ppc", 3, EM_PPC, ELFCLASS32, ELFDATA2MSB }, + { "ppc64", "elf_ppc64", "ppc64", 5, EM_PPC64, ELFCLASS64, ELFDATA2MSB }, + // XXX class and machine fields need to be filled in for all archs. + { "sh", "elf_sh", "sh", 2, EM_SH, 0, 0 }, + { "arm", "ebl_arm", "arm", 3, EM_ARM, 0, 0 }, + { "sparc", "elf_sparcv9", "sparc", 5, EM_SPARCV9, 0, 0 }, + { "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 }, + { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 }, + { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 }, + + { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 }, + { "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 }, + { "m88k", "elf_m88k", "m88k", 4, EM_88K, 0, 0 }, + { "i860", "elf_i860", "i860", 4, EM_860, 0, 0 }, + { "s370", "ebl_s370", "s370", 4, EM_S370, 0, 0 }, + { "parisc", "elf_parisc", "parisc", 6, EM_PARISC, 0, 0 }, + { "vpp500", "elf_vpp500", "vpp500", 5, EM_VPP500, 0, 0 }, + { "sparc", "elf_v8plus", "v8plus", 6, EM_SPARC32PLUS, 0, 0 }, + { "i960", "elf_i960", "i960", 4, EM_960, 0, 0 }, + { "v800", "ebl_v800", "v800", 4, EM_V800, 0, 0 }, + { "fr20", "ebl_fr20", "fr20", 4, EM_FR20, 0, 0 }, + { "rh32", "ebl_rh32", "rh32", 4, EM_RH32, 0, 0 }, + { "rce", "ebl_rce", "rce", 3, EM_RCE, 0, 0 }, + { "tricore", "elf_tricore", "tricore", 7, EM_TRICORE, 0, 0 }, + { "arc", "elf_arc", "arc", 3, EM_ARC, 0, 0 }, + { "h8", "elf_h8_300", "h8_300", 6, EM_H8_300, 0, 0 }, + { "h8", "elf_h8_300h", "h8_300h", 6, EM_H8_300H, 0, 0 }, + { "h8", "elf_h8s", "h8s", 6, EM_H8S, 0, 0 }, + { "h8", "elf_h8_500", "h8_500", 6, EM_H8_500, 0, 0 }, + { "coldfire", "elf_coldfire", "coldfire", 8, EM_COLDFIRE, 0, 0 }, + { "m68k", "elf_68hc12", "68hc12", 6, EM_68HC12, 0, 0 }, + { "mma", "elf_mma", "mma", 3, EM_MMA, 0, 0 }, + { "pcp", "elf_pcp", "pcp", 3, EM_PCP, 0, 0 }, + { "ncpu", "elf_ncpu", "ncpu", 4, EM_NCPU, 0, 0 }, + { "ndr1", "elf_ndr1", "ndr1", 4, EM_NDR1, 0, 0 }, + { "starcore", "elf_starcore", "starcore", 8, EM_STARCORE, 0, 0 }, + { "me16", "elf_me16", "em16", 4, EM_ME16, 0, 0 }, + { "st100", "elf_st100", "st100", 5, EM_ST100, 0, 0 }, + { "tinyj", "elf_tinyj", "tinyj", 5, EM_TINYJ, 0, 0 }, + { "pdsp", "elf_pdsp", "pdsp", 4, EM_PDSP, 0, 0 }, + { "fx66", "elf_fx66", "fx66", 4, EM_FX66, 0, 0 }, + { "st9plus", "elf_st9plus", "st9plus", 7, EM_ST9PLUS, 0, 0 }, + { "st7", "elf_st7", "st7", 3, EM_ST7, 0, 0 }, + { "m68k", "elf_68hc16", "68hc16", 6, EM_68HC16, 0, 0 }, + { "m68k", "elf_68hc11", "68hc11", 6, EM_68HC11, 0, 0 }, + { "m68k", "elf_68hc08", "68hc08", 6, EM_68HC08, 0, 0 }, + { "m68k", "elf_68hc05", "68hc05", 6, EM_68HC05, 0, 0 }, + { "svx", "elf_svx", "svx", 3, EM_SVX, 0, 0 }, + { "st19", "elf_st19", "st19", 4, EM_ST19, 0, 0 }, + { "vax", "elf_vax", "vax", 3, EM_VAX, 0, 0 }, + { "cris", "elf_cris", "cris", 4, EM_CRIS, 0, 0 }, + { "javelin", "elf_javelin", "javelin", 7, EM_JAVELIN, 0, 0 }, + { "firepath", "elf_firepath", "firepath", 8, EM_FIREPATH, 0, 0 }, + { "zsp", "elf_zsp", "zsp", 3, EM_ZSP, 0, 0 }, + { "mmix", "elf_mmix", "mmix", 4, EM_MMIX, 0, 0 }, + { "hunay", "elf_huany", "huany", 5, EM_HUANY, 0, 0 }, + { "prism", "elf_prism", "prism", 5, EM_PRISM, 0, 0 }, + { "avr", "elf_avr", "avr", 3, EM_AVR, 0, 0 }, + { "fr30", "elf_fr30", "fr30", 4, EM_FR30, 0, 0 }, + { "dv10", "elf_dv10", "dv10", 4, EM_D10V, 0, 0 }, + { "dv30", "elf_dv30", "dv30", 4, EM_D30V, 0, 0 }, + { "v850", "elf_v850", "v850", 4, EM_V850, 0, 0 }, + { "m32r", "elf_m32r", "m32r", 4, EM_M32R, 0, 0 }, + { "mn10300", "elf_mn10300", "mn10300", 7, EM_MN10300, 0, 0 }, + { "mn10200", "elf_mn10200", "mn10200", 7, EM_MN10200, 0, 0 }, + { "pj", "elf_pj", "pj", 2, EM_PJ, 0, 0 }, + { "openrisc", "elf_openrisc", "openrisc", 8, EM_OPENRISC, 0, 0 }, + { "arc", "elf_arc_a5", "arc_a5", 6, EM_ARC_A5, 0, 0 }, + { "xtensa", "elf_xtensa", "xtensa", 6, EM_XTENSA, 0, 0 }, }; #define nmachines (sizeof (machines) / sizeof (machines[0])) @@ -123,6 +161,7 @@ static const char *default_object_type_name (int ignore, char *buf, static const char *default_reloc_type_name (int ignore, char *buf, size_t len); static bool default_reloc_type_check (int ignore); static bool default_reloc_valid_use (Elf *elf, int ignore); +static Elf_Type default_reloc_simple_type (Ebl *ebl, int ignore); static bool default_gotpc_reloc_check (Elf *elf, int ignore); static const char *default_segment_type_name (int ignore, char *buf, size_t len); @@ -132,6 +171,7 @@ static const char *default_section_name (int ignore, int ignore2, char *buf, size_t len); static const char *default_machine_flag_name (Elf64_Word *ignore); static bool default_machine_flag_check (Elf64_Word flags); +static bool default_machine_section_flag_check (GElf_Xword flags); static const char *default_symbol_type_name (int ignore, char *buf, size_t len); static const char *default_symbol_binding_name (int ignore, char *buf, @@ -146,46 +186,56 @@ static const char *default_core_note_type_name (uint32_t, char *buf, size_t len); static const char *default_object_note_type_name (uint32_t, char *buf, size_t len); -static bool default_core_note (const char *name, uint32_t type, - uint32_t descsz, const char *desc); +static int default_core_note (GElf_Word n_type, GElf_Word descsz, + GElf_Word *regs_offset, size_t *nregloc, + const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **); +static int default_auxv_info (GElf_Xword a_type, + const char **name, const char **format); static bool default_object_note (const char *name, uint32_t type, uint32_t descsz, const char *desc); static bool default_debugscn_p (const char *name); +static bool default_copy_reloc_p (int reloc); +static bool default_none_reloc_p (int reloc); +static bool default_relative_reloc_p (int reloc); +static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, + const GElf_Sym *sym, + const char *name, + const GElf_Shdr *destshdr); +static bool default_check_special_section (Ebl *, int, + const GElf_Shdr *, const char *); +static bool default_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr); +static int default_return_value_location (Dwarf_Die *functypedie, + const Dwarf_Op **locops); +static ssize_t default_register_info (Ebl *ebl, + int regno, char *name, size_t namelen, + const char **prefix, + const char **setname, + int *bits, int *type); +static int default_syscall_abi (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); +static bool default_check_object_attribute (Ebl *ebl, const char *vendor, + int tag, uint64_t value, + const char **tag_name, + const char **value_name); -/* Find an appropriate backend for the file associated with ELF. */ -static Ebl * -openbackend (elf, emulation, machine) - Elf *elf; - const char *emulation; - GElf_Half machine; +static void +fill_defaults (Ebl *result) { - Ebl *result; - size_t cnt; - - /* First allocate the data structure for the result. We do this - here since this assures that the structure is always large - enough. */ - result = (Ebl *) calloc (1, sizeof (Ebl)); - if (result == NULL) - { - // XXX uncomment - // __libebl_seterror (ELF_E_NOMEM); - return NULL; - } - - /* Fill in the default callbacks. The initializer for the machine - specific module can overwrite the values. */ result->object_type_name = default_object_type_name; result->reloc_type_name = default_reloc_type_name; result->reloc_type_check = default_reloc_type_check; result->reloc_valid_use = default_reloc_valid_use; + result->reloc_simple_type = default_reloc_simple_type; result->gotpc_reloc_check = default_gotpc_reloc_check; result->segment_type_name = default_segment_type_name; result->section_type_name = default_section_type_name; result->section_name = default_section_name; result->machine_flag_name = default_machine_flag_name; result->machine_flag_check = default_machine_flag_check; + result->machine_section_flag_check = default_machine_section_flag_check; + result->check_special_section = default_check_special_section; result->symbol_type_name = default_symbol_type_name; result->symbol_binding_name = default_symbol_binding_name; result->dynamic_tag_name = default_dynamic_tag_name; @@ -195,9 +245,48 @@ openbackend (elf, emulation, machine) result->core_note_type_name = default_core_note_type_name; result->object_note_type_name = default_object_note_type_name; result->core_note = default_core_note; + result->auxv_info = default_auxv_info; result->object_note = default_object_note; result->debugscn_p = default_debugscn_p; + result->copy_reloc_p = default_copy_reloc_p; + result->none_reloc_p = default_none_reloc_p; + result->relative_reloc_p = default_relative_reloc_p; + result->check_special_symbol = default_check_special_symbol; + result->bss_plt_p = default_bss_plt_p; + result->return_value_location = default_return_value_location; + result->register_info = default_register_info; + result->syscall_abi = default_syscall_abi; + result->check_object_attribute = default_check_object_attribute; + result->disasm = NULL; result->destr = default_destr; + result->sysvhash_entrysize = sizeof (Elf32_Word); +} + + +/* Find an appropriate backend for the file associated with ELF. */ +static Ebl * +openbackend (elf, emulation, machine) + Elf *elf; + const char *emulation; + GElf_Half machine; +{ + Ebl *result; + size_t cnt; + + /* First allocate the data structure for the result. We do this + here since this assures that the structure is always large + enough. */ + result = (Ebl *) calloc (1, sizeof (Ebl)); + if (result == NULL) + { + // XXX uncomment + // __libebl_seterror (ELF_E_NOMEM); + return NULL; + } + + /* Fill in the default callbacks. The initializer for the machine + specific module can overwrite the values. */ + fill_defaults (result); /* XXX Currently all we do is to look at 'e_machine' value in the ELF header. With an internal mapping table from EM_* value to @@ -215,11 +304,38 @@ openbackend (elf, emulation, machine) /* Well, we know the emulation name now. */ result->emulation = machines[cnt].emulation; + /* We access some data structures directly. Make sure the 32 and + 64 bit variants are laid out the same. */ + assert (offsetof (Elf32_Ehdr, e_machine) + == offsetof (Elf64_Ehdr, e_machine)); + assert (sizeof (((Elf32_Ehdr *) 0)->e_machine) + == sizeof (((Elf64_Ehdr *) 0)->e_machine)); + assert (offsetof (Elf, state.elf32.ehdr) + == offsetof (Elf, state.elf64.ehdr)); + + /* Prefer taking the information from the ELF file. */ + if (elf == NULL) + { + result->machine = machines[cnt].em; + result->class = machines[cnt].class; + result->data = machines[cnt].data; + } + else + { + result->machine = elf->state.elf32.ehdr->e_machine; + result->class = elf->state.elf32.ehdr->e_ident[EI_CLASS]; + result->data = elf->state.elf32.ehdr->e_ident[EI_DATA]; + } + +#ifndef LIBEBL_SUBDIR +# define LIBEBL_SUBDIR PACKAGE +#endif +#define ORIGINDIR "$ORIGIN/../$LIB/" LIBEBL_SUBDIR "/" + /* Give it a try. At least the machine type matches. First try to load the module. */ char dsoname[100]; - strcpy (stpcpy (stpcpy (dsoname, - "$ORIGIN/../" LIBSTR "/elfutils/libebl_"), + strcpy (stpcpy (stpcpy (dsoname, ORIGINDIR "libebl_"), machines[cnt].dsoname), ".so"); @@ -237,6 +353,8 @@ openbackend (elf, emulation, machine) { /* We managed to load the object. Now see whether the initialization function likes our file. */ + static const char version[] = MODVERSION; + const char *modversion; ebl_bhinit_t initp; char symname[machines[cnt].prefix_len + sizeof "_init"]; @@ -245,7 +363,8 @@ openbackend (elf, emulation, machine) initp = (ebl_bhinit_t) dlsym (h, symname); if (initp != NULL - && initp (elf, machine, result, sizeof (Ebl)) == 0) + && (modversion = initp (elf, machine, result, sizeof (Ebl))) + && strcmp (version, modversion) == 0) { /* We found a module to handle our file. */ result->dlhandle = h; @@ -267,6 +386,7 @@ openbackend (elf, emulation, machine) result->dlhandle = NULL; result->elf = elf; result->name = machines[cnt].prefix; + fill_defaults (result); return result; } @@ -276,6 +396,7 @@ openbackend (elf, emulation, machine) result->elf = elf; result->emulation = "<unknown>"; result->name = "<unknown>"; + fill_defaults (result); return result; } @@ -321,85 +442,126 @@ ebl_openbackend_emulation (const char *emulation) /* Default callbacks. Mostly they just return the error value. */ static const char * -default_object_type_name (int ignore, char *buf, size_t len) +default_object_type_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_reloc_type_name (int ignore, char *buf, size_t len) +default_reloc_type_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static bool -default_reloc_type_check (int ignore) +default_reloc_type_check (int ignore __attribute__ ((unused))) { return false; } static bool -default_reloc_valid_use (Elf *elf, int ignore) +default_reloc_valid_use (Elf *elf __attribute__ ((unused)), + int ignore __attribute__ ((unused))) { return false; } +static Elf_Type +default_reloc_simple_type (Ebl *eh __attribute__ ((unused)), + int ignore __attribute__ ((unused))) +{ + return ELF_T_NUM; +} + static bool -default_gotpc_reloc_check (Elf *elf, int ignore) +default_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), + int ignore __attribute__ ((unused))) { return false; } static const char * -default_segment_type_name (int ignore, char *buf, size_t len) +default_segment_type_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_section_type_name (int ignore, char *buf, size_t len) +default_section_type_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_section_name (int ignore, int ignore2, char *buf, size_t len) +default_section_name (int ignore __attribute__ ((unused)), + int ignore2 __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_machine_flag_name (Elf64_Word *ignore) +default_machine_flag_name (Elf64_Word *ignore __attribute__ ((unused))) { return NULL; } static bool -default_machine_flag_check (Elf64_Word flags) +default_machine_flag_check (Elf64_Word flags __attribute__ ((unused))) +{ + return flags == 0; +} + +static bool +default_machine_section_flag_check (GElf_Xword flags) { return flags == 0; } +static bool +default_check_special_section (Ebl *ebl __attribute__ ((unused)), + int ndx __attribute__ ((unused)), + const GElf_Shdr *shdr __attribute__ ((unused)), + const char *sname __attribute__ ((unused))) +{ + return false; +} + static const char * -default_symbol_type_name (int ignore, char *buf, size_t len) +default_symbol_type_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_symbol_binding_name (int ignore, char *buf, size_t len) +default_symbol_binding_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_dynamic_tag_name (int64_t ignore, char *buf, size_t len) +default_dynamic_tag_name (int64_t ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static bool -default_dynamic_tag_check (int64_t ignore) +default_dynamic_tag_check (int64_t ignore __attribute__ ((unused))) { return false; } @@ -411,38 +573,60 @@ default_sh_flags_combine (GElf_Word flags1, GElf_Word flags2) } static void -default_destr (struct ebl *ignore) +default_destr (struct ebl *ignore __attribute__ ((unused))) { } static const char * -default_osabi_name (int ignore, char *buf, size_t len) +default_osabi_name (int ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static const char * -default_core_note_type_name (uint32_t ignore, char *buf, size_t len) +default_core_note_type_name (uint32_t ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } -static const char * -default_object_note_type_name (uint32_t ignore, char *buf, size_t len) +static int +default_auxv_info (GElf_Xword a_type __attribute__ ((unused)), + const char **name __attribute__ ((unused)), + const char **format __attribute__ ((unused))) { - return NULL; + return 0; } -static bool -default_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc) +static int +default_core_note (GElf_Word n_type __attribute__ ((unused)), + GElf_Word descsz __attribute__ ((unused)), + GElf_Word *ro __attribute__ ((unused)), + size_t *nregloc __attribute__ ((unused)), + const Ebl_Register_Location **reglocs + __attribute__ ((unused)), + size_t *nitems __attribute__ ((unused)), + const Ebl_Core_Item **items __attribute__ ((unused))) +{ + return 0; +} + +static const char * +default_object_note_type_name (uint32_t ignore __attribute__ ((unused)), + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) { return NULL; } static bool -default_object_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc) +default_object_note (const char *name __attribute__ ((unused)), + uint32_t type __attribute__ ((unused)), + uint32_t descsz __attribute__ ((unused)), + const char *desc __attribute__ ((unused))) { return NULL; } @@ -481,11 +665,84 @@ default_debugscn_p (const char *name) }; const size_t ndwarf_scn_names = (sizeof (dwarf_scn_names) / sizeof (dwarf_scn_names[0])); - size_t cnt; - - for (cnt = 0; cnt < ndwarf_scn_names; ++cnt) + for (size_t cnt = 0; cnt < ndwarf_scn_names; ++cnt) if (strcmp (name, dwarf_scn_names[cnt]) == 0) return true; return false; } + +static bool +default_copy_reloc_p (int reloc __attribute__ ((unused))) +{ + return false; +} +strong_alias (default_copy_reloc_p, default_none_reloc_p) +strong_alias (default_copy_reloc_p, default_relative_reloc_p) + +static bool +default_check_special_symbol (Elf *elf __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + const GElf_Sym *sym __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + const GElf_Shdr *destshdr __attribute__ ((unused))) +{ + return false; +} + +static bool +default_bss_plt_p (Elf *elf __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused))) +{ + return false; +} + +static int +default_return_value_location (Dwarf_Die *functypedie __attribute__ ((unused)), + const Dwarf_Op **locops __attribute__ ((unused))) +{ + return -2; +} + +static ssize_t +default_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, + const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 0; + + *setname = "???"; + *prefix = ""; + *bits = -1; + *type = DW_ATE_void; + return snprintf (name, namelen, "reg%d", regno); +} + +static int +default_syscall_abi (Ebl *ebl __attribute__ ((unused)), + int *sp, int *pc, int *callno, int args[6]) +{ + *sp = *pc = *callno = -1; + args[0] = -1; + args[1] = -1; + args[2] = -1; + args[3] = -1; + args[4] = -1; + args[5] = -1; + return -1; +} + +static bool +default_check_object_attribute (Ebl *ebl __attribute__ ((unused)), + const char *vendor __attribute__ ((unused)), + int tag __attribute__ ((unused)), + uint64_t value __attribute__ ((unused)), + const char **tag_name, const char **value_name) +{ + *tag_name = NULL; + *value_name = NULL; + return false; +} diff --git a/libebl/eblosabiname.c b/libebl/eblosabiname.c index 9a1e6534..3b38b441 100644 --- a/libebl/eblosabiname.c +++ b/libebl/eblosabiname.c @@ -1,16 +1,52 @@ /* Return OS ABI name Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblreginfo.c b/libebl/eblreginfo.c new file mode 100644 index 00000000..8fc4abfa --- /dev/null +++ b/libebl/eblreginfo.c @@ -0,0 +1,71 @@ +/* Return register name information. + Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <libeblP.h> + + +ssize_t +ebl_register_info (ebl, regno, name, namelen, prefix, setname, bits, type) + Ebl *ebl; + int regno; + char *name; + size_t namelen; + const char **prefix; + const char **setname; + int *bits; + int *type; +{ + return ebl == NULL ? -1 : ebl->register_info (ebl, regno, name, namelen, + prefix, setname, bits, type); +} diff --git a/libebl/eblrelativerelocp.c b/libebl/eblrelativerelocp.c new file mode 100644 index 00000000..8ea97b88 --- /dev/null +++ b/libebl/eblrelativerelocp.c @@ -0,0 +1,64 @@ +/* Check whether given relocation is a relocation relocation. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2006. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_relative_reloc_p (ebl, reloc) + Ebl *ebl; + int reloc; +{ + return ebl->relative_reloc_p (reloc); +} diff --git a/libebl/eblrelocsimpletype.c b/libebl/eblrelocsimpletype.c new file mode 100644 index 00000000..87eb5a89 --- /dev/null +++ b/libebl/eblrelocsimpletype.c @@ -0,0 +1,63 @@ +/* Check relocation type for simple types. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +Elf_Type +ebl_reloc_simple_type (ebl, reloc) + Ebl *ebl; + int reloc; +{ + return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc) : ELF_T_NUM; +} diff --git a/libebl/eblreloctypecheck.c b/libebl/eblreloctypecheck.c index cafbc611..576073cb 100644 --- a/libebl/eblreloctypecheck.c +++ b/libebl/eblreloctypecheck.c @@ -1,16 +1,52 @@ /* Check relocation type. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblreloctypename.c b/libebl/eblreloctypename.c index 5fa95608..c715b064 100644 --- a/libebl/eblreloctypename.c +++ b/libebl/eblreloctypename.c @@ -1,16 +1,52 @@ /* Return relocation type name. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblrelocvaliduse.c b/libebl/eblrelocvaliduse.c index 74889861..40f27157 100644 --- a/libebl/eblrelocvaliduse.c +++ b/libebl/eblrelocvaliduse.c @@ -1,16 +1,52 @@ /* Check relocation type use. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblretval.c b/libebl/eblretval.c new file mode 100644 index 00000000..56dc30ff --- /dev/null +++ b/libebl/eblretval.c @@ -0,0 +1,65 @@ +/* Return location expression to find return value given a function type DIE. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <libeblP.h> + + +int +ebl_return_value_location (ebl, functypedie, locops) + Ebl *ebl; + Dwarf_Die *functypedie; + const Dwarf_Op **locops; +{ + return ebl == NULL ? -1 : ebl->return_value_location (functypedie, locops); +} diff --git a/libebl/eblsectionname.c b/libebl/eblsectionname.c index 6c801db6..f1c2b56a 100644 --- a/libebl/eblsectionname.c +++ b/libebl/eblsectionname.c @@ -1,16 +1,52 @@ /* Return section name. Copyright (C) 2001, 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblsectionstripp.c b/libebl/eblsectionstripp.c new file mode 100644 index 00000000..9aa7502c --- /dev/null +++ b/libebl/eblsectionstripp.c @@ -0,0 +1,88 @@ +/* Check whether section can be stripped. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include "libeblP.h" + + +bool +ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr, + const char *name, bool remove_comment, + bool only_remove_debug) +{ + /* If only debug information should be removed check the name. There + is unfortunately no other way. */ + if (unlikely (only_remove_debug)) + { + if (ebl_debugscn_p (ebl, name)) + return true; + + if (shdr->sh_type == SHT_RELA || shdr->sh_type == SHT_REL) + { + Elf_Scn *scn_l = elf_getscn (ebl->elf, (shdr)->sh_info); + GElf_Shdr shdr_mem_l; + GElf_Shdr *shdr_l = gelf_getshdr (scn_l, &shdr_mem_l); + if (shdr_l == NULL) + { + const char *s_l = elf_strptr (ebl->elf, ehdr->e_shstrndx, + shdr_l->sh_name); + if (s_l != NULL && ebl_debugscn_p (ebl, s_l)) + return true; + } + } + + return false; + } + + return SECTION_STRIP_P (shdr, name, remove_comment); +} diff --git a/libebl/eblsectiontypename.c b/libebl/eblsectiontypename.c index e6857acd..a37e5f6d 100644 --- a/libebl/eblsectiontypename.c +++ b/libebl/eblsectiontypename.c @@ -1,16 +1,52 @@ /* Return section type name. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -74,29 +110,38 @@ ebl_section_type_name (ebl, section, buf, len) res = sunwtypes[section - SHT_LOSUNW]; } else - { - /* A few GNU additions. */ - if (section == SHT_CHECKSUM) + /* A few GNU additions. */ + switch (section) + { + case SHT_CHECKSUM: res = "CHECKSUM"; - else if (section == SHT_GNU_LIBLIST) + break; + case SHT_GNU_LIBLIST: res = "GNU_LIBLIST"; - /* Handle OS-specific section names. */ - else - { - if (section >= SHT_LOOS && section <= SHT_HIOS) - snprintf (buf, len, "SHT_LOOS+%x", section - SHT_LOOS); - /* Handle processor-specific section names. */ - else if (section >= SHT_LOPROC && section <= SHT_HIPROC) - snprintf (buf, len, "SHT_LOPROC+%x", section - SHT_LOPROC); - else if ((unsigned int) section >= SHT_LOUSER - && (unsigned int) section <= SHT_HIUSER) - snprintf (buf, len, "SHT_LOUSER+%x", section - SHT_LOUSER); - else - snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section); + break; + case SHT_GNU_HASH: + res = "GNU_HASH"; + break; + case SHT_GNU_ATTRIBUTES: + res = "GNU_ATTRIBUTES"; + break; - res = buf; - } - } + default: + /* Handle OS-specific section names. */ + if (section >= SHT_LOOS && section <= SHT_HIOS) + snprintf (buf, len, "SHT_LOOS+%x", section - SHT_LOOS); + /* Handle processor-specific section names. */ + else if (section >= SHT_LOPROC && section <= SHT_HIPROC) + snprintf (buf, len, "SHT_LOPROC+%x", section - SHT_LOPROC); + else if ((unsigned int) section >= SHT_LOUSER + && (unsigned int) section <= SHT_HIUSER) + snprintf (buf, len, "SHT_LOUSER+%x", section - SHT_LOUSER); + else + snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section); + + res = buf; + break; + } } return res; diff --git a/libebl/eblsegmenttypename.c b/libebl/eblsegmenttypename.c index c59f037d..8c4c2952 100644 --- a/libebl/eblsegmenttypename.c +++ b/libebl/eblsegmenttypename.c @@ -1,16 +1,52 @@ /* Return segment type name. Copyright (C) 2001, 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblshflagscombine.c b/libebl/eblshflagscombine.c index 7edcf4e7..49a65600 100644 --- a/libebl/eblshflagscombine.c +++ b/libebl/eblshflagscombine.c @@ -1,16 +1,52 @@ /* Return combines section header flags value. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblstrtab.c b/libebl/eblstrtab.c index bbf0d6ee..d6ce94ae 100644 --- a/libebl/eblstrtab.c +++ b/libebl/eblstrtab.c @@ -1,16 +1,52 @@ /* ELF string table handling. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -73,15 +109,14 @@ static size_t ps; struct Ebl_Strtab * ebl_strtabinit (bool nullstr) { - struct Ebl_Strtab *ret; - if (ps == 0) { ps = sysconf (_SC_PAGESIZE) - 2 * sizeof (void *); assert (sizeof (struct memoryblock) < ps); } - ret = (struct Ebl_Strtab *) calloc (1, sizeof (struct Ebl_Strtab)); + struct Ebl_Strtab *ret + = (struct Ebl_Strtab *) calloc (1, sizeof (struct Ebl_Strtab)); if (ret != NULL) { ret->nullstr = nullstr; @@ -100,11 +135,10 @@ ebl_strtabinit (bool nullstr) static int morememory (struct Ebl_Strtab *st, size_t len) { - struct memoryblock *newmem; - if (len < ps) len = ps; - newmem = (struct memoryblock *) malloc (len); + + struct memoryblock *newmem = (struct memoryblock *) malloc (len); if (newmem == NULL) return 1; @@ -136,15 +170,11 @@ ebl_strtabfree (struct Ebl_Strtab *st) static struct Ebl_Strent * newstring (struct Ebl_Strtab *st, const char *str, size_t len) { - struct Ebl_Strent *newstr; - size_t align; - int i; - /* Compute the amount of padding needed to make the structure aligned. */ - align = ((__alignof__ (struct Ebl_Strent) - - (((uintptr_t) st->backp) - & (__alignof__ (struct Ebl_Strent) - 1))) - & (__alignof__ (struct Ebl_Strent) - 1)); + size_t align = ((__alignof__ (struct Ebl_Strent) + - (((uintptr_t) st->backp) + & (__alignof__ (struct Ebl_Strent) - 1))) + & (__alignof__ (struct Ebl_Strent) - 1)); /* Make sure there is enough room in the memory block. */ if (st->left < align + sizeof (struct Ebl_Strent) + len) @@ -156,14 +186,14 @@ newstring (struct Ebl_Strtab *st, const char *str, size_t len) } /* Create the reserved string. */ - newstr = (struct Ebl_Strent *) (st->backp + align); + struct Ebl_Strent *newstr = (struct Ebl_Strent *) (st->backp + align); newstr->string = str; newstr->len = len; newstr->next = NULL; newstr->left = NULL; newstr->right = NULL; newstr->offset = 0; - for (i = len - 2; i >= 0; --i) + for (int i = len - 2; i >= 0; --i) newstr->reverse[i] = str[len - 2 - i]; newstr->reverse[len - 1] = '\0'; st->backp += align + sizeof (struct Ebl_Strent) + len; @@ -179,8 +209,6 @@ newstring (struct Ebl_Strtab *st, const char *str, size_t len) static struct Ebl_Strent ** searchstring (struct Ebl_Strent **sep, struct Ebl_Strent *newstr) { - int cmpres; - /* More strings? */ if (*sep == NULL) { @@ -189,8 +217,8 @@ searchstring (struct Ebl_Strent **sep, struct Ebl_Strent *newstr) } /* Compare the strings. */ - cmpres = memcmp ((*sep)->reverse, newstr->reverse, - MIN ((*sep)->len, newstr->len) - 1); + int cmpres = memcmp ((*sep)->reverse, newstr->reverse, + MIN ((*sep)->len, newstr->len) - 1); if (cmpres == 0) /* We found a matching string. */ return sep; @@ -205,9 +233,6 @@ searchstring (struct Ebl_Strent **sep, struct Ebl_Strent *newstr) struct Ebl_Strent * ebl_strtabadd (struct Ebl_Strtab *st, const char *str, size_t len) { - struct Ebl_Strent *newstr; - struct Ebl_Strent **sep; - /* Compute the string length if the caller doesn't know it. */ if (len == 0) len = strlen (str) + 1; @@ -218,23 +243,22 @@ ebl_strtabadd (struct Ebl_Strtab *st, const char *str, size_t len) return &st->null; /* Allocate memory for the new string and its associated information. */ - newstr = newstring (st, str, len); + struct Ebl_Strent *newstr = newstring (st, str, len); if (newstr == NULL) return NULL; /* Search in the array for the place to insert the string. If there is no string with matching prefix and no string with matching leading substring, create a new entry. */ - sep = searchstring (&st->root, newstr); + struct Ebl_Strent **sep = searchstring (&st->root, newstr); if (*sep != newstr) { /* This is not the same entry. This means we have a prefix match. */ if ((*sep)->len > newstr->len) { - struct Ebl_Strent *subs; - /* Check whether we already know this string. */ - for (subs = (*sep)->next; subs != NULL; subs = subs->next) + for (struct Ebl_Strent *subs = (*sep)->next; subs != NULL; + subs = subs->next) if (subs->len == newstr->len) { /* We have an exact match with a substring. Free the memory @@ -283,8 +307,6 @@ ebl_strtabadd (struct Ebl_Strtab *st, const char *str, size_t len) static void copystrings (struct Ebl_Strent *nodep, char **freep, size_t *offsetp) { - struct Ebl_Strent *subs; - if (nodep->left != NULL) copystrings (nodep->left, freep, offsetp); @@ -293,7 +315,7 @@ copystrings (struct Ebl_Strent *nodep, char **freep, size_t *offsetp) *freep = (char *) mempcpy (*freep, nodep->string, nodep->len); *offsetp += nodep->len; - for (subs = nodep->next; subs != NULL; subs = subs->next) + for (struct Ebl_Strent *subs = nodep->next; subs != NULL; subs = subs->next) { assert (subs->len < nodep->len); subs->offset = nodep->offset + nodep->len - subs->len; @@ -308,8 +330,6 @@ copystrings (struct Ebl_Strent *nodep, char **freep, size_t *offsetp) void ebl_strtabfinalize (struct Ebl_Strtab *st, Elf_Data *data) { - size_t copylen; - char *endp; size_t nulllen = st->nullstr ? 1 : 0; /* Fill in the information. */ @@ -330,8 +350,8 @@ ebl_strtabfinalize (struct Ebl_Strtab *st, Elf_Data *data) /* Now run through the tree and add all the string while also updating the offset members of the elfstrent records. */ - endp = (char *) data->d_buf + nulllen; - copylen = nulllen; + char *endp = (char *) data->d_buf + nulllen; + size_t copylen = nulllen; copystrings (st->root, &endp, ©len); assert (copylen == st->total + nulllen); } diff --git a/libebl/eblsymbolbindingname.c b/libebl/eblsymbolbindingname.c index efcd250e..c4412c9e 100644 --- a/libebl/eblsymbolbindingname.c +++ b/libebl/eblsymbolbindingname.c @@ -1,16 +1,52 @@ /* Return symbol binding name. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblsymboltypename.c b/libebl/eblsymboltypename.c index d11aec1a..c7cb2cba 100644 --- a/libebl/eblsymboltypename.c +++ b/libebl/eblsymboltypename.c @@ -1,16 +1,52 @@ /* Return symbol type name. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/eblsysvhashentrysize.c b/libebl/eblsysvhashentrysize.c new file mode 100644 index 00000000..341979c1 --- /dev/null +++ b/libebl/eblsysvhashentrysize.c @@ -0,0 +1,63 @@ +/* Return OS ABI name + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2006. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +int +ebl_sysvhash_entrysize (ebl) + Ebl *ebl; +{ + return ebl->sysvhash_entrysize; +} diff --git a/libebl/eblwstrtab.c b/libebl/eblwstrtab.c index 8320cb58..f29c0c7a 100644 --- a/libebl/eblwstrtab.c +++ b/libebl/eblwstrtab.c @@ -1,16 +1,52 @@ /* ELF string table handling. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libebl/i386_corenote.c b/libebl/i386_corenote.c deleted file mode 100644 index 482f81d7..00000000 --- a/libebl/i386_corenote.c +++ /dev/null @@ -1,149 +0,0 @@ -/* i386 specific core note handling. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> -#include <stdio.h> -#include <sys/time.h> - -#include <libebl_i386.h> - - -/* We cannot include <sys/procfs.h> since it is available only on x86 - systems. */ -struct elf_prstatus - { - struct - { - int si_signo; /* Signal number. */ - int si_code; /* Extra code. */ - int si_errno; /* Errno. */ - } pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned long int pr_sigpend; /* Set of pending signals. */ - unsigned long int pr_sighold; /* Set of held signals. */ - __pid_t pr_pid; - __pid_t pr_ppid; - __pid_t pr_pgrp; - __pid_t pr_sid; - struct timeval pr_utime; /* User time. */ - struct timeval pr_stime; /* System time. */ - struct timeval pr_cutime; /* Cumulative user time. */ - struct timeval pr_cstime; /* Cumulative system time. */ - unsigned long int pr_reg[17]; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - - -struct elf_prpsinfo - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned long int pr_flag; /* Flags. */ - unsigned short int pr_uid; - unsigned short int pr_gid; - int pr_pid; - int pr_ppid; - int pr_pgrp; - int pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[80]; /* Initial part of arg list. */ - }; - - -bool -i386_core_note (name, type, descsz, desc) - const char *name; - uint32_t type; - uint32_t descsz; - const char *desc; -{ - bool result = false; - - switch (type) - { - case NT_PRSTATUS: - if (descsz < sizeof (struct elf_prstatus)) - /* Not enough data. */ - break; - - struct elf_prstatus *stat = (struct elf_prstatus *) desc; - - printf (" SIGINFO: signo: %d, code = %d, errno = %d\n" - " signal: %hd, pending: %#08lx, holding: %#08lx\n" - " pid: %d, ppid = %d, pgrp = %d, sid = %d\n" - " utime: %6ld.%06lds, stime: %6ld.%06lds\n" - " cutime: %6ld.%06lds, cstime: %6ld.%06lds\n" - " eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n" - " esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n" - " eip: %08lx eflags: %08lx, original eax: %08lx\n" - " cs: %04lx ds: %04lx es: %04lx fs: %04lx gs: %04lx" - " ss: %04lx\n\n" -, - stat->pr_info. si_signo, - stat->pr_info. si_code, - stat->pr_info. si_errno, - stat->pr_cursig, - stat->pr_sigpend, stat->pr_sighold, - stat->pr_pid, stat->pr_ppid, stat->pr_pgrp, stat->pr_sid, - stat->pr_utime.tv_sec, (long int) stat->pr_utime.tv_usec, - stat->pr_stime.tv_sec, (long int) stat->pr_stime.tv_usec, - stat->pr_cutime.tv_sec, (long int) stat->pr_cutime.tv_usec, - stat->pr_cstime.tv_sec, (long int) stat->pr_cstime.tv_usec, - stat->pr_reg[6], stat->pr_reg[0], stat->pr_reg[1], - stat->pr_reg[2], stat->pr_reg[3], stat->pr_reg[4], - stat->pr_reg[5], stat->pr_reg[15], stat->pr_reg[12], - stat->pr_reg[14], stat->pr_reg[11], stat->pr_reg[13] & 0xffff, - stat->pr_reg[7] & 0xffff, stat->pr_reg[8] & 0xffff, - stat->pr_reg[9] & 0xffff, stat->pr_reg[10] & 0xffff, - stat->pr_reg[16]); - - /* We handled this entry. */ - result = true; - break; - - case NT_PRPSINFO: - if (descsz < sizeof (struct elf_prpsinfo)) - /* Not enough data. */ - break; - - struct elf_prpsinfo *info = (struct elf_prpsinfo *) desc; - - printf (" state: %c (%hhd), zombie: %hhd, nice: %hhd\n" - " flags: %08lx, uid: %hd, gid: %hd\n" - " pid: %d, ppid: %d, pgrp: %d, sid: %d\n" - " fname: %.16s\n" - " args: %.80s\n\n", - info->pr_sname, info->pr_state, info->pr_zomb, info->pr_nice, - info->pr_flag, info->pr_uid, info->pr_gid, - info->pr_pid, info->pr_ppid, info->pr_pgrp, info->pr_sid, - info->pr_fname, info->pr_psargs); - - /* We handled this entry. */ - result = true; - break; - - default: - break; - } - - return result; -} diff --git a/libebl/i386_destr.c b/libebl/i386_destr.c deleted file mode 100644 index 23609496..00000000 --- a/libebl/i386_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for i386 specific backend library. - Copyright (C) 2000, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_i386.h> - - -void -i386_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/i386_init.c b/libebl/i386_init.c deleted file mode 100644 index b53c57da..00000000 --- a/libebl/i386_init.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Initialization of i386 specific backend library. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_i386.h> - - -int -i386_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "Intel 80386"; - eh->reloc_type_name = i386_reloc_type_name; - eh->reloc_type_check = i386_reloc_type_check; - eh->reloc_valid_use = i386_reloc_valid_use; - eh->gotpc_reloc_check = i386_gotpc_reloc_check; - eh->core_note = i386_core_note; - eh->destr = i386_destr; - - return 0; -} diff --git a/libebl/i386_symbol.c b/libebl/i386_symbol.c deleted file mode 100644 index fc70e506..00000000 --- a/libebl/i386_symbol.c +++ /dev/null @@ -1,127 +0,0 @@ -/* i386 specific symbolic name handling. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> - -#include <libebl_i386.h> - - -/* Return of the backend. */ -const char * -i386_backend_name (void) -{ - return "i386"; -} - - -/* Relocation mapping table. */ -static struct -{ - const char *name; - enum { both = 0, rel = 1, exec = 2 } appear; -} reloc_map_table[] = - { - [R_386_NONE] = { "R_386_NONE", both }, - [R_386_32] = { "R_386_32", both }, - [R_386_PC32] = { "R_386_PC32", rel }, - [R_386_GOT32] = { "R_386_GOT32", rel }, - [R_386_PLT32] = { "R_386_PLT32", rel }, - [R_386_COPY] = { "R_386_COPY", exec }, - [R_386_GLOB_DAT] = { "R_386_GLOB_DAT", exec }, - [R_386_JMP_SLOT] = { "R_386_JMP_SLOT", exec }, - [R_386_RELATIVE] = { "R_386_RELATIVE", exec }, - [R_386_GOTOFF] = { "R_386_GOTOFF", rel }, - [R_386_GOTPC] = { "R_386_GOTPC", rel }, - [R_386_32PLT] = { "R_386_32PLT", rel }, - [R_386_TLS_TPOFF] = { "R_386_TLS_TPOFF", rel }, - [R_386_TLS_IE] = { "R_386_TLS_IE", rel }, - [R_386_TLS_GOTIE] = { "R_386_TLS_GOTIE", rel }, - [R_386_TLS_LE] = { "R_386_TLS_LE", rel }, - [R_386_TLS_GD] = { "R_386_TLS_GD", rel }, - [R_386_TLS_LDM] = { "R_386_TLS_LDM", rel }, - [R_386_16] = { "R_386_16", rel }, - [R_386_PC16] = { "R_386_PC16", rel }, - [R_386_8] = { "R_386_8", rel }, - [R_386_PC8] = { "R_386_PC8", rel }, - [R_386_TLS_GD_32] = { "R_386_TLS_GD_32", rel }, - [R_386_TLS_GD_PUSH] = { "R_386_TLS_GD_PUSH", rel }, - [R_386_TLS_GD_CALL] = { "R_386_TLS_GD_CALL", rel }, - [R_386_TLS_GD_POP] = { "R_386_TLS_GD_POP", rel }, - [R_386_TLS_LDM_32] = { "R_386_TLS_LDM_32", rel }, - [R_386_TLS_LDM_PUSH] = { "R_386_TLS_LDM_PUSH", rel }, - [R_386_TLS_LDM_CALL] = { "R_386_TLS_LDM_CALL", rel }, - [R_386_TLS_LDM_POP] = { "R_386_TLS_LDM_POP", rel }, - [R_386_TLS_LDO_32] = { "R_386_TLS_LDO_32", rel }, - [R_386_TLS_IE_32] = { "R_386_TLS_IE_32", rel }, - [R_386_TLS_LE_32] = { "R_386_TLS_LE_32", rel }, - [R_386_TLS_DTPMOD32] = { "R_386_TLS_DTPMOD32", rel }, - [R_386_TLS_DTPOFF32] = { "R_386_TLS_DTPOFF32", rel }, - [R_386_TLS_TPOFF32] = { "R_386_TLS_TPOFF32", rel } - }; - - -/* Determine relocation type string for x86. */ -const char * -i386_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < 0 || type >= R_386_NUM) - return NULL; - - return reloc_map_table[type].name; -} - - -/* Check for correct relocation type. */ -bool -i386_reloc_type_check (int type) -{ - return (type >= R_386_NONE && type < R_386_NUM - && reloc_map_table[type].name != NULL) ? true : false; -} - - -/* Check for correct relocation type use. */ -bool -i386_reloc_valid_use (Elf *elf, int type) -{ - if (type < R_386_NONE || type >= R_386_NUM - || reloc_map_table[type].name == NULL) - return false; - - Elf32_Ehdr *ehdr = elf32_getehdr (elf); - assert (ehdr != NULL); - - if (reloc_map_table[type].appear == rel) - return ehdr->e_type == ET_REL; - - if (reloc_map_table[type].appear == exec) - return ehdr->e_type != ET_REL; - - assert (reloc_map_table[type].appear == both); - return true; -} - - -/* Return true if the symbol type is that referencing the GOT. */ -bool -i386_gotpc_reloc_check (Elf *elf, int type) -{ - return type == R_386_GOTPC; -} diff --git a/libebl/ia64_destr.c b/libebl/ia64_destr.c deleted file mode 100644 index a48302c8..00000000 --- a/libebl/ia64_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for IA-64 specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ia64.h> - - -void -ia64_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/ia64_init.c b/libebl/ia64_init.c deleted file mode 100644 index 30925acb..00000000 --- a/libebl/ia64_init.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Initialization of IA-64 specific backend library. - Copyright (C) 2002, 2003 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ia64.h> - - -int -ia64_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "Intel IA-64"; - eh->reloc_type_name = ia64_reloc_type_name; - eh->reloc_type_check = ia64_reloc_type_check; - eh->segment_type_name = ia64_segment_type_name; - eh->dynamic_tag_name = ia64_dynamic_tag_name; - eh->destr = ia64_destr; - - return 0; -} diff --git a/libebl/ia64_symbol.c b/libebl/ia64_symbol.c deleted file mode 100644 index fe4c7b71..00000000 --- a/libebl/ia64_symbol.c +++ /dev/null @@ -1,177 +0,0 @@ -/* IA-64 specific symbolic name handling. - Copyright (C) 2002, 2003 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_ia64.h> - - -/* Return of the backend. */ -const char * -ia64_backend_name (void) -{ - return "ia64"; -} - - -/* Relocation mapping table. */ -static const char *reloc_map_table[] = - { - [R_IA64_NONE] = "R_IA64_NONE", - [R_IA64_IMM14] = "R_IA64_IMM14", - [R_IA64_IMM22] = "R_IA64_IMM22", - [R_IA64_IMM64] = "R_IA64_IMM64", - [R_IA64_DIR32MSB] = "R_IA64_DIR32MSB", - [R_IA64_DIR32LSB] = "R_IA64_DIR32LSB", - [R_IA64_DIR64MSB] = "R_IA64_DIR64MSB", - [R_IA64_DIR64LSB] = "R_IA64_DIR64LSB", - [R_IA64_GPREL22] = "R_IA64_GPREL22", - [R_IA64_GPREL64I] = "R_IA64_GPREL64I", - [R_IA64_GPREL32MSB] = "R_IA64_GPREL32MSB", - [R_IA64_GPREL32LSB] = "R_IA64_GPREL32LSB", - [R_IA64_GPREL64MSB] = "R_IA64_GPREL64MSB", - [R_IA64_GPREL64LSB] = "R_IA64_GPREL64LSB", - [R_IA64_LTOFF22] = "R_IA64_LTOFF22", - [R_IA64_LTOFF64I] = "R_IA64_LTOFF64I", - [R_IA64_PLTOFF22] = "R_IA64_PLTOFF22", - [R_IA64_PLTOFF64I] = "R_IA64_PLTOFF64I", - [R_IA64_PLTOFF64MSB] = "R_IA64_PLTOFF64MSB", - [R_IA64_PLTOFF64LSB] = "R_IA64_PLTOFF64LSB", - [R_IA64_FPTR64I] = "R_IA64_FPTR64I", - [R_IA64_FPTR32MSB] = "R_IA64_FPTR32MSB", - [R_IA64_FPTR32LSB] = "R_IA64_FPTR32LSB", - [R_IA64_FPTR64MSB] = "R_IA64_FPTR64MSB", - [R_IA64_FPTR64LSB] = "R_IA64_FPTR64LSB", - [R_IA64_PCREL60B] = "R_IA64_PCREL60B", - [R_IA64_PCREL21B] = "R_IA64_PCREL21B", - [R_IA64_PCREL21M] = "R_IA64_PCREL21M", - [R_IA64_PCREL21F] = "R_IA64_PCREL21F", - [R_IA64_PCREL32MSB] = "R_IA64_PCREL32MSB", - [R_IA64_PCREL32LSB] = "R_IA64_PCREL32LSB", - [R_IA64_PCREL64MSB] = "R_IA64_PCREL64MSB", - [R_IA64_PCREL64LSB] = "R_IA64_PCREL64LSB", - [R_IA64_LTOFF_FPTR22] = "R_IA64_LTOFF_FPTR22", - [R_IA64_LTOFF_FPTR64I] = "R_IA64_LTOFF_FPTR64I", - [R_IA64_LTOFF_FPTR32MSB] = "R_IA64_LTOFF_FPTR32MSB", - [R_IA64_LTOFF_FPTR32LSB] = "R_IA64_LTOFF_FPTR32LSB", - [R_IA64_LTOFF_FPTR64MSB] = "R_IA64_LTOFF_FPTR64MSB", - [R_IA64_LTOFF_FPTR64LSB] = "R_IA64_LTOFF_FPTR64LSB", - [R_IA64_SEGREL32MSB] = "R_IA64_SEGREL32MSB", - [R_IA64_SEGREL32LSB] = "R_IA64_SEGREL32LSB", - [R_IA64_SEGREL64MSB] = "R_IA64_SEGREL64MSB", - [R_IA64_SEGREL64LSB] = "R_IA64_SEGREL64LSB", - [R_IA64_SECREL32MSB] = "R_IA64_SECREL32MSB", - [R_IA64_SECREL32LSB] = "R_IA64_SECREL32LSB", - [R_IA64_SECREL64MSB] = "R_IA64_SECREL64MSB", - [R_IA64_SECREL64LSB] = "R_IA64_SECREL64LSB", - [R_IA64_REL32MSB] = "R_IA64_REL32MSB", - [R_IA64_REL32LSB] = "R_IA64_REL32LSB", - [R_IA64_REL64MSB] = "R_IA64_REL64MSB", - [R_IA64_REL64LSB] = "R_IA64_REL64LSB", - [R_IA64_LTV32MSB] = "R_IA64_LTV32MSB", - [R_IA64_LTV32LSB] = "R_IA64_LTV32LSB", - [R_IA64_LTV64MSB] = "R_IA64_LTV64MSB", - [R_IA64_LTV64LSB] = "R_IA64_LTV64LSB", - [R_IA64_PCREL21BI] = "R_IA64_PCREL21BI", - [R_IA64_PCREL22] = "R_IA64_PCREL22", - [R_IA64_PCREL64I] = "R_IA64_PCREL64I", - [R_IA64_IPLTMSB] = "R_IA64_IPLTMSB", - [R_IA64_IPLTLSB] = "R_IA64_IPLTLSB", - [R_IA64_COPY] = "R_IA64_COPY", - [R_IA64_SUB] = "R_IA64_SUB", - [R_IA64_LTOFF22X] = "R_IA64_LTOFF22X", - [R_IA64_LDXMOV] = "R_IA64_LDXMOV", - [R_IA64_TPREL14] = "R_IA64_TPREL14", - [R_IA64_TPREL22] = "R_IA64_TPREL22", - [R_IA64_TPREL64I] = "R_IA64_TPREL64I", - [R_IA64_TPREL64MSB] = "R_IA64_TPREL64MSB", - [R_IA64_TPREL64LSB] = "R_IA64_TPREL64LSB", - [R_IA64_LTOFF_TPREL22] = "R_IA64_LTOFF_TPREL22", - [R_IA64_DTPMOD64MSB] = "R_IA64_DTPMOD64MSB", - [R_IA64_DTPMOD64LSB] = "R_IA64_DTPMOD64LSB", - [R_IA64_LTOFF_DTPMOD22] = "R_IA64_LTOFF_DTPMOD22", - [R_IA64_DTPREL14] = "R_IA64_DTPREL14", - [R_IA64_DTPREL22] = "R_IA64_DTPREL22", - [R_IA64_DTPREL64I] = "R_IA64_DTPREL64I", - [R_IA64_DTPREL32MSB] = "R_IA64_DTPREL32MSB", - [R_IA64_DTPREL32LSB] = "R_IA64_DTPREL32LSB", - [R_IA64_DTPREL64MSB] = "R_IA64_DTPREL64MSB", - [R_IA64_DTPREL64LSB] = "R_IA64_DTPREL64LSB", - [R_IA64_LTOFF_DTPREL22] = "R_IA64_LTOFF_DTPREL22" - }; - - -/* Determine relocation type string for IA-64. */ -const char * -ia64_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < 0 - || ((size_t) type - >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0]))) - return NULL; - - return reloc_map_table[type]; -} - - -/* Check for correct relocation type. */ -bool -ia64_reloc_type_check (int type) -{ - return (type >= R_IA64_NONE - && ((size_t) type - < sizeof (reloc_map_table) / sizeof (reloc_map_table[0])) - && reloc_map_table[type] != NULL) ? true : false; -} - - -const char * -ia64_segment_type_name (int segment, char *buf, size_t len) -{ - switch (segment) - { - case PT_IA_64_ARCHEXT: - return "IA_64_ARCHEXT"; - case PT_IA_64_UNWIND: - return "IA_64_UNWIND"; - case PT_IA_64_HP_OPT_ANOT: - return "IA_64_HP_OPT_ANOT"; - case PT_IA_64_HP_HSL_ANOT: - return "IA_64_HP_HSL_ANOT"; - case PT_IA_64_HP_STACK: - return "IA_64_HP_STACK"; - default: - break; - } - return NULL; -} - - -const char * -ia64_dynamic_tag_name (int64_t tag, char *buf, size_t len) -{ - switch (tag) - { - case DT_IA_64_PLT_RESERVE: - return "IA_64_PLT_RESERVE"; - default: - break; - } - return NULL; -} diff --git a/libebl/libebl.h b/libebl/libebl.h index 392350ac..50258690 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -1,109 +1,71 @@ /* Interface for libebl. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBEBL_H #define _LIBEBL_H 1 #include <gelf.h> +#include "libdw.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <elf-knowledge.h> - - -/* Backend handle. */ -typedef struct ebl -{ - /* Machine name. */ - const char *name; - - /* Emulation name. */ - const char *emulation; - - /* The libelf handle (if known). */ - Elf *elf; - - /* Return symbol representaton of object file type. */ - const char *(*object_type_name) (int, char *, size_t); - - /* Return symbolic representation of relocation type. */ - const char *(*reloc_type_name) (int, char *, size_t); - - /* Check relocation type. */ - bool (*reloc_type_check) (int); - - /* Check relocation type use. */ - bool (*reloc_valid_use) (Elf *, int); - - /* Return true if the symbol type is that referencing the GOT. */ - bool (*gotpc_reloc_check) (Elf *, int); - - /* Return symbolic representation of segment type. */ - const char *(*segment_type_name) (int, char *, size_t); - - /* Return symbolic representation of section type. */ - const char *(*section_type_name) (int, char *, size_t); - - /* Return section name. */ - const char *(*section_name) (int, int, char *, size_t); - - /* Return next machine flag name. */ - const char *(*machine_flag_name) (GElf_Word *); - - /* Check whether machine flags are valid. */ - bool (*machine_flag_check) (GElf_Word); - - /* Return symbolic representation of symbol type. */ - const char *(*symbol_type_name) (int, char *, size_t); - - /* Return symbolic representation of symbol binding. */ - const char *(*symbol_binding_name) (int, char *, size_t); - - /* Return symbolic representation of dynamic tag. */ - const char *(*dynamic_tag_name) (int64_t, char *, size_t); - - /* Check dynamic tag. */ - bool (*dynamic_tag_check) (int64_t); - - /* Combine section header flags values. */ - GElf_Word (*sh_flags_combine) (GElf_Word, GElf_Word); +#include "elf-knowledge.h" - /* Return symbolic representation of OS ABI. */ - const char *(*osabi_name) (int, char *, size_t); - /* Name of a note entry type for core files. */ - const char *(*core_note_type_name) (uint32_t, char *, size_t); +/* Opaque type for the handle. */ +typedef struct ebl Ebl; - /* Name of a note entry type for object files. */ - const char *(*object_note_type_name) (uint32_t, char *, size_t); - - /* Handle core note. */ - bool (*core_note) (const char *, uint32_t, uint32_t, const char *); - - /* Handle object file note. */ - bool (*object_note) (const char *, uint32_t, uint32_t, const char *); - - /* Check section name for being that of a debug informatino section. */ - bool (*debugscn_p) (const char *); - - /* Destructor for ELF backend handle. */ - void (*destr) (struct ebl *); - - /* Internal data. */ - void *dlhandle; -} Ebl; +#ifdef __cplusplus +extern "C" { +#endif /* Get backend handle for object associated with ELF handle. */ extern Ebl *ebl_openbackend (Elf *elf); @@ -116,6 +78,18 @@ extern Ebl *ebl_openbackend_emulation (const char *emulation); extern void ebl_closebackend (Ebl *bh); +/* Information about the descriptor. */ + +/* Get ELF machine. */ +extern int ebl_get_elfmachine (Ebl *ebl) __attribute__ ((__pure__)); + +/* Get ELF class. */ +extern int ebl_get_elfclass (Ebl *ebl) __attribute__ ((__pure__)); + +/* Get ELF data encoding. */ +extern int ebl_get_elfdata (Ebl *ebl) __attribute__ ((__pure__)); + + /* Function to call the callback functions including default ELF handling. */ @@ -136,6 +110,10 @@ extern bool ebl_reloc_type_check (Ebl *ebl, int reloc); /* Check relocation type use. */ extern bool ebl_reloc_valid_use (Ebl *ebl, int reloc); +/* Check if relocation type is for simple absolute relocations. + Return ELF_T_{BYTE,HALF,SWORD,SXWORD} for a simple type, else ELF_T_NUM. */ +extern Elf_Type ebl_reloc_simple_type (Ebl *ebl, int reloc); + /* Return true if the symbol type is that referencing the GOT. E.g., R_386_GOTPC. */ extern bool ebl_gotpc_reloc_check (Ebl *ebl, int reloc); @@ -160,6 +138,15 @@ extern const char *ebl_machine_flag_name (Ebl *ebl, GElf_Word flags, /* Check whether machine flag is valid. */ extern bool ebl_machine_flag_check (Ebl *ebl, GElf_Word flags); +/* Check whether SHF_MASKPROC flags are valid. */ +extern bool ebl_machine_section_flag_check (Ebl *ebl, GElf_Xword flags); + +/* Check whether the section with the given index, header, and name + is a special machine section that is valid despite a combination + of flags or other details that are not generically valid. */ +extern bool ebl_check_special_section (Ebl *ebl, int ndx, + const GElf_Shdr *shdr, const char *name); + /* Return symbol type name. */ extern const char *ebl_symbol_type_name (Ebl *ebl, int symbol, char *buf, size_t len); @@ -175,6 +162,12 @@ extern const char *ebl_dynamic_tag_name (Ebl *ebl, int64_t tag, /* Check dynamic tag. */ extern bool ebl_dynamic_tag_check (Ebl *ebl, int64_t tag); +/* Check whether given symbol's st_value and st_size are OK despite failing + normal checks. */ +extern bool ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, + const GElf_Sym *sym, const char *name, + const GElf_Shdr *destshdr); + /* Return combined section header flags value. */ extern GElf_Word ebl_sh_flags_combine (Ebl *ebl, GElf_Word flags1, GElf_Word flags2); @@ -191,17 +184,77 @@ extern const char *ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, extern const char *ebl_object_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len); -/* Print information about core note if available. */ -extern void ebl_core_note (Ebl *ebl, const char *name, uint32_t type, - uint32_t descsz, const char *desc); - /* Print information about object note if available. */ extern void ebl_object_note (Ebl *ebl, const char *name, uint32_t type, uint32_t descsz, const char *desc); +/* Check whether an attribute in a .gnu_attributes section is recognized. + Fills in *TAG_NAME with the name for this tag. + If VALUE is a known value for that tag, also fills in *VALUE_NAME. */ +extern bool ebl_check_object_attribute (Ebl *ebl, const char *vendor, + int tag, uint64_t value, + const char **tag_name, + const char **value_name); + + /* Check section name for being that of a debug informatino section. */ extern bool ebl_debugscn_p (Ebl *ebl, const char *name); +/* Check whether given relocation is a copy relocation. */ +extern bool ebl_copy_reloc_p (Ebl *ebl, int reloc); + +/* Check whether given relocation is a no-op relocation. */ +extern bool ebl_none_reloc_p (Ebl *ebl, int reloc); + +/* Check whether given relocation is a relative relocation. */ +extern bool ebl_relative_reloc_p (Ebl *ebl, int reloc); + +/* Check whether section should be stripped. */ +extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, + const GElf_Shdr *shdr, const char *name, + bool remove_comment, bool only_remove_debug); + +/* Check if backend uses a bss PLT in this file. */ +extern bool ebl_bss_plt_p (Ebl *ebl, GElf_Ehdr *ehdr); + +/* Return size of entry in SysV-style hash table. */ +extern int ebl_sysvhash_entrysize (Ebl *ebl); + +/* Return location expression to find return value given a + DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing + function itself (whose DW_AT_type attribute describes its return type). + Returns -1 for a libdw error (see dwarf_errno). + Returns -2 for an unrecognized type formation. + Returns zero if the function has no return value (e.g. "void" in C). + Otherwise, *LOCOPS gets a location expression to find the return value, + and returns the number of operations in the expression. The pointer is + permanently allocated at least as long as the Ebl handle is open. */ +extern int ebl_return_value_location (Ebl *ebl, + Dwarf_Die *functypedie, + const Dwarf_Op **locops); + +/* Fill in register information given DWARF register numbers. + If NAME is null, return the maximum REGNO + 1 that has a name. + Otherwise, store in NAME the name for DWARF register number REGNO + and return the number of bytes written (including '\0' terminator). + Return -1 if NAMELEN is too short or REGNO is negative or too large. + Return 0 if REGNO is unused (a gap in the DWARF number assignment). + On success, set *SETNAME to a description like "integer" or "FPU" + fit for "%s registers" title display, and *PREFIX to the string + that precedes NAME in canonical assembler syntax (e.g. "%" or "$"). + The NAME string contains identifier characters only (maybe just digits). */ +extern ssize_t ebl_register_info (Ebl *ebl, + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type); + +/* Fill in the DWARF register numbers for the registers used in system calls. + The SP and PC are what kernel reports call the user stack pointer and PC. + The CALLNO and ARGS are the system call number and incoming arguments. + Each of these is filled with the DWARF register number corresponding, + or -1 if there is none. Returns zero when the information is available. */ +extern int ebl_syscall_abi (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); /* ELF string table handling. */ struct Ebl_Strtab; @@ -271,4 +324,45 @@ extern void ebl_gstrtabfinalize (struct Ebl_GStrtab *st, Elf_Data *data); /* Get offset in wide char string table for string associated with SE. */ extern size_t ebl_gstrtaboffset (struct Ebl_GStrent *se); + +/* Register map info. */ +typedef struct +{ + Dwarf_Half offset; /* Byte offset in register data block. */ + Dwarf_Half regno; /* DWARF register number. */ + uint8_t bits; /* Bits of data for one register. */ + uint8_t pad; /* Bytes of padding after register's data. */ + Dwarf_Half count; /* Consecutive register numbers here. */ +} Ebl_Register_Location; + +/* Non-register data items in core notes. */ +typedef struct +{ + const char *name; /* Printable identifier. */ + const char *group; /* Identifier for category of related items. */ + Dwarf_Half offset; /* Byte offset in note data. */ + Dwarf_Half count; + Elf_Type type; + char format; + bool thread_identifier; +} Ebl_Core_Item; + +/* Describe the format of a core file note with type field matching N_TYPE + and descriptor size matching DESCSZ. */ +extern int ebl_core_note (Ebl *ebl, GElf_Word n_type, GElf_Word descsz, + GElf_Word *regs_offset, size_t *nregloc, + const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **items) + __nonnull_attribute__ (1, 4, 5, 6, 7, 8); + +/* Describe the auxv type number. */ +extern int ebl_auxv_info (Ebl *ebl, GElf_Xword a_type, + const char **name, const char **format) + __nonnull_attribute__ (1, 3, 4); + + +#ifdef __cplusplus +} +#endif + #endif /* libebl.h */ diff --git a/libebl/libeblP.h b/libebl/libeblP.h index 55ace24d..f765291e 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -1,29 +1,96 @@ /* Internal definitions for interface for libebl. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBEBLP_H #define _LIBEBLP_H 1 #include <gelf.h> +#include <libasm.h> #include <libebl.h> -//#include <libintl.h> +#include <libintl.h> + +/* Backend handle. */ +struct ebl +{ + /* Machine name. */ + const char *name; + + /* Emulation name. */ + const char *emulation; + + /* ELF machine, class, and data encoding. */ + uint_fast16_t machine; + uint_fast8_t class; + uint_fast8_t data; + + /* The libelf handle (if known). */ + Elf *elf; + + /* See ebl-hooks.h for the declarations of the hook functions. */ +# define EBLHOOK(name) (*name) +# include "ebl-hooks.h" +# undef EBLHOOK + + /* Size of entry in Sysv-style hash table. */ + int sysvhash_entrysize; + + /* Internal data. */ + void *dlhandle; +}; /* Type of the initialization functions in the backend modules. */ -typedef int (*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t); +typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t); /* gettext helper macros. */ +#undef _ #define _(Str) dgettext ("elfutils", Str) #endif /* libeblP.h */ diff --git a/libebl/libebl_alpha.h b/libebl/libebl_alpha.h deleted file mode 100644 index 36d7dadc..00000000 --- a/libebl/libebl_alpha.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Interface for libebl_alpha module. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_ALPHA_H -#define _LIBEBL_ALPHA_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int alpha_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void alpha_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *alpha_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool alpha_reloc_type_check (int type); - -#endif /* libebl_alpha.h */ diff --git a/libebl/libebl_alpha.map b/libebl/libebl_alpha.map deleted file mode 100644 index aa66ad75..00000000 --- a/libebl/libebl_alpha.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - alpha_backend_name; - alpha_destr; - alpha_init; - alpha_reloc_type_check; - alpha_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_arm.h b/libebl/libebl_arm.h deleted file mode 100644 index 8aade439..00000000 --- a/libebl/libebl_arm.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Interface for libebl_arm module. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_ARM_H -#define _LIBEBL_ARM_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int arm_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void arm_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *arm_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool arm_reloc_type_check (int type); - -#endif /* libebl_arm.h */ diff --git a/libebl/libebl_arm.map b/libebl/libebl_arm.map deleted file mode 100644 index d389526c..00000000 --- a/libebl/libebl_arm.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - arm_backend_name; - arm_destr; - arm_init; - arm_reloc_type_check; - arm_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_i386.h b/libebl/libebl_i386.h deleted file mode 100644 index ed719660..00000000 --- a/libebl/libebl_i386.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Interface for libebl_i386 module. - Copyright (C) 2000, 2001, 2002, 2003 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_I386_H -#define _LIBEBL_I386_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int i386_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void i386_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *i386_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool i386_reloc_type_check (int type); - -/* Check relocation type use. */ -extern bool i386_reloc_valid_use (Elf *elf, int type); - -/* Check relocation type use. */ -extern bool i386_gotpc_reloc_check (Elf *elf, int type); - -/* Code note handling. */ -extern bool i386_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc); - -#endif /* libebl_i386.h */ diff --git a/libebl/libebl_i386.map b/libebl/libebl_i386.map deleted file mode 100644 index 38513247..00000000 --- a/libebl/libebl_i386.map +++ /dev/null @@ -1,12 +0,0 @@ -ELFUTILS_1.0 { - global: - i386_backend_name; - i386_core_note; - i386_destr; - i386_init; - i386_reloc_type_check; - i386_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_ia64.h b/libebl/libebl_ia64.h deleted file mode 100644 index 19e73fe8..00000000 --- a/libebl/libebl_ia64.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Interface for libebl_ia64 module. - Copyright (C) 2002, 2003 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_IA64_H -#define _LIBEBL_IA64_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int ia64_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void ia64_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *ia64_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool ia64_reloc_type_check (int type); - -/* Name of segment type. */ -extern const char *ia64_segment_type_name (int segment, char *buf, size_t len); - -/* Name of dynamic tag. */ -extern const char *ia64_dynamic_tag_name (int64_t tag, char *buf, size_t len); - -#endif /* libebl_ia64.h */ diff --git a/libebl/libebl_ia64.map b/libebl/libebl_ia64.map deleted file mode 100644 index f67042c6..00000000 --- a/libebl/libebl_ia64.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - ia64_backend_name; - ia64_destr; - ia64_init; - ia64_reloc_type_check; - ia64_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_mips.h b/libebl/libebl_mips.h deleted file mode 100644 index 167eab30..00000000 --- a/libebl/libebl_mips.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Interface for libebl_mips module. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_MIPS_H -#define _LIBEBL_MIPS_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int mips_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void mips_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *mips_reloc_type_name (int type, char *buf, size_t len); - -/* Function to get segment type name. */ -extern const char *mips_segment_type_name (int type, char *buf, size_t len); - -/* Function to get setion type name. */ -extern const char *mips_section_type_name (int type, char *buf, size_t len); - -/* Function to get machine flag name. */ -extern const char *mips_machine_flag_name (Elf64_Word *flags); - -/* Function to get dynamic tag name. */ -extern const char *mips_dynamic_tag_name (int64_t tag, char *buf, size_t len); - -#endif /* libebl_mips.h */ diff --git a/libebl/libebl_mips.map b/libebl/libebl_mips.map deleted file mode 100644 index 9ddd366b..00000000 --- a/libebl/libebl_mips.map +++ /dev/null @@ -1,14 +0,0 @@ -ELFUTILS_1.0 { - global: - mips_backend_name; - mips_destr; - mips_dynamic_tag_name; - mips_init; - mips_machine_flag_name; - mips_reloc_type_name; - mips_section_type_name; - mips_segment_type_name; - - local: - *; -}; diff --git a/libebl/libebl_ppc.h b/libebl/libebl_ppc.h deleted file mode 100644 index 880cd399..00000000 --- a/libebl/libebl_ppc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Interface for libebl_PPC module. - Copyright (C) 2004 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_PPC_H -#define _LIBEBL_PPC_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int ppc_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void ppc_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *ppc_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool ppc_reloc_type_check (int type); - -/* Check relocation type use. */ -extern bool ppc_reloc_valid_use (Elf *elf, int type); - -/* Code note handling. */ -extern bool ppc_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc); - -#endif /* libebl_ppc.h */ diff --git a/libebl/libebl_ppc.map b/libebl/libebl_ppc.map deleted file mode 100644 index 03bbfcc4..00000000 --- a/libebl/libebl_ppc.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - ppc_backend_name; - ppc_destr; - ppc_init; - ppc_reloc_type_check; - ppc_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_ppc64.h b/libebl/libebl_ppc64.h deleted file mode 100644 index 3ad3e8cf..00000000 --- a/libebl/libebl_ppc64.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Interface for libebl_PPC64 module. - Copyright (C) 2004 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_PPC64_H -#define _LIBEBL_PPC64_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int ppc64_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void ppc64_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *ppc64_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool ppc64_reloc_type_check (int type); - -/* Check relocation type use. */ -extern bool ppc64_reloc_valid_use (Elf *elf, int type); - -/* Code note handling. */ -extern bool ppc64_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc); - -/* Name of dynamic tag. */ -extern const char *ppc64_dynamic_tag_name (int64_t tag, char *buf, size_t len); - -#endif /* libebl_ppc.h */ diff --git a/libebl/libebl_ppc64.map b/libebl/libebl_ppc64.map deleted file mode 100644 index 2d0d556a..00000000 --- a/libebl/libebl_ppc64.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - ppc64_backend_name; - ppc64_destr; - ppc64_init; - ppc64_reloc_type_check; - ppc64_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_sh.h b/libebl/libebl_sh.h deleted file mode 100644 index 40e2a8c2..00000000 --- a/libebl/libebl_sh.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Interface for libebl_sh module. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_SH_H -#define _LIBEBL_SH_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int sh_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void sh_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *sh_reloc_type_name (int type, char *buf, size_t len); - -#endif /* libebl_sh.h */ diff --git a/libebl/libebl_sh.map b/libebl/libebl_sh.map deleted file mode 100644 index 252720a9..00000000 --- a/libebl/libebl_sh.map +++ /dev/null @@ -1,10 +0,0 @@ -ELFUTILS_1.0 { - global: - sh_backend_name; - sh_destr; - sh_init; - sh_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_sparc.h b/libebl/libebl_sparc.h deleted file mode 100644 index c06228ed..00000000 --- a/libebl/libebl_sparc.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Interface for libebl_sparc module. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_SPARC_H -#define _LIBEBL_SPARC_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int sparc_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void sparc_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *sparc_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool sparc_reloc_type_check (int type); - -/* Code note handling. */ -extern bool sparc_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc); - -#endif /* libebl_sparc.h */ diff --git a/libebl/libebl_sparc.map b/libebl/libebl_sparc.map deleted file mode 100644 index 7ca60383..00000000 --- a/libebl/libebl_sparc.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - sparc_backend_name; - sparc_destr; - sparc_init; - sparc_reloc_type_check; - sparc_reloc_type_name; - - local: - *; -}; diff --git a/libebl/libebl_x86_64.h b/libebl/libebl_x86_64.h deleted file mode 100644 index b68124ab..00000000 --- a/libebl/libebl_x86_64.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Interface for libebl_x86_64 module. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_X86_64_H -#define _LIBEBL_X86_64_H 1 - -#include <libeblP.h> - - -/* Constructor. */ -extern int x86_64_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); - -/* Destructor. */ -extern void x86_64_destr (Ebl *bh); - - -/* Function to get relocation type name. */ -extern const char *x86_64_reloc_type_name (int type, char *buf, size_t len); - -/* Check relocation type. */ -extern bool x86_64_reloc_type_check (int type); - -/* Check relocation type use. */ -extern bool x86_64_reloc_valid_use (Elf *elf, int type); - -/* Code note handling. */ -extern bool x86_64_core_note (const char *name, uint32_t type, uint32_t descsz, - const char *desc); - -#endif /* libebl_x86_64.h */ diff --git a/libebl/libebl_x86_64.map b/libebl/libebl_x86_64.map deleted file mode 100644 index bf07cb9c..00000000 --- a/libebl/libebl_x86_64.map +++ /dev/null @@ -1,11 +0,0 @@ -ELFUTILS_1.0 { - global: - x86_64_backend_name; - x86_64_destr; - x86_64_init; - x86_64_reloc_type_check; - x86_64_reloc_type_name; - - local: - *; -}; diff --git a/libebl/mips_destr.c b/libebl/mips_destr.c deleted file mode 100644 index fa8f8d30..00000000 --- a/libebl/mips_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for MIPS specific backend library. - Copyright (C) 2000, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_mips.h> - - -void -mips_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/mips_init.c b/libebl/mips_init.c deleted file mode 100644 index 7b51f405..00000000 --- a/libebl/mips_init.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Initialization of MIPS specific backend library. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_mips.h> - - -int -mips_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - if (machine != EM_MIPS) - eh->name = "MIPS R3000 big-endian"; - else - eh->name = "MIPS R3000 little-endian"; - - eh->reloc_type_name = mips_reloc_type_name; - eh->segment_type_name = mips_segment_type_name; - eh->section_type_name = mips_section_type_name; - eh->machine_flag_name = mips_machine_flag_name; - eh->dynamic_tag_name = mips_dynamic_tag_name; - eh->destr = mips_destr; - - return 0; -} diff --git a/libebl/mips_symbol.c b/libebl/mips_symbol.c deleted file mode 100644 index cab03310..00000000 --- a/libebl/mips_symbol.c +++ /dev/null @@ -1,266 +0,0 @@ -/* MIPS specific symbolic name handling. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_mips.h> - - -/* Return of the backend. */ -const char * -mips_backend_name (void) -{ - return "mips"; -} - - -/* Determine relocation type string for MIPS. */ -const char * -mips_reloc_type_name (int type, char *buf, size_t len) -{ - static const char *map_table[] = - { - [R_MIPS_NONE] = "MIPS_NONE", - [R_MIPS_16] = "MIPS_16", - [R_MIPS_32] = "MIPS_32", - [R_MIPS_REL32] = "MIPS_REL32", - [R_MIPS_26] = "MIPS_26", - [R_MIPS_HI16] = "MIPS_HI16", - [R_MIPS_LO16] = "MIPS_LO16", - [R_MIPS_GPREL16] = "MIPS_GPREL16", - [R_MIPS_LITERAL] = "MIPS_LITERAL", - [R_MIPS_GOT16] = "MIPS_GOT16", - [R_MIPS_PC16] = "MIPS_PC16", - [R_MIPS_CALL16] = "MIPS_CALL16", - [R_MIPS_GPREL32] = "MIPS_GPREL32", - [R_MIPS_SHIFT5] = "MIPS_SHIFT5", - [R_MIPS_SHIFT6] = "MIPS_SHIFT6", - [R_MIPS_64] = "MIPS_64", - [R_MIPS_GOT_DISP] = "MIPS_GOT_DISP", - [R_MIPS_GOT_PAGE] = "MIPS_GOT_PAGE", - [R_MIPS_GOT_OFST] = "MIPS_GOT_OFST", - [R_MIPS_GOT_HI16] = "MIPS_GOT_HI16", - [R_MIPS_GOT_LO16] = "MIPS_GOT_LO16", - [R_MIPS_SUB] = "MIPS_SUB", - [R_MIPS_INSERT_A] = "MIPS_INSERT_A", - [R_MIPS_INSERT_B] = "MIPS_INSERT_B", - [R_MIPS_DELETE] = "MIPS_DELETE", - [R_MIPS_HIGHER] = "MIPS_HIGHER", - [R_MIPS_HIGHEST] = "MIPS_HIGHEST", - [R_MIPS_CALL_HI16] = "MIPS_CALL_HI16", - [R_MIPS_CALL_LO16] = "MIPS_CALL_LO16", - [R_MIPS_SCN_DISP] = "MIPS_SCN_DISP", - [R_MIPS_REL16] = "MIPS_REL16", - [R_MIPS_ADD_IMMEDIATE] = "MIPS_ADD_IMMEDIATE", - [R_MIPS_PJUMP] = "MIPS_PJUMP", - [R_MIPS_RELGOT] = "MIPS_RELGOT", - [R_MIPS_JALR] = "MIPS_JALR" - }; - - if (type < 0 || type >= R_MIPS_NUM) - return NULL; - - return map_table[type]; -} - - -const char * -mips_segment_type_name (int type, char *buf, size_t len) -{ - static const struct - { - int type; - const char *str; - } mips_segments[] = - { - { PT_MIPS_REGINFO, "MIPS_REGINFO" }, - { PT_MIPS_RTPROC, "MIPS_RTPROC" }, - { PT_MIPS_OPTIONS, "MIPS_OPTIONS" } - }; -#define nsegments (sizeof (mips_segments) / sizeof (mips_segments[0])) - size_t cnt; - - for (cnt = 0; cnt < nsegments; ++cnt) - if (type == mips_segments[cnt].type) - return mips_segments[cnt].str; - - /* We don't know the segment type. */ - return NULL; -} - - -const char * -mips_section_type_name (int type, char *buf, size_t len) -{ - static const struct - { - int type; - const char *str; - } mips_sections[] = - { - { SHT_MIPS_LIBLIST, "MIPS_LIBLIST" }, - { SHT_MIPS_MSYM, "MIPS_MSYM" }, - { SHT_MIPS_CONFLICT, "MIPS_CONFLICT" }, - { SHT_MIPS_GPTAB, "MIPS_GPTAB" }, - { SHT_MIPS_UCODE, "MIPS_UCODE" }, - { SHT_MIPS_DEBUG, "MIPS_DEBUG" }, - { SHT_MIPS_REGINFO, "MIPS_REGINFO" }, - { SHT_MIPS_PACKAGE, "MIPS_PACKAGE" }, - { SHT_MIPS_PACKSYM, "MIPS_PACKSYM" }, - { SHT_MIPS_RELD, "MIPS_RELD" }, - { SHT_MIPS_IFACE, "MIPS_IFACE" }, - { SHT_MIPS_CONTENT, "MIPS_CONTENT" }, - { SHT_MIPS_OPTIONS, "MIPS_OPTIONS" }, - { SHT_MIPS_SHDR, "MIPS_SHDR" }, - { SHT_MIPS_FDESC, "MIPS_FDESC" }, - { SHT_MIPS_EXTSYM, "MIPS_EXTSYM" }, - { SHT_MIPS_DENSE, "MIPS_DENSE" }, - { SHT_MIPS_PDESC, "MIPS_PDESC" }, - { SHT_MIPS_LOCSYM, "MIPS_LOCSYM" }, - { SHT_MIPS_AUXSYM, "MIPS_AUXSYM" }, - { SHT_MIPS_OPTSYM, "MIPS_OPTSYM" }, - { SHT_MIPS_LOCSTR, "MIPS_LOCSTR" }, - { SHT_MIPS_LINE, "MIPS_LINE" }, - { SHT_MIPS_RFDESC, "MIPS_RFDESC" }, - { SHT_MIPS_DELTASYM, "MIPS_DELTASYM" }, - { SHT_MIPS_DELTAINST, "MIPS_DELTAINST" }, - { SHT_MIPS_DELTACLASS, "MIPS_DELTACLASS" }, - { SHT_MIPS_DWARF, "MIPS_DWARF" }, - { SHT_MIPS_DELTADECL, "MIPS_DELTADECL" }, - { SHT_MIPS_SYMBOL_LIB, "MIPS_SYMBOL_LIB" }, - { SHT_MIPS_EVENTS, "MIPS_EVENTS" }, - { SHT_MIPS_TRANSLATE, "MIPS_TRANSLATE" }, - { SHT_MIPS_PIXIE, "MIPS_PIXIE" }, - { SHT_MIPS_XLATE, "MIPS_XLATE" }, - { SHT_MIPS_XLATE_DEBUG, "MIPS_XLATE_DEBUG" }, - { SHT_MIPS_WHIRL, "MIPS_WHIRL" }, - { SHT_MIPS_EH_REGION, "MIPS_EH_REGION" }, - { SHT_MIPS_XLATE_OLD, "MIPS_XLATE_OLD" }, - { SHT_MIPS_PDR_EXCEPTION, "MIPS_PDR_EXCEPTION" } - }; -#define nsections (sizeof (mips_sections) / sizeof (mips_sections[0])) - size_t cnt; - - for (cnt = 0; cnt < nsections; ++cnt) - if (type == mips_sections[cnt].type) - return mips_sections[cnt].str; - - /* We don't know the section type. */ - return NULL; -} - - -const char * -mips_machine_flag_name (Elf64_Word *flags) -{ - static const struct - { - unsigned int mask; - unsigned int flag; - const char *str; - } mips_flags[] = - { - { EF_MIPS_NOREORDER, EF_MIPS_NOREORDER, "noreorder" }, - { EF_MIPS_PIC, EF_MIPS_PIC, "pic" }, - { EF_MIPS_CPIC, EF_MIPS_CPIC, "cpic" }, - { EF_MIPS_ABI2, EF_MIPS_ABI2, "abi2" }, - { EF_MIPS_ARCH, E_MIPS_ARCH_1, "mips1" }, - { EF_MIPS_ARCH, E_MIPS_ARCH_2, "mips2" }, - { EF_MIPS_ARCH, E_MIPS_ARCH_3, "mips3" }, - { EF_MIPS_ARCH, E_MIPS_ARCH_4, "mips4" }, - { EF_MIPS_ARCH, E_MIPS_ARCH_5, "mips5" } - }; -#define nflags (sizeof (mips_flags) / sizeof (mips_flags[0])) - size_t cnt; - - for (cnt = 0; cnt < nflags; ++cnt) - if ((*flags & mips_flags[cnt].mask) == mips_flags[cnt].flag) - { - *flags &= ~mips_flags[cnt].mask; - return mips_flags[cnt].str; - } - - /* We don't know the flag. */ - return NULL; -} - - -const char * -mips_dynamic_tag_name (int64_t tag, char *buf, size_t len) -{ - static const struct - { - int tag; - const char *str; - } mips_dtags[] = - { - { DT_MIPS_RLD_VERSION, "MIPS_RLD_VERSION" }, - { DT_MIPS_TIME_STAMP, "MIPS_TIME_STAMP" }, - { DT_MIPS_ICHECKSUM, "MIPS_ICHECKSUM" }, - { DT_MIPS_IVERSION, "MIPS_IVERSION" }, - { DT_MIPS_FLAGS, "MIPS_FLAGS" }, - { DT_MIPS_BASE_ADDRESS, "MIPS_BASE_ADDRESS" }, - { DT_MIPS_MSYM, "MIPS_MSYM" }, - { DT_MIPS_CONFLICT, "MIPS_CONFLICT" }, - { DT_MIPS_LIBLIST, "MIPS_LIBLIST" }, - { DT_MIPS_LOCAL_GOTNO, "MIPS_LOCAL_GOTNO" }, - { DT_MIPS_CONFLICTNO, "MIPS_CONFLICTNO" }, - { DT_MIPS_LIBLISTNO, "MIPS_LIBLISTNO" }, - { DT_MIPS_SYMTABNO, "MIPS_SYMTABNO" }, - { DT_MIPS_UNREFEXTNO, "MIPS_UNREFEXTNO" }, - { DT_MIPS_GOTSYM, "MIPS_GOTSYM" }, - { DT_MIPS_HIPAGENO, "MIPS_HIPAGENO" }, - { DT_MIPS_RLD_MAP, "MIPS_RLD_MAP" }, - { DT_MIPS_DELTA_CLASS, "MIPS_DELTA_CLASS" }, - { DT_MIPS_DELTA_CLASS_NO, "MIPS_DELTA_CLASS_NO" }, - { DT_MIPS_DELTA_INSTANCE, "MIPS_DELTA_INSTANCE" }, - { DT_MIPS_DELTA_INSTANCE_NO, "MIPS_DELTA_INSTANCE_NO" }, - { DT_MIPS_DELTA_RELOC, "MIPS_DELTA_RELOC" }, - { DT_MIPS_DELTA_RELOC_NO, "MIPS_DELTA_RELOC_NO" }, - { DT_MIPS_DELTA_SYM, "MIPS_DELTA_SYM" }, - { DT_MIPS_DELTA_SYM_NO, "MIPS_DELTA_SYM_NO" }, - { DT_MIPS_DELTA_CLASSSYM, "MIPS_DELTA_CLASSSYM" }, - { DT_MIPS_DELTA_CLASSSYM_NO, "MIPS_DELTA_CLASSSYM_NO" }, - { DT_MIPS_CXX_FLAGS, "MIPS_CXX_FLAGS" }, - { DT_MIPS_PIXIE_INIT, "MIPS_PIXIE_INIT" }, - { DT_MIPS_SYMBOL_LIB, "MIPS_SYMBOL_LIB" }, - { DT_MIPS_LOCALPAGE_GOTIDX, "MIPS_LOCALPAGE_GOTIDX" }, - { DT_MIPS_LOCAL_GOTIDX, "MIPS_LOCAL_GOTIDX" }, - { DT_MIPS_HIDDEN_GOTIDX, "MIPS_HIDDEN_GOTIDX" }, - { DT_MIPS_PROTECTED_GOTIDX, "MIPS_PROTECTED_GOTIDX" }, - { DT_MIPS_OPTIONS, "MIPS_OPTIONS" }, - { DT_MIPS_INTERFACE, "MIPS_INTERFACE" }, - { DT_MIPS_DYNSTR_ALIGN, "MIPS_DYNSTR_ALIGN" }, - { DT_MIPS_INTERFACE_SIZE, "MIPS_INTERFACE_SIZE" }, - { DT_MIPS_RLD_TEXT_RESOLVE_ADDR, "MIPS_RLD_TEXT_RESOLVE_ADDR" }, - { DT_MIPS_PERF_SUFFIX, "MIPS_PERF_SUFFIX" }, - { DT_MIPS_COMPACT_SIZE, "MIPS_COMPACT_SIZE" }, - { DT_MIPS_GP_VALUE, "MIPS_GP_VALUE" }, - { DT_MIPS_AUX_DYNAMIC, "MIPS_AUX_DYNAMIC" }, - }; -#define ndtags (sizeof (mips_dtags) / sizeof (mips_dtags[0])) - size_t cnt; - - for (cnt = 0; cnt < ndtags; ++cnt) - if (tag == mips_dtags[cnt].tag) - return mips_dtags[cnt].str; - - /* We don't know this dynamic tag. */ - return NULL; -} diff --git a/libebl/ppc64_destr.c b/libebl/ppc64_destr.c deleted file mode 100644 index 9fd38021..00000000 --- a/libebl/ppc64_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for PPC64 specific backend library. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ppc64.h> - - -void -ppc64_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/ppc64_init.c b/libebl/ppc64_init.c deleted file mode 100644 index fec963b2..00000000 --- a/libebl/ppc64_init.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Initialization of PPC64 specific backend library. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ppc64.h> - - -int -ppc64_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "PowerPC 64-bit"; - eh->reloc_type_name = ppc64_reloc_type_name; - eh->reloc_type_check = ppc64_reloc_type_check; - eh->reloc_valid_use = ppc64_reloc_valid_use; - eh->dynamic_tag_name = ppc64_dynamic_tag_name; - eh->destr = ppc64_destr; - - return 0; -} diff --git a/libebl/ppc64_symbol.c b/libebl/ppc64_symbol.c deleted file mode 100644 index 9ab53667..00000000 --- a/libebl/ppc64_symbol.c +++ /dev/null @@ -1,206 +0,0 @@ -/* PPC64 specific symbolic name handling. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> - -#include <libebl_ppc64.h> - - -/* Return of the backend. */ -const char * -ppc64_backend_name (void) -{ - return "ppc64"; -} - - -/* Relocation mapping table. */ -static struct -{ - const char *name; - enum { both = 0, rel = 1, exec = 2 } appear; -} reloc_map_table[] = - { - // XXX Check all the appear values. - [R_PPC64_NONE] = { "R_PPC64_NONE", both }, - [R_PPC64_ADDR32] = { "R_PPC64_ADDR32", both }, - [R_PPC64_ADDR24] = { "R_PPC64_ADDR24", both }, - [R_PPC64_ADDR16] = { "R_PPC64_ADDR16", both }, - [R_PPC64_ADDR16_LO] = { "R_PPC64_ADDR16_LO", both }, - [R_PPC64_ADDR16_HI] = { "R_PPC64_ADDR16_HI", both }, - [R_PPC64_ADDR16_HA] = { "R_PPC64_ADDR16_HA", both }, - [R_PPC64_ADDR14] = { "R_PPC64_ADDR14", both }, - [R_PPC64_ADDR14_BRTAKEN] = { "R_PPC64_ADDR14_BRTAKEN", exec }, - [R_PPC64_ADDR14_BRNTAKEN] = { "R_PPC64_ADDR14_BRNTAKEN", exec }, - [R_PPC64_REL24] = { "R_PPC64_REL24", both }, - [R_PPC64_REL14] = { "R_PPC64_REL14", both }, - [R_PPC64_REL14_BRTAKEN] = { "R_PPC64_REL14_BRTAKEN", exec }, - [R_PPC64_REL14_BRNTAKEN] = { "R_PPC64_REL14_BRNTAKEN", exec }, - [R_PPC64_GOT16] = { "R_PPC64_GOT16", rel }, - [R_PPC64_GOT16_LO] = { "R_PPC64_GOT16_LO", rel }, - [R_PPC64_GOT16_HI] = { "R_PPC64_GOT16_HI", rel }, - [R_PPC64_GOT16_HA] = { "R_PPC64_GOT16_HA", rel }, - [R_PPC64_COPY] = { "R_PPC64_COPY", exec }, - [R_PPC64_GLOB_DAT] = { "R_PPC64_GLOB_DAT", exec }, - [R_PPC64_JMP_SLOT] = { "R_PPC64_JMP_SLOT", exec }, - [R_PPC64_RELATIVE] = { "R_PPC64_RELATIVE", exec }, - [R_PPC64_UADDR32] = { "R_PPC64_UADDR32", exec }, - [R_PPC64_UADDR16] = { "R_PPC64_UADDR16", exec }, - [R_PPC64_REL32] = { "R_PPC64_REL32", exec }, - [R_PPC64_PLT32] = { "R_PPC64_PLT32", exec }, - [R_PPC64_PLTREL32] = { "R_PPC64_PLTREL32", both }, - [R_PPC64_PLT16_LO] = { "R_PPC64_PLT16_LO", both }, - [R_PPC64_PLT16_HI] = { "R_PPC64_PLT16_HI", both }, - [R_PPC64_PLT16_HA] = { "R_PPC64_PLT16_HA", both }, - [R_PPC64_SECTOFF] = { "R_PPC64_SECTOFF", both }, - [R_PPC64_SECTOFF_LO] = { "R_PPC64_SECTOFF_LO", both }, - [R_PPC64_SECTOFF_HI] = { "R_PPC64_SECTOFF_HI", both }, - [R_PPC64_SECTOFF_HA] = { "R_PPC64_SECTOFF_HA", both }, - [R_PPC64_ADDR30] = { "R_PPC64_ADDR30", both }, - [R_PPC64_ADDR64] = { "R_PPC64_ADDR64", both }, - [R_PPC64_ADDR16_HIGHER] = { "R_PPC64_ADDR16_HIGHER", both }, - [R_PPC64_ADDR16_HIGHERA] = { "R_PPC64_ADDR16_HIGHERA", both }, - [R_PPC64_ADDR16_HIGHEST] = { "R_PPC64_ADDR16_HIGHEST", both }, - [R_PPC64_ADDR16_HIGHESTA] = { "R_PPC64_ADDR16_HIGHESTA", both }, - [R_PPC64_UADDR64] = { "R_PPC64_UADDR64", both }, - [R_PPC64_REL64] = { "R_PPC64_REL64", both }, - [R_PPC64_PLT64] = { "R_PPC64_PLT64", both }, - [R_PPC64_PLTREL64] = { "R_PPC64_PLTREL64", both }, - [R_PPC64_TOC16] = { "R_PPC64_TOC16", both }, - [R_PPC64_TOC16_LO] = { "R_PPC64_TOC16_LO", both }, - [R_PPC64_TOC16_HI] = { "R_PPC64_TOC16_HI", both }, - [R_PPC64_TOC16_HA] = { "R_PPC64_TOC16_HA", both }, - [R_PPC64_TOC] = { "R_PPC64_TOC", both }, - [R_PPC64_PLTGOT16] = { "R_PPC64_PLTGOT16", both }, - [R_PPC64_PLTGOT16_LO] = { "R_PPC64_PLTGOT16_LO", both }, - [R_PPC64_PLTGOT16_HI] = { "R_PPC64_PLTGOT16_HI", both }, - [R_PPC64_PLTGOT16_HA] = { "R_PPC64_PLTGOT16_HA", both }, - [R_PPC64_ADDR16_DS] = { "R_PPC64_ADDR16_DS", both }, - [R_PPC64_ADDR16_LO_DS] = { "R_PPC64_ADDR16_LO_DS", both }, - [R_PPC64_GOT16_DS] = { "R_PPC64_GOT16_DS", both }, - [R_PPC64_GOT16_LO_DS] = { "R_PPC64_GOT16_LO_DS", both }, - [R_PPC64_PLT16_LO_DS] = { "R_PPC64_PLT16_LO_DS", both }, - [R_PPC64_SECTOFF_DS] = { "R_PPC64_SECTOFF_DS", both }, - [R_PPC64_SECTOFF_LO_DS] = { "R_PPC64_SECTOFF_LO_DS", both }, - [R_PPC64_TOC16_DS] = { "R_PPC64_TOC16_DS", both }, - [R_PPC64_TOC16_LO_DS] = { "R_PPC64_TOC16_LO_DS", both }, - [R_PPC64_PLTGOT16_DS] = { "R_PPC64_PLTGOT16_DS", both }, - [R_PPC64_PLTGOT16_LO_DS] = { "R_PPC64_PLTGOT16_LO_DS", both }, - [R_PPC64_TLS] = { "R_PPC64_TLS", both }, - [R_PPC64_DTPMOD64] = { "R_PPC64_DTPMOD64", both }, - [R_PPC64_TPREL16] = { "R_PPC64_TPREL16", both }, - [R_PPC64_TPREL16_LO] = { "R_PPC64_TPREL16_LO", both }, - [R_PPC64_TPREL16_HI] = { "R_PPC64_TPREL16_HI", both }, - [R_PPC64_TPREL16_HA] = { "R_PPC64_TPREL16_HA", both }, - [R_PPC64_TPREL64] = { "R_PPC64_TPREL64", both }, - [R_PPC64_DTPREL16] = { "R_PPC64_DTPREL16", both }, - [R_PPC64_DTPREL16_LO] = { "R_PPC64_DTPREL16_LO", both }, - [R_PPC64_DTPREL16_HI] = { "R_PPC64_DTPREL16_HI", both }, - [R_PPC64_DTPREL16_HA] = { "R_PPC64_DTPREL16_HA", both }, - [R_PPC64_DTPREL64] = { "R_PPC64_DTPREL64", both }, - [R_PPC64_GOT_TLSGD16] = { "R_PPC64_GOT_TLSGD16", both }, - [R_PPC64_GOT_TLSGD16_LO] = { "R_PPC64_GOT_TLSGD16_LO", both }, - [R_PPC64_GOT_TLSGD16_HI] = { "R_PPC64_GOT_TLSGD16_HI", both }, - [R_PPC64_GOT_TLSGD16_HA] = { "R_PPC64_GOT_TLSGD16_HA", both }, - [R_PPC64_GOT_TLSLD16] = { "R_PPC64_GOT_TLSLD16", both }, - [R_PPC64_GOT_TLSLD16_LO] = { "R_PPC64_GOT_TLSLD16_LO", both }, - [R_PPC64_GOT_TLSLD16_HI] = { "R_PPC64_GOT_TLSLD16_HI", both }, - [R_PPC64_GOT_TLSLD16_HA] = { "R_PPC64_GOT_TLSLD16_HA", both }, - [R_PPC64_GOT_TPREL16_DS] = { "R_PPC64_GOT_TPREL16_DS", both }, - [R_PPC64_GOT_TPREL16_LO_DS] = { "R_PPC64_GOT_TPREL16_LO_DS", both }, - [R_PPC64_GOT_TPREL16_HI] = { "R_PPC64_GOT_TPREL16_HI", both }, - [R_PPC64_GOT_TPREL16_HA] = { "R_PPC64_GOT_TPREL16_HA", both }, - [R_PPC64_GOT_DTPREL16_DS] = { "R_PPC64_GOT_DTPREL16_DS", both }, - [R_PPC64_GOT_DTPREL16_LO_DS] = { "R_PPC64_GOT_DTPREL16_LO_DS", both }, - [R_PPC64_GOT_DTPREL16_HI] = { "R_PPC64_GOT_DTPREL16_HI", both }, - [R_PPC64_GOT_DTPREL16_HA] = { "R_PPC64_GOT_DTPREL16_HA", both }, - [R_PPC64_TPREL16_DS] = { "R_PPC64_TPREL16_DS", both }, - [R_PPC64_TPREL16_LO_DS] = { "R_PPC64_TPREL16_LO_DS", both }, - [R_PPC64_TPREL16_HIGHER] = { "R_PPC64_TPREL16_HIGHER", both }, - [R_PPC64_TPREL16_HIGHERA] = { "R_PPC64_TPREL16_HIGHERA", both }, - [R_PPC64_TPREL16_HIGHEST] = { "R_PPC64_TPREL16_HIGHEST", both }, - [R_PPC64_TPREL16_HIGHESTA] = { "R_PPC64_TPREL16_HIGHESTA", both }, - [R_PPC64_DTPREL16_DS] = { "R_PPC64_DTPREL16_DS", both }, - [R_PPC64_DTPREL16_LO_DS] = { "R_PPC64_DTPREL16_LO_DS", both }, - [R_PPC64_DTPREL16_HIGHER] = { "R_PPC64_DTPREL16_HIGHER", both }, - [R_PPC64_DTPREL16_HIGHERA] = { "R_PPC64_DTPREL16_HIGHERA", both }, - [R_PPC64_DTPREL16_HIGHEST] = { "R_PPC64_DTPREL16_HIGHEST", both }, - [R_PPC64_DTPREL16_HIGHESTA] = { "R_PPC64_DTPREL16_HIGHESTA", both } - }; - - -/* Determine relocation type string for PPC. */ -const char * -ppc64_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < R_PPC64_NONE || type >= R_PPC64_NUM) - return NULL; - - return reloc_map_table[type].name; -} - - -/* Check for correct relocation type. */ -bool -ppc64_reloc_type_check (int type) -{ - return (type >= R_PPC64_NONE && type < R_PPC64_NUM - && reloc_map_table[type].name != NULL) ? true : false; -} - - -/* Check for correct relocation type use. */ -bool -ppc64_reloc_valid_use (Elf *elf, int type) -{ - if (type < R_PPC64_NONE || type >= R_PPC64_NUM - || reloc_map_table[type].name == NULL) - return false; - - Elf64_Ehdr *ehdr = elf64_getehdr (elf); - assert (ehdr != NULL); - - if (reloc_map_table[type].appear == rel) - return ehdr->e_type == ET_REL; - - if (reloc_map_table[type].appear == exec) - return ehdr->e_type != ET_REL; - - assert (reloc_map_table[type].appear == both); - return true; -} - - -const char * -ppc64_dynamic_tag_name (int64_t tag, char *buf, size_t len) -{ - switch (tag) - { - case DT_PPC64_GLINK: - return "PPC64_GLINK"; - case DT_PPC64_OPD: - return "PPC64_OPD"; - case DT_PPC64_OPDSZ: - return "PPC64_OPDSZ"; - default: - break; - } - return NULL; -} diff --git a/libebl/ppc_destr.c b/libebl/ppc_destr.c deleted file mode 100644 index 219de067..00000000 --- a/libebl/ppc_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for PPC specific backend library. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ppc.h> - - -void -ppc_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/ppc_init.c b/libebl/ppc_init.c deleted file mode 100644 index 9b45bd73..00000000 --- a/libebl/ppc_init.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Initialization of PPC specific backend library. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_ppc.h> - - -int -ppc_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "PowerPC"; - eh->reloc_type_name = ppc_reloc_type_name; - eh->reloc_type_check = ppc_reloc_type_check; - eh->reloc_valid_use = ppc_reloc_valid_use; - eh->destr = ppc_destr; - - return 0; -} diff --git a/libebl/ppc_symbol.c b/libebl/ppc_symbol.c deleted file mode 100644 index 08a9fef7..00000000 --- a/libebl/ppc_symbol.c +++ /dev/null @@ -1,149 +0,0 @@ -/* PPC specific symbolic name handling. - Copyright (C) 2004 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> - -#include <libebl_ppc.h> - - -/* Return of the backend. */ -const char * -ppc_backend_name (void) -{ - return "ppc"; -} - - -/* Relocation mapping table. */ -static struct -{ - const char *name; - enum { both = 0, rel = 1, exec = 2 } appear; -} reloc_map_table[] = - { - // XXX Check all the appear values. - [R_PPC_NONE] = { "R_PPC_NONE", both }, - [R_PPC_ADDR32] = { "R_PPC_ADDR32", both }, - [R_PPC_ADDR24] = { "R_PPC_ADDR24", both }, - [R_PPC_ADDR16] = { "R_PPC_ADDR16", both }, - [R_PPC_ADDR16_LO] = { "R_PPC_ADDR16_LO", both }, - [R_PPC_ADDR16_HI] = { "R_PPC_ADDR16_HI", both }, - [R_PPC_ADDR16_HA] = { "R_PPC_ADDR16_HA", both }, - [R_PPC_ADDR14] = { "R_PPC_ADDR14", exec }, - [R_PPC_ADDR14_BRTAKEN] = { "R_PPC_ADDR14_BRTAKEN", exec }, - [R_PPC_ADDR14_BRNTAKEN] = { "R_PPC_ADDR14_BRNTAKEN", exec }, - [R_PPC_REL24] = { "R_PPC_REL24", both }, - [R_PPC_REL14] = { "R_PPC_REL14", both }, - [R_PPC_REL14_BRTAKEN] = { "R_PPC_REL14_BRTAKEN", exec }, - [R_PPC_REL14_BRNTAKEN] = { "R_PPC_REL14_BRNTAKEN", exec }, - [R_PPC_GOT16] = { "R_PPC_GOT16", rel }, - [R_PPC_GOT16_LO] = { "R_PPC_GOT16_LO", rel }, - [R_PPC_GOT16_HI] = { "R_PPC_GOT16_HI", rel }, - [R_PPC_GOT16_HA] = { "R_PPC_GOT16_HA", rel }, - [R_PPC_PLTREL24] = { "R_PPC_PLTREL24", rel }, - [R_PPC_COPY] = { "R_PPC_COPY", exec }, - [R_PPC_GLOB_DAT] = { "R_PPC_GLOB_DAT", exec }, - [R_PPC_JMP_SLOT] = { "R_PPC_JMP_SLOT", exec }, - [R_PPC_RELATIVE] = { "R_PPC_RELATIVE", exec }, - [R_PPC_LOCAL24PC] = { "R_PPC_LOCAL24PC", rel }, - [R_PPC_UADDR32] = { "R_PPC_UADDR32", exec }, - [R_PPC_UADDR16] = { "R_PPC_UADDR16", exec }, - [R_PPC_REL32] = { "R_PPC_REL32", exec }, - [R_PPC_PLT32] = { "R_PPC_PLT32", exec }, - [R_PPC_PLTREL32] = { "R_PPC_PLTREL32", both }, - [R_PPC_PLT16_LO] = { "R_PPC_PLT16_LO", both }, - [R_PPC_PLT16_HI] = { "R_PPC_PLT16_HI", both }, - [R_PPC_PLT16_HA] = { "R_PPC_PLT16_HA", both }, - [R_PPC_SDAREL16] = { "R_PPC_SDAREL16", both }, - [R_PPC_SECTOFF] = { "R_PPC_SECTOFF", both }, - [R_PPC_SECTOFF_LO] = { "R_PPC_SECTOFF_LO", both }, - [R_PPC_SECTOFF_HI] = { "R_PPC_SECTOFF_HI", both }, - [R_PPC_SECTOFF_HA] = { "R_PPC_SECTOFF_HA", both }, - [R_PPC_TLS] = { "R_PPC_TLS", both }, - [R_PPC_DTPMOD32] = { "R_PPC_DTPMOD32", exec }, - [R_PPC_TPREL16] = { "R_PPC_TPREL16", rel }, - [R_PPC_TPREL16_LO] = { "R_PPC_TPREL16_LO", rel }, - [R_PPC_TPREL16_HI] = { "R_PPC_TPREL16_HI", rel }, - [R_PPC_TPREL16_HA] = { "R_PPC_TPREL16_HA", rel }, - [R_PPC_TPREL32] = { "R_PPC_TPREL32", exec }, - [R_PPC_DTPREL16] = { "R_PPC_DTPREL16", rel }, - [R_PPC_DTPREL16_LO] = { "R_PPC_DTPREL16_LO", rel }, - [R_PPC_DTPREL16_HI] = { "R_PPC_DTPREL16_HI", rel }, - [R_PPC_DTPREL16_HA] = { "R_PPC_DTPREL16_HA", rel }, - [R_PPC_DTPREL32] = { "R_PPC_DTPREL32", exec }, - [R_PPC_GOT_TLSGD16] = { "R_PPC_GOT_TLSGD16", exec }, - [R_PPC_GOT_TLSGD16_LO] = { "R_PPC_GOT_TLSGD16_LO", exec }, - [R_PPC_GOT_TLSGD16_HI] = { "R_PPC_GOT_TLSGD16_HI", exec }, - [R_PPC_GOT_TLSGD16_HA] = { "R_PPC_GOT_TLSGD16_HA", exec }, - [R_PPC_GOT_TLSLD16] = { "R_PPC_GOT_TLSLD16", exec }, - [R_PPC_GOT_TLSLD16_LO] = { "R_PPC_GOT_TLSLD16_LO", exec }, - [R_PPC_GOT_TLSLD16_HI] = { "R_PPC_GOT_TLSLD16_HI", exec }, - [R_PPC_GOT_TLSLD16_HA] = { "R_PPC_GOT_TLSLD16_HA", exec }, - [R_PPC_GOT_TPREL16] = { "R_PPC_GOT_TPREL16", exec }, - [R_PPC_GOT_TPREL16_LO] = { "R_PPC_GOT_TPREL16_LO", exec }, - [R_PPC_GOT_TPREL16_HI] = { "R_PPC_GOT_TPREL16_HI", exec }, - [R_PPC_GOT_TPREL16_HA] = { "R_PPC_GOT_TPREL16_HA", exec }, - [R_PPC_GOT_DTPREL16] = { "R_PPC_GOT_DTPREL16", exec }, - [R_PPC_GOT_DTPREL16_LO] = { "R_PPC_GOT_DTPREL16_LO", exec }, - [R_PPC_GOT_DTPREL16_HI] = { "R_PPC_GOT_DTPREL16_HI", exec }, - [R_PPC_GOT_DTPREL16_HA] = { "R_PPC_GOT_DTPREL16_HA", exec } - }; - - -/* Determine relocation type string for PPC. */ -const char * -ppc_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < 0 || type >= R_PPC_NUM) - return NULL; - - return reloc_map_table[type].name; -} - - -/* Check for correct relocation type. */ -bool -ppc_reloc_type_check (int type) -{ - return (type >= R_PPC_NONE && type < R_PPC_NUM - && reloc_map_table[type].name != NULL) ? true : false; -} - - -/* Check for correct relocation type use. */ -bool -ppc_reloc_valid_use (Elf *elf, int type) -{ - if (type < R_PPC_NONE || type >= R_PPC_NUM - || reloc_map_table[type].name == NULL) - return false; - - Elf32_Ehdr *ehdr = elf32_getehdr (elf); - assert (ehdr != NULL); - - if (reloc_map_table[type].appear == rel) - return ehdr->e_type == ET_REL; - - if (reloc_map_table[type].appear == exec) - return ehdr->e_type != ET_REL; - - assert (reloc_map_table[type].appear == both); - return true; -} diff --git a/libebl/sh_destr.c b/libebl/sh_destr.c deleted file mode 100644 index f6b03b3a..00000000 --- a/libebl/sh_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for SH specific backend library. - Copyright (C) 2000. 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_sh.h> - - -void -sh_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/sh_init.c b/libebl/sh_init.c deleted file mode 100644 index cc26640b..00000000 --- a/libebl/sh_init.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Initialization of SH specific backend library. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_sh.h> - - -int -sh_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "Hitachi SH"; - eh->reloc_type_name = sh_reloc_type_name; - eh->destr = sh_destr; - - return 0; -} diff --git a/libebl/sh_symbol.c b/libebl/sh_symbol.c deleted file mode 100644 index 6211ab51..00000000 --- a/libebl/sh_symbol.c +++ /dev/null @@ -1,91 +0,0 @@ -/* SH specific relocation handling. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_sh.h> - - -/* Return of the backend. */ -const char * -sh_backend_name (void) -{ - return "sh"; -} - - -/* Determine relocation type string for SH. */ -const char * -sh_reloc_type_name (int type, char *buf, size_t len) -{ - static const char *map_table1[] = - { - [R_SH_NONE] = "R_SH_NONE", - [R_SH_DIR32] = "R_SH_DIR32", - [R_SH_REL32] = "R_SH_REL32", - [R_SH_DIR8WPN] = "R_SH_DIR8WPN", - [R_SH_IND12W] = "R_SH_IND12W", - [R_SH_DIR8WPL] = "R_SH_DIR8WPL", - [R_SH_DIR8WPZ] = "R_SH_DIR8WPZ", - [R_SH_DIR8BP] = "R_SH_DIR8BP", - [R_SH_DIR8W] = "R_SH_DIR8W", - [R_SH_DIR8L] = "R_SH_DIR8L", - [R_SH_SWITCH16] = "R_SH_SWITCH16", - [R_SH_SWITCH32] = "R_SH_SWITCH32", - [R_SH_USES] = "R_SH_USES", - [R_SH_COUNT] = "R_SH_COUNT", - [R_SH_ALIGN] = "R_SH_ALIGN", - [R_SH_CODE] = "R_SH_CODE", - [R_SH_DATA] = "R_SH_DATA", - [R_SH_LABEL] = "R_SH_LABEL", - [R_SH_SWITCH8] = "R_SH_SWITCH8", - [R_SH_GNU_VTINHERIT] ="R_SH_GNU_VTINHERIT", - [R_SH_GNU_VTENTRY] = "R_SH_GNU_VTENTRY" - }; - static const char *map_table2[] = - { - [R_SH_TLS_GD_32] = "R_SH_TLS_GD_32", - [R_SH_TLS_LD_32] = "R_SH_TLS_LD_32", - [R_SH_TLS_LDO_32] = "R_SH_TLS_LDO_32", - [R_SH_TLS_IE_32] = "R_SH_TLS_IE_32", - [R_SH_TLS_LE_32] = "R_SH_TLS_LE_32", - [R_SH_TLS_DTPMOD32] = "R_SH_TLS_DTPMOD32", - [R_SH_TLS_DTPOFF32] = "R_SH_TLS_DTPOFF32", - [R_SH_TLS_TPOFF32] = "R_SH_TLS_TPOFF32", - [R_SH_GOT32 - R_SH_GOT32] = "R_SH_GOT32", - [R_SH_PLT32 - R_SH_GOT32] = "R_SH_PLT32", - [R_SH_COPY - R_SH_GOT32] = "R_SH_COPY", - [R_SH_GLOB_DAT - R_SH_GOT32] = "R_SH_GLOB_DAT", - [R_SH_JMP_SLOT - R_SH_GOT32] = "R_SH_JMP_SLOT", - [R_SH_RELATIVE - R_SH_GOT32] = "R_SH_RELATIVE", - [R_SH_GOTOFF - R_SH_GOT32] = "R_SH_GOTOFF", - [R_SH_GOTPC - R_SH_GOT32] = "R_SH_GOTPC" - }; - - if (type >= 0 - && (size_t) type < sizeof (map_table1) / sizeof (map_table1[0])) - return map_table1[type]; - - if ((type - R_SH_TLS_GD_32) >= 0 - && ((size_t) (type - R_SH_TLS_GD_32) - < sizeof (map_table2) / sizeof (map_table2[0]))) - return map_table2[type - R_SH_TLS_GD_32]; - - return NULL; -} diff --git a/libebl/sparc_destr.c b/libebl/sparc_destr.c deleted file mode 100644 index ced22917..00000000 --- a/libebl/sparc_destr.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Destructor for SPARC specific backend library. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_sparc.h> - - -void -sparc_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/sparc_init.c b/libebl/sparc_init.c deleted file mode 100644 index 2bb1f790..00000000 --- a/libebl/sparc_init.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Initialization of SPARC specific backend library. - Copyright (C) 2002 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_sparc.h> - - -int -sparc_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - if (machine == EM_SPARCV9) - eh->name = "SPARC v9"; - else if (machine == EM_SPARC32PLUS) - eh->name = "SPARC v8+"; - else - eh->name = "SPARC"; - eh->reloc_type_name = sparc_reloc_type_name; - eh->reloc_type_check = sparc_reloc_type_check; - //eh->core_note = sparc_core_note; - eh->destr = sparc_destr; - - return 0; -} diff --git a/libebl/sparc_symbol.c b/libebl/sparc_symbol.c deleted file mode 100644 index eed31d11..00000000 --- a/libebl/sparc_symbol.c +++ /dev/null @@ -1,141 +0,0 @@ -/* SPARC specific symbolic name handling. - Copyright (C) 2002, 2003 Red Hat, Inc. - Written by Jakub Jelinek <jakub@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#include <libebl_sparc.h> - - -/* Return of the backend. */ -const char * -sparc_backend_name (void) -{ - return "sparc"; -} - - -/* Relocation mapping table. */ -static const char *reloc_map_table[] = - { - [R_SPARC_NONE] = "R_SPARC_NONE", - [R_SPARC_8] = "R_SPARC_8", - [R_SPARC_16] = "R_SPARC_16", - [R_SPARC_32] = "R_SPARC_32", - [R_SPARC_DISP8] = "R_SPARC_DISP8", - [R_SPARC_DISP16] = "R_SPARC_DISP16", - [R_SPARC_DISP32] = "R_SPARC_DISP32", - [R_SPARC_WDISP30] = "R_SPARC_WDISP30", - [R_SPARC_WDISP22] = "R_SPARC_WDISP22", - [R_SPARC_HI22] = "R_SPARC_HI22", - [R_SPARC_22] = "R_SPARC_22", - [R_SPARC_13] = "R_SPARC_13", - [R_SPARC_LO10] = "R_SPARC_LO10", - [R_SPARC_GOT10] = "R_SPARC_GOT10", - [R_SPARC_GOT13] = "R_SPARC_GOT13", - [R_SPARC_GOT22] = "R_SPARC_GOT22", - [R_SPARC_PC10] = "R_SPARC_PC10", - [R_SPARC_PC22] = "R_SPARC_PC22", - [R_SPARC_WPLT30] = "R_SPARC_WPLT30", - [R_SPARC_COPY] = "R_SPARC_COPY", - [R_SPARC_GLOB_DAT] = "R_SPARC_GLOB_DAT", - [R_SPARC_JMP_SLOT] = "R_SPARC_JMP_SLOT", - [R_SPARC_RELATIVE] = "R_SPARC_RELATIVE", - [R_SPARC_UA32] = "R_SPARC_UA32", - [R_SPARC_PLT32] = "R_SPARC_PLT32", - [R_SPARC_HIPLT22] = "R_SPARC_HIPLT22", - [R_SPARC_LOPLT10] = "R_SPARC_LOPLT10", - [R_SPARC_PCPLT32] = "R_SPARC_PCPLT32", - [R_SPARC_PCPLT22] = "R_SPARC_PCPLT22", - [R_SPARC_PCPLT10] = "R_SPARC_PCPLT10", - [R_SPARC_10] = "R_SPARC_10", - [R_SPARC_11] = "R_SPARC_11", - [R_SPARC_64] = "R_SPARC_64", - [R_SPARC_OLO10] = "R_SPARC_OLO10", - [R_SPARC_HH22] = "R_SPARC_HH22", - [R_SPARC_HM10] = "R_SPARC_HM10", - [R_SPARC_LM22] = "R_SPARC_LM22", - [R_SPARC_PC_HH22] = "R_SPARC_PC_HH22", - [R_SPARC_PC_HM10] = "R_SPARC_PC_HM10", - [R_SPARC_PC_LM22] = "R_SPARC_PC_LM22", - [R_SPARC_WDISP16] = "R_SPARC_WDISP16", - [R_SPARC_WDISP19] = "R_SPARC_WDISP19", - [R_SPARC_7] = "R_SPARC_7", - [R_SPARC_5] = "R_SPARC_5", - [R_SPARC_6] = "R_SPARC_6", - [R_SPARC_DISP64] = "R_SPARC_DISP64", - [R_SPARC_PLT64] = "R_SPARC_PLT64", - [R_SPARC_HIX22] = "R_SPARC_HIX22", - [R_SPARC_LOX10] = "R_SPARC_LOX10", - [R_SPARC_H44] = "R_SPARC_H44", - [R_SPARC_M44] = "R_SPARC_M44", - [R_SPARC_L44] = "R_SPARC_L44", - [R_SPARC_REGISTER] = "R_SPARC_REGISTER", - [R_SPARC_UA64] = "R_SPARC_UA64", - [R_SPARC_UA16] = "R_SPARC_UA16", - [R_SPARC_TLS_GD_HI22] = "R_SPARC_TLS_GD_HI22", - [R_SPARC_TLS_GD_LO10] = "R_SPARC_TLS_GD_LO10", - [R_SPARC_TLS_GD_ADD] = "R_SPARC_TLS_GD_ADD", - [R_SPARC_TLS_GD_CALL] = "R_SPARC_TLS_GD_CALL", - [R_SPARC_TLS_LDM_HI22] = "R_SPARC_TLS_LDM_HI22", - [R_SPARC_TLS_LDM_LO10] = "R_SPARC_TLS_LDM_LO10", - [R_SPARC_TLS_LDM_ADD] = "R_SPARC_TLS_LDM_ADD", - [R_SPARC_TLS_LDM_CALL] = "R_SPARC_TLS_LDM_CALL", - [R_SPARC_TLS_LDO_HIX22] = "R_SPARC_TLS_LDO_HIX22", - [R_SPARC_TLS_LDO_LOX10] = "R_SPARC_TLS_LDO_LOX10", - [R_SPARC_TLS_LDO_ADD] = "R_SPARC_TLS_LDO_ADD", - [R_SPARC_TLS_IE_HI22] = "R_SPARC_TLS_IE_HI22", - [R_SPARC_TLS_IE_LO10] = "R_SPARC_TLS_IE_LO10", - [R_SPARC_TLS_IE_LD] = "R_SPARC_TLS_IE_LD", - [R_SPARC_TLS_IE_LDX] = "R_SPARC_TLS_IE_LDX", - [R_SPARC_TLS_IE_ADD] = "R_SPARC_TLS_IE_ADD", - [R_SPARC_TLS_LE_HIX22] = "R_SPARC_TLS_LE_HIX22", - [R_SPARC_TLS_LE_LOX10] = "R_SPARC_TLS_LE_LOX10", - [R_SPARC_TLS_DTPMOD32] = "R_SPARC_TLS_DTPMOD32", - [R_SPARC_TLS_DTPMOD64] = "R_SPARC_TLS_DTPMOD64", - [R_SPARC_TLS_DTPOFF32] = "R_SPARC_TLS_DTPOFF32", - [R_SPARC_TLS_DTPOFF64] = "R_SPARC_TLS_DTPOFF64", - [R_SPARC_TLS_TPOFF32] = "R_SPARC_TLS_TPOFF32", - [R_SPARC_TLS_TPOFF64] = "R_SPARC_TLS_TPOFF64" - }; - - -/* Determine relocation type string for sparc. */ -const char * -sparc_reloc_type_name (int type, char *buf, size_t len) -{ - /* High 24 bits of r_type are used for second addend in R_SPARC_OLO10. */ - if ((type & 0xff) == R_SPARC_OLO10) - return reloc_map_table[type & 0xff]; - - if (type < 0 || type >= R_SPARC_NUM) - return NULL; - - return reloc_map_table[type]; -} - - -/* Check for correct relocation type. */ -bool -sparc_reloc_type_check (int type) -{ - if ((type & 0xff) == R_SPARC_OLO10) - return true; - return (type >= R_SPARC_NONE && type < R_SPARC_NUM - && reloc_map_table[type] != NULL) ? true : false; -} diff --git a/libebl/x86_64_destr.c b/libebl/x86_64_destr.c deleted file mode 100644 index 754ccc99..00000000 --- a/libebl/x86_64_destr.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Destructor for x86_64 specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_x86_64.h> - - -void -x86_64_destr (bh) - Ebl *bh; -{ - /* Nothing to do so far. */ -} diff --git a/libebl/x86_64_init.c b/libebl/x86_64_init.c deleted file mode 100644 index 5d922059..00000000 --- a/libebl/x86_64_init.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Initialization of x86-64 specific backend library. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libebl_x86_64.h> - - -int -x86_64_init (elf, machine, eh, ehlen) - Elf *elf; - GElf_Half machine; - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return 1; - - /* We handle it. */ - eh->name = "AMD x86-64"; - eh->reloc_type_name = x86_64_reloc_type_name; - eh->reloc_type_check = x86_64_reloc_type_check; - eh->reloc_valid_use = x86_64_reloc_valid_use; - //eh->core_note = i386_core_note; - eh->destr = x86_64_destr; - - return 0; -} diff --git a/libebl/x86_64_symbol.c b/libebl/x86_64_symbol.c deleted file mode 100644 index b0f53ea9..00000000 --- a/libebl/x86_64_symbol.c +++ /dev/null @@ -1,107 +0,0 @@ -/* x86_64 specific symbolic name handling. - Copyright (C) 2002 Red Hat, Inc. - Written by Ulrich Drepper <drepper@redhat.com>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> - -#include <libebl_x86_64.h> - - -/* Return of the backend. */ -const char * -x86_64_backend_name (void) -{ - return "x86-64"; -} - - -/* Relocation mapping table. */ -static struct -{ - const char *name; - enum { both = 0, rel = 1, exec = 2 } appear; -} reloc_map_table[] = - { - [R_X86_64_NONE] = { "R_X86_64_NONE", both }, - [R_X86_64_64] = { "R_X86_64_64", rel }, - [R_X86_64_PC32] = { "R_X86_64_PC32", rel }, - [R_X86_64_GOT32] = { "R_X86_64_GOT32", rel }, - [R_X86_64_PLT32] = { "R_X86_64_PLT32", rel }, - [R_X86_64_COPY] = { "R_X86_64_COPY", exec }, - [R_X86_64_GLOB_DAT] = { "R_X86_64_GLOB_DAT", exec }, - [R_X86_64_JUMP_SLOT] = { "R_X86_64_JUMP_SLOT", exec }, - [R_X86_64_RELATIVE] = { "R_X86_64_RELATIVE", exec }, - [R_X86_64_GOTPCREL] = { "R_X86_64_GOTPCREL", exec }, - [R_X86_64_32] = { "R_X86_64_32", rel }, - [R_X86_64_32S] = { "R_X86_64_32S", rel }, - [R_X86_64_16] = { "R_X86_64_16", rel }, - [R_X86_64_PC16] = { "R_X86_64_PC16", rel }, - [R_X86_64_8] = { "R_X86_64_8", rel }, - [R_X86_64_PC8] = { "R_X86_64_PC8", rel }, - [R_X86_64_DTPMOD64] = { "R_X86_64_DTPMOD64", rel }, - [R_X86_64_DTPOFF64] = { "R_X86_64_DTPOFF64", rel }, - [R_X86_64_TPOFF64] = { "R_X86_64_TPOFF64", rel }, - [R_X86_64_TLSGD] = { "R_X86_64_TLSGD", rel }, - [R_X86_64_TLSLD] = { "R_X86_64_TLSLD", rel }, - [R_X86_64_DTPOFF32] = { "R_X86_64_DTPOFF32", rel }, - [R_X86_64_GOTTPOFF] = { "R_X86_64_GOTTPOFF", rel }, - [R_X86_64_TPOFF32] = { "R_X86_64_TPOFF32", rel } - }; - - -/* Determine relocation type string for x86-64. */ -const char * -x86_64_reloc_type_name (int type, char *buf, size_t len) -{ - if (type < 0 || type >= R_X86_64_NUM) - return NULL; - - return reloc_map_table[type].name; -} - - -/* Check for correct relocation type. */ -bool -x86_64_reloc_type_check (int type) -{ - return (type >= R_X86_64_NONE && type < R_X86_64_NUM - && reloc_map_table[type].name != NULL) ? true : false; -} - - -/* Check for correct relocation type use. */ -bool -x86_64_reloc_valid_use (Elf *elf, int type) -{ - if (type < R_X86_64_NONE || type >= R_X86_64_NUM - || reloc_map_table[type].name == NULL) - return false; - - Elf64_Ehdr *ehdr = elf64_getehdr (elf); - assert (ehdr != NULL); - - if (reloc_map_table[type].appear == rel) - return ehdr->e_type == ET_REL; - - if (reloc_map_table[type].appear == exec) - return ehdr->e_type != ET_REL; - - assert (reloc_map_table[type].appear == both); - return true; -} diff --git a/libelf/ChangeLog b/libelf/ChangeLog index a92c1915..9578f8bd 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,541 @@ +2008-12-11 Roland McGrath <roland@redhat.com> + + * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Handle + placement offset going backwards, for out-of-order or overlapping + (bogus) sh_offset layouts. It's a dumb use, but should not crash. + (__elfw2(LIBELFBITS,updatefile)): Likewise. + Fixes RHBZ#476136. + + * libelf.h (Elf_Data): Whitespace fix. + +2008-12-10 Roland McGrath <roland@redhat.com> + + * elf_getarhdr.c (elf_getarhdr): Fix missing rename in last change. + +2008-10-22 Petr Machata <pmachata@redhat.com> + + * elf_rawfile.c (elf_rawfile): Lock around elf-> references. + +2008-10-21 Petr Machata <pmachata@redhat.com> + + * libelfP.h: Rename getehdr_rdlock to getehdr_wrlock. + * elf32_getehdr.c (getehdr_rdlock): Move the code to new function + getehdr_impl and make it a wrapper. Rename to getehdr_wrlock. + (getehdr_impl): Guard elf->class init with wrlock. + (getehdr): Also make it a wrapper of getehdr_impl. + * elf32_updatenull.c (updatenull_wrlock): Call getehdr_wrlock. + +2008-10-20 Petr Machata <pmachata@redhat.com> + + * elf_getdata_rawchunk.c (elf_getdata_rawchunk): Lock around the + code that reads mutable elf state. Relock to write lock to chain + the new chunk on the elf rawchunks list. + +2008-10-20 Petr Machata <pmachata@redhat.com> + + * elf32_checksum.c (checksum): Place a lock around the code that + processes data. Make it wrlock if the code needs to xlate the + data before processing. + +2008-10-16 Petr Machata <pmachata@redhat.com> + + * elf_begin.c + (__libelf_next_arhdr): Rename to __libelf_next_arhdr_wrlock. + (dup_elf): Adjust the call. + (elf_begin): New local function lock_dup_elf. Relocks the elf if + necessary before calling dup. Call this instead of dup_elf. + * elf_getarhdr.c + (elf_getarhdr): Lock before calling __libelf_next_arhdr_wrlock. + * elf_next.c (elf_next): Likewise. + * elf_rand.c (elf_rand): Likewise. + +2008-10-14 Petr Machata <pmachata@redhat.com> + + * elf_getdata.c (__elf_getdata_rdlock): Lock before converting. + +2008-11-26 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2008-10-06 Roland McGrath <roland@redhat.com> + + * elf_getarhdr.c (elf_getarhdr): Return NULL when passed NULL. + +2008-08-27 Roland McGrath <roland@redhat.com> + + * elf_begin.c (get_shnum): Avoid misaligned reads for matching endian. + + * libelfP.h [!ALLOW_UNALIGNED] (__libelf_type_align): Fix CLASS index. + +2008-08-25 Roland McGrath <roland@redhat.com> + + * Makefile.am (libelf_so_LDLIBS): New variable. + (libelf.so): Use it in the link. + +2008-08-21 Petr Machata <pmachata@redhat.com> + + * elf_getdata.c, libelfP.h + (__elf_getdata_internal): Rename to __elf_getdata_rdlock. + (__libelf_set_rawdata_wrlock): New function. + (__libelf_set_rawdata): Make it a wrapper that calls *_wrlock. + * elf32_updatenull.c, libelfP.h + (__elfNN_updatenull): Rename to __elfNN_updatenull_wrlock. + +2008-08-21 Petr Machata <pmachata@redhat.com> + + * elf32_getphdr.c, libelfP.h + (__elfNN_getphdr_internal): Drop. Move __elfNN_getphdr_internal + code to __elfNN_getphdr_wrlock. + (__elfNN_getphdr_rdlock, __elfNN_getphdr_wrlock): New functions. + (__elfNN_getphdr_rdlock, __elfNN_getphdr_wrlock): Make these + wrappers of getphdr_impl. + +2008-08-21 Petr Machata <pmachata@redhat.com> + + * elf32_getehdr.c, libelfP.h + (__elfNN_getehdr_internal): Rename to __elfNN_getehdr_rdlock. + * gelf_getehdr, libelfP.h: + (__gelf_getehdr_internal): Rename to __gelf_getehdr_rdlock. + +2008-08-21 Petr Machata <pmachata@redhat.com> + + * elf32_getshdr.c + (__elfNN_getshdr_internal): Drop. + (load_shdr_wrlock, scn_valid): New functions, contain bits of + behaviour from __elfNN_getshdr_internal. + (__elfNN_getshdr_rdlock, __elfNN_getshdr_wrlock): Replacements for + dropped _internal functions above. + * elf_getshnum.c + (__elf_getshnum_internal): Rename to __elf_getshnum_rdlock. + +2008-08-04 Petr Machata <pmachata@redhat.com> + + * libelfP.h (RWLOCK_RDLOCK, RWLOCK_WRLOCK, RWLOCK_UNLOCK): New macros. + +2008-07-28 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * elf32_offscn.c: Make sure shdrs have been read in. + +2008-02-19 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2008-02-08 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2008-01-31 Ulrich Drepper <drepper@redhat.com> + + * elf_strptr.c (elf_strptr): Don't fail if the ELF file is currently + under construction and no raw data can be read from disk. + +2008-01-30 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2008-01-26 Roland McGrath <roland@redhat.com> + + * elf_begin.c (__libelf_next_arhdr): Rewrite conversions using a macro. + Fixes various pastos in wrong type in sizeof, wrong string parsed. + +2008-01-20 Roland McGrath <roland@redhat.com> + + * elf_getaroff.c: Calculate from start_offset, instead of using + parent's state.ar.offset field. + +2008-01-08 Roland McGrath <roland@redhat.com> + + * Makefile.am (euinclude): Variable removed. + (pkginclude_HEADERS): Set this instead of euinclude_HEADERS. + +2008-01-03 Roland McGrath <roland@redhat.com> + + * common.h: Add __attribute__ ((unused)) to static functions. + +2007-12-20 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (libelf_a_SOURCES): Add elf_scnshndx. + * libelfP.h (struct Elf_Scn): Add shndx_index field. + Declare __elf_scnshndx_internal. + * elf32_getshdr.c: Record location of extended section header. + * elf_begin.c (file_read_elf): Likewise. + * elf_scnshndx.c: New file. + * libelf.h: Declare elf_scnshndx. + * libelf.map: Add elf_scnshndx to version ELFUTILS_1.4. + +2007-11-12 Roland McGrath <roland@redhat.com> + + * libelf.h: Replace off64_t with loff_t throughout. + Only that type name is unconditionally defined by <sys/types.h> + +2007-11-03 Roland McGrath <roland@redhat.com> + + * libelf.h (Elf_Data): Comment fix. + +2007-10-18 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2007-10-07 Roland McGrath <roland@redhat.com> + + * elf_begin.c (__libelf_next_arhdr): Fix fencepost error and wrong + member access in terminating name with no trailing /. Trim trailing + spaces when there is no /. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * elf_end.c (elf_end): Don't free ELF->state.ar.ar_sym when it's -1l. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * libelf.h (Elf_Data): Use off64_t for d_off. + (Elf_Arhdr): Use off64_t for ar_size. + (elf_update, elf_getbase, elf_getaroff): Return off64_t. + + * gelf_rawchunk.c: File removed. + * gelf_freechunk.c: File removed. + * Makefile.am (libelf_a_SOURCES): Remove them. + * libelf.map (ELFUTILS_1.0): Remove exports. + * gelf.h: Remove decls. + + * elf_getdata_rawchunk.c: New file. + * Makefile.am (libelf_a_SOURCES): Add it. + * libelf.map (ELFUTILS_1.3): Add elf_getdata_rawchunk. + * libelf.h: Declare it. + * libelfP.h (Elf_Data_Chunk): New type. + (struct Elf.elf): New member `rawchunks'. + * elf_end.c (elf_end): Free recorded rawchunk buffers. + +2007-08-24 Roland McGrath <roland@redhat.com> + + * gelf_getnote.c: New file. + * Makefile.am (libelf_a_SOURCES): Add it. + * gelf.h: Declare gelf_getnote. + * libelf.map (ELFUTILS_1.3): Add gelf_getnote. + + * libelfP.h (NOTE_ALIGN): New macro. + * note_xlate.h: New file. + * Makefile.am (noinst_HEADERS): Add it. + * gelf_xlate.c: Include it. + (__elf_xfctstom): Use elf_cvt_note. + * elf_getdata.c (shtype_map, __libelf_type_align): Handle SHT_NOTE. + (__libelf_set_rawdata): Likewise. + +2007-08-19 Roland McGrath <roland@redhat.com> + + * gelf_update_auxv.c: New file. + * gelf_getauxv.c: New file. + * Makefile.am (libelf_a_SOURCES): Add them. + * gelf.h: Declare gelf_getauxv, gelf_update_auxv. + * libelf.map (ELFUTILS_1.3): New set, inherits fom ELFUTILS_1.2. + Export gelf_getauxv, gelf_update_auxv. + + * libelf.h (Elf_Type): Add ELF_T_AUXV. + * abstract.h: Add auxv_t entries. + * exttypes.h: Likewise. + * gelf_xlate.h: Likewise. + * gelf_xlate.c (__elf_xfctstom): Add ELF_T_AUXV entries. + * gelf_fsize.c (__libelf_type_sizes): Likewise. + +2007-08-12 Roland McGrath <roland@redhat.com> + + * elf32_updatefile.c (compare_sections): Sort secondarily on sh_size, + and only tertiarily on index. + +2007-07-09 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2007-04-22 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2007-03-18 Roland McGrath <roland@redhat.com> + + * elf_begin.c (get_shnum): Fix test for e_shoff being out of bounds. + Return zero when the section headers do not fit within MAXSIZE. + +2007-03-09 Roland McGrath <roland@redhat.com> + + * libelfP.h (LIBELF_EV_IDX): New macro. + (__libelf_type_align): New macro. + [! ALLOW_UNALIGNED]: Declare __libc_type_aligns array. + * elf_getdata.c (shtype_map): Convert to just Elf_Type[][]. + (convert_data, __libelf_set_rawdata): Use that, __libelf_type_align, + and __libelf_type_sizes, in place of old table. + (__libc_type_aligns): New const variable. + +2007-02-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile (libelf.so): Build with -z relro. + + * elf_begin.c (read_file): When using ELF_C_READ_MMAP use MAP_PRIVATE. + +2007-01-30 Ulrich Drepper <drepper@redhat.com> + + * nlist.c: Close file descriptor before returning. + +2007-01-20 Roland McGrath <roland@redhat.com> + + * gnuhash_xlate.h (elf_cvt_gnuhash): Fix fence-post error so we + convert the final word. + + * elf32_getshdr.c: Don't byteswap shdr fields when EI_DATA matches + MY_ELFDATA on !ALLOW_UNALIGNED machines. + +2007-01-18 Roland McGrath <roland@redhat.com> + + * gelf_rawchunk.c (gelf_rawchunk): Clear RESULT pointer after freeing + it on read error. + +2006-10-13 Roland McGrath <roland@redhat.com> + + * elf32_updatenull.c: Look for and accept phdr also for ET_CORE. + * elf_error.c (msgstr): Change ELF_E_INVALID_PHDR string. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * elf32_getphdr.c: Don't byteswap phdr fields when EI_DATA matches + MY_ELFDATA on !ALLOW_UNALIGNED machines. + Reported by Christian Aichinger <Greek0@gmx.net>. + + * Makefile.am (CLEANFILES): Add libelf.so.$(VERSION). + +2006-08-08 Ulrich Drepper <drepper@redhat.com> + + * elf.h (DT_VALNUM): Update. + (DT_ADDRNUM): Likewise. + +2006-07-12 Ulrich Drepper <drepper@redhat.com> + + * elf32_updatefile.c: Adjust for internal_function_def removal. + * elf32_updatenull.c: Likewise. + * elf_begin.c: Likewise. + * elf_getdata.c: Likewise. + +2006-07-11 Ulrich Drepper <drepper@redhat.com> + + * libelf.h: Define ELF_T_GNUHASH. + * elf_getdata.c (TYPEIDX): Handle SHT_GNU_HASH. + (shtype_map): Add SHT_GNU_HASH entries. + * gelf_xlate.c (__elf_xfctstom): Add ELF_T_GNUHASH entries. + * gnuhash_xlate.h: New file. + * Makefile.am (noinst_HEADERS): Add gnuhash_xlate.h. + +2006-07-06 Ulrich Drepper <drepper@redhat.com> + + * elf_gnu_hash.c: New file. + * libelf.h: Declare elf_gnu_hash. + * Makefile.am (libelf_a_SOURCES): Add elf_gnu_hash. + * libelf.map: Add elf_gnu_map for version ELFUTILS_1.2. + +2006-06-15 Roland McGrath <roland@redhat.com> + + * libelf.h (elf_getarsym): Fix comment typo. + Rename second parameter to be more explanatory. + (elf_getident, elf_rawhide): Likewise. + +2006-05-28 Ulrich Drepper <drepper@redhat.com> + + * elf32_updatefile.c (updatemmap): Preserve section content if + copying would overwrite them. + Fix msync paramters. + +2006-04-04 Roland McGrath <roland@redhat.com> + + * elf32_updatefile.c (updatemmap): Handle other-endian case. + +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * elf32_updatefile.c (updatemmap): Cleanups. Remove shdr_dest + variable. Before writing sections, make a copy of the section + header data if necessary. Don't write section header while + writing the section constent, it might overwrite some sections. + Restore the pointer afterwards. + * elf32_updatenull.c (updatenull): If the offset of a section in a + file changed make sure we read the section so that it'll be written + out. + + * elf_update.c: Remove debug message. + +2005-12-07 Roland McGrath <roland@redhat.com> + + * gelf_xlate.c [! ALLOW_UNALIGNED] (union unaligned): New type. + (FETCH, STORE): New macros. + (INLINE3): Use those to do alignment-friendly conversion. + + * elf32_getshdr.c: Include map_address and start_offset in alignment + calculations. + * elf32_getphdr.c: Likewise. + +2005-11-19 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2005-11-17 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2005-11-10 Roland McGrath <roland@redhat.com> + + * elf.h: Update from glibc. + +2005-09-09 Roland McGrath <roland@redhat.com> + + * elf_update.c (write_file): Stat the file and fchmod it after update + if its mode had S_ISUID or S_ISGID bits set. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * elf32_getphdr.c: Include <system.h>. Use pread_retry instead of + pread. And branch prediction where useful. + * elf_begin.c: Likewise. + * elf_getdata.c: Likewise. + * elf_getshstrndx.c: Likewise. + * elf_readall.c: Likewise. + * gelf_rawchunk.c: Likewise. + * elf32_updatefile.c: Include <system.h>. Use pread_retry instead of + pread. And branch prediction where useful. + * elf_getarsym.c: Don't define pread_retry here. + + * Makefile.am: Use $(LINK) not $(CC) when creating DSO. + (%.os): Use COMPILE.os. + (COMPILE.os): Filter out gconv options. + +2005-08-27 Ulrich Drepper <drepper@redhat.com> + + * elf_begin.c (file_read_elf): Avoid reading ELF header from file + again. Instead accept additional parameter which points to it if we + don't use mmap. + (get_shnum): Use passed in e_ident value as source of ELF header. + +2005-08-15 Ulrich Drepper <drepper@redhat.com> + + * elf_begin.c (__libelf_next_arhdr): Use TEMP_FAILURE_RETRY. + + * Makefile (libelf_a_SOURCES): Add elf_getaroff.c. + * libelf.map: Export elf_getaroff. + * libelf.h: Declare elf_getaroff. + * elf_getaroff.c: New file. + +2005-08-13 Ulrich Drepper <drepper@redhat.com> + + * elf_begin.c (get_shnum): Optimize memory handling. Always read from + mapped file if available. Fix access to 64-bit sh_size. Recognize + overflow. + (file_read_elf): Likewise. + +2005-08-12 Roland McGrath <roland@redhat.com> + + * elf32_offscn.c: Do not match empty sections at OFFSET unless + there are no nonempty sections at that offset. + +2005-08-07 Ulrich Drepper <drepper@redhat.com> + + * elf.h: Update from glibc. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (AM_CFLAGS): Add -fpic when BUILD_STATIC. + +2005-08-03 Ulrich Drepper <drepper@redhat.com> + + * libelf.map: Move elf32_offscn, elf64_offscn, and gelf_offscn in + new version ELFUTILS_1.1.1. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * elf_error.c: Add handling of ELF_E_INVALID_OFFSET. + * elf32_offscn.c: New file. + * elf64_offscn.c: New file. + * gelf_offscn.c: New file. + * Makefile.am (libelf_a_SOURCES): Add elf32_offscn.c, elf64_offscn.c, + and gelf_offscn.c. + * libelf.sym: Export new symbols. + +2005-07-23 Ulrich Drepper <drepper@redhat.com> + + * elf-knowledge.h (SECTION_STRIP_P): Don't handle removal of debug + sections here anymore. + * elf32_checksum.c: Adjust for change in SECTION_STRIP_P interface. + + * elf_update.c (elf_update): Get write lock, not read lock. + + * elf32_updatenull.c (updatenull): Get section headers if necessary + and possible. + +2005-07-22 Ulrich Drepper <drepper@redhat.com> + + * elf32_updatenull.c (updatenull): If program header hasn't been loaded + yet, try to do it now. + Don't unnecessarily update overflow of section count in zeroth section + sh_size field. + If section content hasn't been read yet, do it before looking for the + block size. If no section data present, infer size of section header. + +2005-05-11 Ulrich Drepper <drepper@redhat.com> + + * elf.h: Update again. + +2005-05-09 Ulrich Drepper <drepper@redhat.com> + + * elf.h: Update from glibc. + +2005-05-08 Roland McGrath <roland@redhat.com> + + * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now. + * elf_update.c (write_file) [_MUDFLAP]: Likewise. + +2005-03-29 Ulrich Drepper <drepper@redhat.com> + + * elf32_checksum.c: Use INTUSE and INTDEF to avoid PLTs. + * elf_end.c: Likewise. + * elf_getdata.c: Likewise. + * gelf_getehdr.c: Likewise. + * nlist.c: Likewise. + * libelfP.h: Add declarations of internal functions. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * common.h (CONVERT): Make sure all values are unsigned. + (CONVERT_TO): Likewise. + + * Makefile.am (AM_CFLAGS): Add -Wformat=2. + Fix rule to build libelf.so. + +2005-02-06 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Cleanup AM_CFLAGS handling. Add -Wunused -Wextra. + Remove lint handling. + * elf32_getphdr.c: Minor cleanups. + * elf32_getshdr.c: Likewise. + * elf32_updatefile.c: Likewise. + * elf32_updatenull.c: Likewise. + * elf_begin.c: Likewise. + * elf_error.c: Likewise. + * elf_getarsym.c: Likewise. + * elf_getdata.c: Likewise. + * elf_update.c: Likewise. + * gelf_xlate.c: Likewise. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Check for text relocations in constructed DSO. + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -Werror -fpic -fmudflap. + +2005-02-04 Ulrich Drepper <drepper@redhat.com> + + * gelf_getehdr.c (gelf_getehdr): Slight optimization. + + * elf32_checksum.c (checksum): Do not look at NOBITS sections. + + * gelf.h: Add gelf_checksum prototype. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * elf32_checksum.c: Make compile with gcc 4.0. diff --git a/libelf/Makefile b/libelf/Makefile deleted file mode 100644 index 064e57bd..00000000 --- a/libelf/Makefile +++ /dev/null @@ -1,758 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# libelf/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - - -SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) $(libelf_so_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -noinst_PROGRAMS = $(am__EXEEXT_1) -#am_libelf_pic_a_OBJECTS = -subdir = libelf -DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) \ - $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" \ - "$(DESTDIR)$(includedir)" -libLIBRARIES_INSTALL = $(INSTALL_DATA) -LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libelf_a_AR = $(AR) $(ARFLAGS) -libelf_a_LIBADD = -am_libelf_a_OBJECTS = elf_version.$(OBJEXT) elf_hash.$(OBJEXT) \ - elf_error.$(OBJEXT) elf_fill.$(OBJEXT) elf_begin.$(OBJEXT) \ - elf_next.$(OBJEXT) elf_rand.$(OBJEXT) elf_end.$(OBJEXT) \ - elf_kind.$(OBJEXT) gelf_getclass.$(OBJEXT) \ - elf_getbase.$(OBJEXT) elf_getident.$(OBJEXT) \ - elf32_fsize.$(OBJEXT) elf64_fsize.$(OBJEXT) \ - gelf_fsize.$(OBJEXT) elf32_xlatetof.$(OBJEXT) \ - elf32_xlatetom.$(OBJEXT) elf64_xlatetof.$(OBJEXT) \ - elf64_xlatetom.$(OBJEXT) gelf_xlate.$(OBJEXT) \ - elf32_getehdr.$(OBJEXT) elf64_getehdr.$(OBJEXT) \ - gelf_getehdr.$(OBJEXT) elf32_newehdr.$(OBJEXT) \ - elf64_newehdr.$(OBJEXT) gelf_newehdr.$(OBJEXT) \ - gelf_update_ehdr.$(OBJEXT) elf32_getphdr.$(OBJEXT) \ - elf64_getphdr.$(OBJEXT) gelf_getphdr.$(OBJEXT) \ - elf32_newphdr.$(OBJEXT) elf64_newphdr.$(OBJEXT) \ - gelf_newphdr.$(OBJEXT) gelf_update_phdr.$(OBJEXT) \ - elf_getarhdr.$(OBJEXT) elf_getarsym.$(OBJEXT) \ - elf_rawfile.$(OBJEXT) elf_readall.$(OBJEXT) elf_cntl.$(OBJEXT) \ - elf_getscn.$(OBJEXT) elf_nextscn.$(OBJEXT) \ - elf_ndxscn.$(OBJEXT) elf_newscn.$(OBJEXT) \ - elf32_getshdr.$(OBJEXT) elf64_getshdr.$(OBJEXT) \ - gelf_getshdr.$(OBJEXT) gelf_update_shdr.$(OBJEXT) \ - elf_strptr.$(OBJEXT) elf_rawdata.$(OBJEXT) \ - elf_getdata.$(OBJEXT) elf_newdata.$(OBJEXT) \ - elf_flagelf.$(OBJEXT) elf_flagehdr.$(OBJEXT) \ - elf_flagphdr.$(OBJEXT) elf_flagscn.$(OBJEXT) \ - elf_flagshdr.$(OBJEXT) elf_flagdata.$(OBJEXT) \ - elf_memory.$(OBJEXT) elf_update.$(OBJEXT) \ - elf32_updatenull.$(OBJEXT) elf64_updatenull.$(OBJEXT) \ - elf32_updatefile.$(OBJEXT) elf64_updatefile.$(OBJEXT) \ - gelf_getsym.$(OBJEXT) gelf_update_sym.$(OBJEXT) \ - gelf_getversym.$(OBJEXT) gelf_getverneed.$(OBJEXT) \ - gelf_getvernaux.$(OBJEXT) gelf_getverdef.$(OBJEXT) \ - gelf_getverdaux.$(OBJEXT) gelf_getrel.$(OBJEXT) \ - gelf_getrela.$(OBJEXT) gelf_update_rel.$(OBJEXT) \ - gelf_update_rela.$(OBJEXT) gelf_getdyn.$(OBJEXT) \ - gelf_update_dyn.$(OBJEXT) gelf_getmove.$(OBJEXT) \ - gelf_update_move.$(OBJEXT) gelf_getsyminfo.$(OBJEXT) \ - gelf_update_syminfo.$(OBJEXT) gelf_xlatetof.$(OBJEXT) \ - gelf_xlatetom.$(OBJEXT) nlist.$(OBJEXT) \ - gelf_getsymshndx.$(OBJEXT) gelf_update_symshndx.$(OBJEXT) \ - gelf_update_versym.$(OBJEXT) gelf_update_verneed.$(OBJEXT) \ - gelf_update_vernaux.$(OBJEXT) gelf_update_verdef.$(OBJEXT) \ - gelf_update_verdaux.$(OBJEXT) elf_getshnum.$(OBJEXT) \ - elf_getshstrndx.$(OBJEXT) gelf_checksum.$(OBJEXT) \ - elf32_checksum.$(OBJEXT) elf64_checksum.$(OBJEXT) \ - gelf_rawchunk.$(OBJEXT) gelf_freechunk.$(OBJEXT) \ - libelf_crc32.$(OBJEXT) libelf_next_prime.$(OBJEXT) \ - elf_clone.$(OBJEXT) gelf_getlib.$(OBJEXT) \ - gelf_update_lib.$(OBJEXT) -libelf_a_OBJECTS = $(am_libelf_a_OBJECTS) -libelf_pic_a_AR = $(AR) $(ARFLAGS) -libelf_pic_a_LIBADD = -libelf_pic_a_OBJECTS = $(am_libelf_pic_a_OBJECTS) -am__EXEEXT_1 = libelf.so$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am_libelf_so_OBJECTS = -libelf_so_OBJECTS = $(am_libelf_so_OBJECTS) -libelf_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) \ - $(libelf_so_SOURCES) -DIST_SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) \ - $(libelf_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) -includeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 1 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Werror -Wshadow -# XXX gcc has a bug in that it generates warnings for internal symbols. -# XXX Remove the conditional when gcc is fxied. -#AM_CFLAGS = -Wall -Wshadow -INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. -GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) -LINT = splint -lib_LIBRARIES = libelf.a -noinst_LIBRARIES = libelf_pic.a -include_HEADERS = libelf.h gelf.h nlist.h -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = elf-knowledge.h -libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ - elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \ - gelf_getclass.c elf_getbase.c elf_getident.c \ - elf32_fsize.c elf64_fsize.c gelf_fsize.c \ - elf32_xlatetof.c elf32_xlatetom.c elf64_xlatetof.c \ - elf64_xlatetom.c gelf_xlate.c \ - elf32_getehdr.c elf64_getehdr.c gelf_getehdr.c \ - elf32_newehdr.c elf64_newehdr.c gelf_newehdr.c \ - gelf_update_ehdr.c \ - elf32_getphdr.c elf64_getphdr.c gelf_getphdr.c \ - elf32_newphdr.c elf64_newphdr.c gelf_newphdr.c \ - gelf_update_phdr.c \ - elf_getarhdr.c elf_getarsym.c \ - elf_rawfile.c elf_readall.c elf_cntl.c \ - elf_getscn.c elf_nextscn.c elf_ndxscn.c elf_newscn.c \ - elf32_getshdr.c elf64_getshdr.c gelf_getshdr.c \ - gelf_update_shdr.c \ - elf_strptr.c elf_rawdata.c elf_getdata.c elf_newdata.c \ - elf_flagelf.c elf_flagehdr.c elf_flagphdr.c elf_flagscn.c \ - elf_flagshdr.c elf_flagdata.c elf_memory.c \ - elf_update.c elf32_updatenull.c elf64_updatenull.c \ - elf32_updatefile.c elf64_updatefile.c \ - gelf_getsym.c gelf_update_sym.c \ - gelf_getversym.c gelf_getverneed.c gelf_getvernaux.c \ - gelf_getverdef.c gelf_getverdaux.c \ - gelf_getrel.c gelf_getrela.c \ - gelf_update_rel.c gelf_update_rela.c \ - gelf_getdyn.c gelf_update_dyn.c \ - gelf_getmove.c gelf_update_move.c \ - gelf_getsyminfo.c gelf_update_syminfo.c \ - gelf_xlatetof.c gelf_xlatetom.c \ - nlist.c \ - gelf_getsymshndx.c gelf_update_symshndx.c \ - gelf_update_versym.c gelf_update_verneed.c \ - gelf_update_vernaux.c gelf_update_verdef.c \ - gelf_update_verdaux.c \ - elf_getshnum.c elf_getshstrndx.c \ - gelf_checksum.c elf32_checksum.c elf64_checksum.c \ - gelf_rawchunk.c gelf_freechunk.c \ - libelf_crc32.c libelf_next_prime.c \ - elf_clone.c \ - gelf_getlib.c gelf_update_lib.c - -libelf_pic_a_SOURCES = -am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os) -libelf_so_SOURCES = -noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \ - version_xlate.h dl-hash.h - -EXTRA_DIST = libelf.map -CLEANFILES = $(am_libelf_pic_a_OBJECTS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libelf/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits libelf/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - p=$(am__strip_dir) \ - echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ - $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ - else :; fi; \ - done - -uninstall-libLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libelf.a: $(libelf_a_OBJECTS) $(libelf_a_DEPENDENCIES) - -rm -f libelf.a - $(libelf_a_AR) libelf.a $(libelf_a_OBJECTS) $(libelf_a_LIBADD) - $(RANLIB) libelf.a -libelf_pic.a: $(libelf_pic_a_OBJECTS) $(libelf_pic_a_DEPENDENCIES) - -rm -f libelf_pic.a - $(libelf_pic_a_AR) libelf_pic.a $(libelf_pic_a_OBJECTS) $(libelf_pic_a_LIBADD) - $(RANLIB) libelf_pic.a - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -#libelf.so$(EXEEXT): $(libelf_so_OBJECTS) $(libelf_so_DEPENDENCIES) -# @rm -f libelf.so$(EXEEXT) -# $(LINK) $(libelf_so_LDFLAGS) $(libelf_so_OBJECTS) $(libelf_so_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/elf32_checksum.Po -include ./$(DEPDIR)/elf32_fsize.Po -include ./$(DEPDIR)/elf32_getehdr.Po -include ./$(DEPDIR)/elf32_getphdr.Po -include ./$(DEPDIR)/elf32_getshdr.Po -include ./$(DEPDIR)/elf32_newehdr.Po -include ./$(DEPDIR)/elf32_newphdr.Po -include ./$(DEPDIR)/elf32_updatefile.Po -include ./$(DEPDIR)/elf32_updatenull.Po -include ./$(DEPDIR)/elf32_xlatetof.Po -include ./$(DEPDIR)/elf32_xlatetom.Po -include ./$(DEPDIR)/elf64_checksum.Po -include ./$(DEPDIR)/elf64_fsize.Po -include ./$(DEPDIR)/elf64_getehdr.Po -include ./$(DEPDIR)/elf64_getphdr.Po -include ./$(DEPDIR)/elf64_getshdr.Po -include ./$(DEPDIR)/elf64_newehdr.Po -include ./$(DEPDIR)/elf64_newphdr.Po -include ./$(DEPDIR)/elf64_updatefile.Po -include ./$(DEPDIR)/elf64_updatenull.Po -include ./$(DEPDIR)/elf64_xlatetof.Po -include ./$(DEPDIR)/elf64_xlatetom.Po -include ./$(DEPDIR)/elf_begin.Po -include ./$(DEPDIR)/elf_clone.Po -include ./$(DEPDIR)/elf_cntl.Po -include ./$(DEPDIR)/elf_end.Po -include ./$(DEPDIR)/elf_error.Po -include ./$(DEPDIR)/elf_fill.Po -include ./$(DEPDIR)/elf_flagdata.Po -include ./$(DEPDIR)/elf_flagehdr.Po -include ./$(DEPDIR)/elf_flagelf.Po -include ./$(DEPDIR)/elf_flagphdr.Po -include ./$(DEPDIR)/elf_flagscn.Po -include ./$(DEPDIR)/elf_flagshdr.Po -include ./$(DEPDIR)/elf_getarhdr.Po -include ./$(DEPDIR)/elf_getarsym.Po -include ./$(DEPDIR)/elf_getbase.Po -include ./$(DEPDIR)/elf_getdata.Po -include ./$(DEPDIR)/elf_getident.Po -include ./$(DEPDIR)/elf_getscn.Po -include ./$(DEPDIR)/elf_getshnum.Po -include ./$(DEPDIR)/elf_getshstrndx.Po -include ./$(DEPDIR)/elf_hash.Po -include ./$(DEPDIR)/elf_kind.Po -include ./$(DEPDIR)/elf_memory.Po -include ./$(DEPDIR)/elf_ndxscn.Po -include ./$(DEPDIR)/elf_newdata.Po -include ./$(DEPDIR)/elf_newscn.Po -include ./$(DEPDIR)/elf_next.Po -include ./$(DEPDIR)/elf_nextscn.Po -include ./$(DEPDIR)/elf_rand.Po -include ./$(DEPDIR)/elf_rawdata.Po -include ./$(DEPDIR)/elf_rawfile.Po -include ./$(DEPDIR)/elf_readall.Po -include ./$(DEPDIR)/elf_strptr.Po -include ./$(DEPDIR)/elf_update.Po -include ./$(DEPDIR)/elf_version.Po -include ./$(DEPDIR)/gelf_checksum.Po -include ./$(DEPDIR)/gelf_freechunk.Po -include ./$(DEPDIR)/gelf_fsize.Po -include ./$(DEPDIR)/gelf_getclass.Po -include ./$(DEPDIR)/gelf_getdyn.Po -include ./$(DEPDIR)/gelf_getehdr.Po -include ./$(DEPDIR)/gelf_getlib.Po -include ./$(DEPDIR)/gelf_getmove.Po -include ./$(DEPDIR)/gelf_getphdr.Po -include ./$(DEPDIR)/gelf_getrel.Po -include ./$(DEPDIR)/gelf_getrela.Po -include ./$(DEPDIR)/gelf_getshdr.Po -include ./$(DEPDIR)/gelf_getsym.Po -include ./$(DEPDIR)/gelf_getsyminfo.Po -include ./$(DEPDIR)/gelf_getsymshndx.Po -include ./$(DEPDIR)/gelf_getverdaux.Po -include ./$(DEPDIR)/gelf_getverdef.Po -include ./$(DEPDIR)/gelf_getvernaux.Po -include ./$(DEPDIR)/gelf_getverneed.Po -include ./$(DEPDIR)/gelf_getversym.Po -include ./$(DEPDIR)/gelf_newehdr.Po -include ./$(DEPDIR)/gelf_newphdr.Po -include ./$(DEPDIR)/gelf_rawchunk.Po -include ./$(DEPDIR)/gelf_update_dyn.Po -include ./$(DEPDIR)/gelf_update_ehdr.Po -include ./$(DEPDIR)/gelf_update_lib.Po -include ./$(DEPDIR)/gelf_update_move.Po -include ./$(DEPDIR)/gelf_update_phdr.Po -include ./$(DEPDIR)/gelf_update_rel.Po -include ./$(DEPDIR)/gelf_update_rela.Po -include ./$(DEPDIR)/gelf_update_shdr.Po -include ./$(DEPDIR)/gelf_update_sym.Po -include ./$(DEPDIR)/gelf_update_syminfo.Po -include ./$(DEPDIR)/gelf_update_symshndx.Po -include ./$(DEPDIR)/gelf_update_verdaux.Po -include ./$(DEPDIR)/gelf_update_verdef.Po -include ./$(DEPDIR)/gelf_update_vernaux.Po -include ./$(DEPDIR)/gelf_update_verneed.Po -include ./$(DEPDIR)/gelf_update_versym.Po -include ./$(DEPDIR)/gelf_xlate.Po -include ./$(DEPDIR)/gelf_xlatetof.Po -include ./$(DEPDIR)/gelf_xlatetom.Po -include ./$(DEPDIR)/libelf_crc32.Po -include ./$(DEPDIR)/libelf_next_prime.Po -include ./$(DEPDIR)/nlist.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ - $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(includedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -#install: install-am -install-exec: install-exec-am -install-data: install-data-am -#uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-euincludeHEADERS install-includeHEADERS - -install-exec-am: install-libLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ - ctags distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-includeHEADERS install-info install-info-am \ - install-libLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-euincludeHEADERS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES - -libelf.so: libelf_pic.a libelf.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION),-z-defs - ln -fs $@ $@.$(VERSION) - -%.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ - -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ - then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ - rm -f "$(DEPDIR)/$*.Tpo"; \ - else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ - fi - -install: install-am libelf.so - $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so - ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION) - ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so - -uninstall: uninstall-am - rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so - rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION) - rm -f $(DESTDIR)$(libdir)/libelf.so - -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_a_SOURCES)) -# 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/libelf/Makefile.am b/libelf/Makefile.am index 3481858e..2458ecbd 100644 --- a/libelf/Makefile.am +++ b/libelf/Makefile.am @@ -1,35 +1,47 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 1996-2001, 2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 1996-2006, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## 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, version 2. +## Red Hat elfutils 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; version 2 of the License. ## -## 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. +## Red Hat elfutils is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software Foundation, -## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -# XXX gcc has a bug in that it generates warnings for internal symbols. -# XXX Remove the conditional when gcc is fxied. if MUDFLAP -AM_CFLAGS = -Wall -Wshadow +AM_CFLAGS = -fmudflap else -AM_CFLAGS = -Wall -Werror -Wshadow +AM_CFLAGS = +endif +if BUILD_STATIC +AM_CFLAGS += -fpic endif +AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \ + $($(*F)_CFLAGS) INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) VERSION = 1 PACKAGE_VERSION = @PACKAGE_VERSION@ -LINT = splint +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) lib_LIBRARIES = libelf.a if !MUDFLAP @@ -38,8 +50,7 @@ noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) endif include_HEADERS = libelf.h gelf.h nlist.h -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = elf-knowledge.h +pkginclude_HEADERS = elf-knowledge.h libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \ @@ -59,6 +70,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ elf32_getshdr.c elf64_getshdr.c gelf_getshdr.c \ gelf_update_shdr.c \ elf_strptr.c elf_rawdata.c elf_getdata.c elf_newdata.c \ + elf_getdata_rawchunk.c \ elf_flagelf.c elf_flagehdr.c elf_flagphdr.c elf_flagscn.c \ elf_flagshdr.c elf_flagdata.c elf_memory.c \ elf_update.c elf32_updatenull.c elf64_updatenull.c \ @@ -71,6 +83,8 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_getdyn.c gelf_update_dyn.c \ gelf_getmove.c gelf_update_move.c \ gelf_getsyminfo.c gelf_update_syminfo.c \ + gelf_getauxv.c gelf_update_auxv.c \ + gelf_getnote.c \ gelf_xlatetof.c gelf_xlatetom.c \ nlist.c \ gelf_getsymshndx.c gelf_update_symshndx.c \ @@ -79,24 +93,33 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_update_verdaux.c \ elf_getshnum.c elf_getshstrndx.c \ gelf_checksum.c elf32_checksum.c elf64_checksum.c \ - gelf_rawchunk.c gelf_freechunk.c \ libelf_crc32.c libelf_next_prime.c \ elf_clone.c \ - gelf_getlib.c gelf_update_lib.c + gelf_getlib.c gelf_update_lib.c \ + elf32_offscn.c elf64_offscn.c gelf_offscn.c \ + elf_getaroff.c \ + elf_gnu_hash.c \ + elf_scnshndx.c if !MUDFLAP libelf_pic_a_SOURCES = am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os) +libelf_so_LDLIBS = +if USE_TLS +libelf_so_LDLIBS += -lpthread +endif + libelf_so_SOURCES = libelf.so: libelf_pic.a libelf.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION),-z-defs + $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ + -Wl,--soname,$@.$(VERSION),-z,-defs,-z,relro $(libelf_so_LDLIBS) + if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ln -fs $@ $@.$(VERSION) %.os: %.c %.o - if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ rm -f "$(DEPDIR)/$*.Tpo"; \ @@ -115,13 +138,8 @@ uninstall: uninstall-am rm -f $(DESTDIR)$(libdir)/libelf.so endif -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_a_SOURCES)) - noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \ - version_xlate.h dl-hash.h + version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h EXTRA_DIST = libelf.map -CLEANFILES = $(am_libelf_pic_a_OBJECTS) +CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda libelf.so.$(VERSION) diff --git a/libelf/Makefile.in b/libelf/Makefile.in index eb76e52d..73af7d2a 100644 --- a/libelf/Makefile.in +++ b/libelf/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -16,17 +16,11 @@ -SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) $(libelf_so_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -40,20 +34,20 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@BUILD_STATIC_TRUE@am__append_1 = -fpic @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) @MUDFLAP_TRUE@am_libelf_pic_a_OBJECTS = +@MUDFLAP_FALSE@@USE_TLS_TRUE@am__append_2 = -lpthread subdir = libelf -DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) \ - $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - ChangeLog +DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ + $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -62,8 +56,8 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" \ - "$(DESTDIR)$(includedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(pkgincludedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) AR = ar @@ -94,21 +88,23 @@ am_libelf_a_OBJECTS = elf_version.$(OBJEXT) elf_hash.$(OBJEXT) \ gelf_getshdr.$(OBJEXT) gelf_update_shdr.$(OBJEXT) \ elf_strptr.$(OBJEXT) elf_rawdata.$(OBJEXT) \ elf_getdata.$(OBJEXT) elf_newdata.$(OBJEXT) \ - elf_flagelf.$(OBJEXT) elf_flagehdr.$(OBJEXT) \ - elf_flagphdr.$(OBJEXT) elf_flagscn.$(OBJEXT) \ - elf_flagshdr.$(OBJEXT) elf_flagdata.$(OBJEXT) \ - elf_memory.$(OBJEXT) elf_update.$(OBJEXT) \ - elf32_updatenull.$(OBJEXT) elf64_updatenull.$(OBJEXT) \ - elf32_updatefile.$(OBJEXT) elf64_updatefile.$(OBJEXT) \ - gelf_getsym.$(OBJEXT) gelf_update_sym.$(OBJEXT) \ - gelf_getversym.$(OBJEXT) gelf_getverneed.$(OBJEXT) \ - gelf_getvernaux.$(OBJEXT) gelf_getverdef.$(OBJEXT) \ - gelf_getverdaux.$(OBJEXT) gelf_getrel.$(OBJEXT) \ - gelf_getrela.$(OBJEXT) gelf_update_rel.$(OBJEXT) \ - gelf_update_rela.$(OBJEXT) gelf_getdyn.$(OBJEXT) \ - gelf_update_dyn.$(OBJEXT) gelf_getmove.$(OBJEXT) \ - gelf_update_move.$(OBJEXT) gelf_getsyminfo.$(OBJEXT) \ - gelf_update_syminfo.$(OBJEXT) gelf_xlatetof.$(OBJEXT) \ + elf_getdata_rawchunk.$(OBJEXT) elf_flagelf.$(OBJEXT) \ + elf_flagehdr.$(OBJEXT) elf_flagphdr.$(OBJEXT) \ + elf_flagscn.$(OBJEXT) elf_flagshdr.$(OBJEXT) \ + elf_flagdata.$(OBJEXT) elf_memory.$(OBJEXT) \ + elf_update.$(OBJEXT) elf32_updatenull.$(OBJEXT) \ + elf64_updatenull.$(OBJEXT) elf32_updatefile.$(OBJEXT) \ + elf64_updatefile.$(OBJEXT) gelf_getsym.$(OBJEXT) \ + gelf_update_sym.$(OBJEXT) gelf_getversym.$(OBJEXT) \ + gelf_getverneed.$(OBJEXT) gelf_getvernaux.$(OBJEXT) \ + gelf_getverdef.$(OBJEXT) gelf_getverdaux.$(OBJEXT) \ + gelf_getrel.$(OBJEXT) gelf_getrela.$(OBJEXT) \ + gelf_update_rel.$(OBJEXT) gelf_update_rela.$(OBJEXT) \ + gelf_getdyn.$(OBJEXT) gelf_update_dyn.$(OBJEXT) \ + gelf_getmove.$(OBJEXT) gelf_update_move.$(OBJEXT) \ + gelf_getsyminfo.$(OBJEXT) gelf_update_syminfo.$(OBJEXT) \ + gelf_getauxv.$(OBJEXT) gelf_update_auxv.$(OBJEXT) \ + gelf_getnote.$(OBJEXT) gelf_xlatetof.$(OBJEXT) \ gelf_xlatetom.$(OBJEXT) nlist.$(OBJEXT) \ gelf_getsymshndx.$(OBJEXT) gelf_update_symshndx.$(OBJEXT) \ gelf_update_versym.$(OBJEXT) gelf_update_verneed.$(OBJEXT) \ @@ -116,10 +112,12 @@ am_libelf_a_OBJECTS = elf_version.$(OBJEXT) elf_hash.$(OBJEXT) \ gelf_update_verdaux.$(OBJEXT) elf_getshnum.$(OBJEXT) \ elf_getshstrndx.$(OBJEXT) gelf_checksum.$(OBJEXT) \ elf32_checksum.$(OBJEXT) elf64_checksum.$(OBJEXT) \ - gelf_rawchunk.$(OBJEXT) gelf_freechunk.$(OBJEXT) \ libelf_crc32.$(OBJEXT) libelf_next_prime.$(OBJEXT) \ elf_clone.$(OBJEXT) gelf_getlib.$(OBJEXT) \ - gelf_update_lib.$(OBJEXT) + gelf_update_lib.$(OBJEXT) elf32_offscn.$(OBJEXT) \ + elf64_offscn.$(OBJEXT) gelf_offscn.$(OBJEXT) \ + elf_getaroff.$(OBJEXT) elf_gnu_hash.$(OBJEXT) \ + elf_scnshndx.$(OBJEXT) libelf_a_OBJECTS = $(am_libelf_a_OBJECTS) libelf_pic_a_AR = $(AR) $(ARFLAGS) libelf_pic_a_LIBADD = @@ -129,7 +127,7 @@ PROGRAMS = $(noinst_PROGRAMS) am_libelf_so_OBJECTS = libelf_so_OBJECTS = $(am_libelf_so_OBJECTS) libelf_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -140,15 +138,13 @@ SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) \ $(libelf_so_SOURCES) DIST_SOURCES = $(libelf_a_SOURCES) $(libelf_pic_a_SOURCES) \ $(libelf_so_SOURCES) -euincludeHEADERS_INSTALL = $(INSTALL_HEADER) includeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(euinclude_HEADERS) $(include_HEADERS) $(noinst_HEADERS) +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -157,43 +153,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -202,7 +194,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -210,12 +201,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -228,40 +221,56 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -# XXX gcc has a bug in that it generates warnings for internal symbols. -# XXX Remove the conditional when gcc is fxied. -@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Wshadow +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Wshadow -Werror \ +@MUDFLAP_FALSE@ -Wunused -Wextra -Wformat=2 -std=gnu99 \ +@MUDFLAP_FALSE@ $($(*F)_CFLAGS) +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Wshadow \ +@MUDFLAP_TRUE@ -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \ +@MUDFLAP_TRUE@ $($(*F)_CFLAGS) INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) -LINT = splint +COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) + lib_LIBRARIES = libelf.a @MUDFLAP_FALSE@noinst_LIBRARIES = libelf_pic.a include_HEADERS = libelf.h gelf.h nlist.h -euincludedir = $(includedir)/elfutils -euinclude_HEADERS = elf-knowledge.h +pkginclude_HEADERS = elf-knowledge.h libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \ gelf_getclass.c elf_getbase.c elf_getident.c \ @@ -280,6 +289,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ elf32_getshdr.c elf64_getshdr.c gelf_getshdr.c \ gelf_update_shdr.c \ elf_strptr.c elf_rawdata.c elf_getdata.c elf_newdata.c \ + elf_getdata_rawchunk.c \ elf_flagelf.c elf_flagehdr.c elf_flagphdr.c elf_flagscn.c \ elf_flagshdr.c elf_flagdata.c elf_memory.c \ elf_update.c elf32_updatenull.c elf64_updatenull.c \ @@ -292,6 +302,8 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_getdyn.c gelf_update_dyn.c \ gelf_getmove.c gelf_update_move.c \ gelf_getsyminfo.c gelf_update_syminfo.c \ + gelf_getauxv.c gelf_update_auxv.c \ + gelf_getnote.c \ gelf_xlatetof.c gelf_xlatetom.c \ nlist.c \ gelf_getsymshndx.c gelf_update_symshndx.c \ @@ -300,24 +312,28 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_update_verdaux.c \ elf_getshnum.c elf_getshstrndx.c \ gelf_checksum.c elf32_checksum.c elf64_checksum.c \ - gelf_rawchunk.c gelf_freechunk.c \ libelf_crc32.c libelf_next_prime.c \ elf_clone.c \ - gelf_getlib.c gelf_update_lib.c + gelf_getlib.c gelf_update_lib.c \ + elf32_offscn.c elf64_offscn.c gelf_offscn.c \ + elf_getaroff.c \ + elf_gnu_hash.c \ + elf_scnshndx.c @MUDFLAP_FALSE@libelf_pic_a_SOURCES = @MUDFLAP_FALSE@am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os) +@MUDFLAP_FALSE@libelf_so_LDLIBS = $(am__append_2) @MUDFLAP_FALSE@libelf_so_SOURCES = noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \ - version_xlate.h dl-hash.h + version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h EXTRA_DIST = libelf.map -CLEANFILES = $(am_libelf_pic_a_OBJECTS) +CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda libelf.so.$(VERSION) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -342,13 +358,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -391,7 +407,7 @@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) @MUDFLAP_TRUE@libelf.so$(EXEEXT): $(libelf_so_OBJECTS) $(libelf_so_DEPENDENCIES) @MUDFLAP_TRUE@ @rm -f libelf.so$(EXEEXT) -@MUDFLAP_TRUE@ $(LINK) $(libelf_so_LDFLAGS) $(libelf_so_OBJECTS) $(libelf_so_LDADD) $(LIBS) +@MUDFLAP_TRUE@ $(LINK) $(libelf_so_OBJECTS) $(libelf_so_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -406,6 +422,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_getshdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_newehdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_newphdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_offscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_updatefile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_updatenull.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32_xlatetof.Po@am__quote@ @@ -417,6 +434,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_getshdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_newehdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_newphdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_offscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_updatefile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_updatenull.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64_xlatetof.Po@am__quote@ @@ -434,13 +452,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_flagscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_flagshdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getarhdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getaroff.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getarsym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getbase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getdata.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getdata_rawchunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getident.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshnum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshstrndx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_gnu_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_kind.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_memory.Po@am__quote@ @@ -453,17 +474,19 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_rawdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_rawfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_readall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_scnshndx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_strptr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_update.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_checksum.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_freechunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_fsize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getauxv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getclass.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getdyn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getehdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getmove.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getnote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getphdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getrel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getrela.Po@am__quote@ @@ -478,7 +501,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_getversym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_newehdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_newphdr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_rawchunk.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_offscn.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_update_auxv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_update_dyn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_update_ehdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gelf_update_lib.Po@am__quote@ @@ -503,39 +527,21 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlist.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: -install-euincludeHEADERS: $(euinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(euincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(euincludedir)/$$f'"; \ - $(euincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(euincludedir)/$$f"; \ - done - -uninstall-euincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(euinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(euincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(euincludedir)/$$f"; \ - done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ @@ -550,14 +556,31 @@ uninstall-includeHEADERS: echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -569,8 +592,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -580,13 +603,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -600,22 +622,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -630,8 +651,8 @@ check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done @MUDFLAP_TRUE@install: install-am install-exec: install-exec-am @@ -679,14 +700,22 @@ info: info-am info-am: -install-data-am: install-euincludeHEADERS install-includeHEADERS +install-data-am: install-includeHEADERS install-pkgincludeHEADERS + +install-dvi: install-dvi-am install-exec-am: install-libLIBRARIES +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -706,32 +735,35 @@ ps: ps-am ps-am: -uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES +uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \ + uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ ctags distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ - install-includeHEADERS install-info install-info-am \ - install-libLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-euincludeHEADERS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgincludeHEADERS install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLIBRARIES uninstall-pkgincludeHEADERS @MUDFLAP_FALSE@libelf.so: libelf_pic.a libelf.map -@MUDFLAP_FALSE@ $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ -@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ -@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z-defs +@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ +@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ +@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z,-defs,-z,relro $(libelf_so_LDLIBS) +@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi @MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION) @MUDFLAP_FALSE@%.os: %.c %.o -@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ +@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ @MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ @MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \ @@ -748,11 +780,6 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ @MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so @MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION) @MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libelf.so - -.PSEUDO: lint -lint: - $(LINT) $(DEFS) $(INCLUDES) $(GCC_INCLUDE) -f $(top_srcdir)/splint.rc \ - $(addprefix $(srcdir)/,$(libelf_a_SOURCES)) # 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/libelf/abstract.h b/libelf/abstract.h index d14034eb..e359f96b 100644 --- a/libelf/abstract.h +++ b/libelf/abstract.h @@ -1,19 +1,52 @@ /* Abstract description of component ELF types. - Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ /* ELF header. */ #define Ehdr(Bits, Ext) \ @@ -281,3 +314,20 @@ END (Bits, Ext##Lib) Lib (32, Ext) #define Lib64(Ext) \ Lib (64, Ext) + +#define auxv_t32(Ext) \ +START (32, auxv_t, Ext##auxv_t) \ + TYPE_NAME (ElfW2(32, Ext##Word), a_type) \ + TYPE_EXTRA (union {) \ + TYPE_EXTRA (ElfW2(32, Ext##Word) a_val;) \ + TYPE_XLATE (Elf32_cvt_Addr1 (&tdest->a_un.a_val, &tsrc->a_un.a_val);) \ + TYPE_EXTRA (} a_un;) \ +END (32, Ext##auxv_t) +#define auxv_t64(Ext) \ +START (64, auxv_t, Ext##auxv_t) \ + TYPE_NAME (ElfW2(64, Ext##Xword), a_type) \ + TYPE_EXTRA (union {) \ + TYPE_EXTRA (ElfW2(64, Ext##Xword) a_val;) \ + TYPE_XLATE (Elf64_cvt_Addr1 (&tdest->a_un.a_val, &tsrc->a_un.a_val);) \ + TYPE_EXTRA (} a_un;) \ +END (64, Ext##auxv_t) diff --git a/libelf/common.h b/libelf/common.h index ad41bb98..8eef2a7a 100644 --- a/libelf/common.h +++ b/libelf/common.h @@ -1,31 +1,66 @@ /* Common definitions for handling files in memory or only on disk. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _COMMON_H #define _COMMON_H 1 #include <ar.h> -//#include <byteswap.h> -//#include <endian.h> +#include <byteswap.h> +#include <endian.h> #include <stdlib.h> #include <string.h> +#include "libelfP.h" static inline Elf_Kind +__attribute__ ((unused)) determine_kind (void *buf, size_t len) { /* First test for an archive. */ @@ -53,6 +88,7 @@ determine_kind (void *buf, size_t len) /* Allocate an Elf descriptor and fill in the generic information. */ static inline Elf * +__attribute__ ((unused)) allocate_elf (int fildes, void *map_address, off_t offset, size_t maxsize, Elf_Cmd cmd, Elf *parent, Elf_Kind kind, size_t extra) { @@ -79,6 +115,7 @@ allocate_elf (int fildes, void *map_address, off_t offset, size_t maxsize, /* Acquire lock for the descriptor and all children. */ static void +__attribute__ ((unused)) libelf_acquire_all (Elf *elf) { rwlock_wrlock (elf->lock); @@ -98,6 +135,7 @@ libelf_acquire_all (Elf *elf) /* Release own lock and those of the children. */ static void +__attribute__ ((unused)) libelf_release_all (Elf *elf) { if (elf->kind == ELF_K_AR) @@ -120,7 +158,7 @@ libelf_release_all (Elf *elf) has to use itself. */ #define CONVERT(Var) \ (Var) = (sizeof (Var) == 1 \ - ? (Var) \ + ? (unsigned char) (Var) \ : (sizeof (Var) == 2 \ ? bswap_16 (Var) \ : (sizeof (Var) == 4 \ @@ -129,7 +167,7 @@ libelf_release_all (Elf *elf) #define CONVERT_TO(Dst, Var) \ (Dst) = (sizeof (Var) == 1 \ - ? (Var) \ + ? (unsigned char) (Var) \ : (sizeof (Var) == 2 \ ? bswap_16 (Var) \ : (sizeof (Var) == 4 \ diff --git a/libelf/dl-hash.h b/libelf/dl-hash.h index c8e89626..fd593949 100644 --- a/libelf/dl-hash.h +++ b/libelf/dl-hash.h @@ -1,19 +1,51 @@ /* Compute hash value for given string according to ELF standard. - Copyright (C) 1995-1998, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1995. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under an Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) and to distribute linked + combinations including the two. Non-GPL Code permitted under this + exception must only link to the code of Red Hat elfutils through those + well defined interfaces identified in the file named EXCEPTION found in + the source code files (the "Approved Interfaces"). The files of Non-GPL + Code may instantiate templates or use macros or inline functions from + the Approved Interfaces without causing the resulting work to be covered + by the GNU General Public License. Only Red Hat, Inc. may make changes + or additions to the list of Approved Interfaces. Red Hat's grant of + this exception is conditioned upon your not adding any new exceptions. + If you wish to add a new Approved Interface or exception, please contact + Red Hat. You must obey the GNU General Public License in all respects + for all of the Red Hat elfutils code and other code used in conjunction + with Red Hat elfutils except the Non-GPL Code covered by this exception. + If you modify this file, you may extend this exception to your version + of the file, but you are not obligated to do so. If you do not wish to + provide this exception without modification, you must delete this + exception statement from your version and license this file solely under + the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _DL_HASH_H #define _DL_HASH_H 1 diff --git a/libelf/elf-knowledge.h b/libelf/elf-knowledge.h index c44e37f7..8b4c0d7b 100644 --- a/libelf/elf-knowledge.h +++ b/libelf/elf-knowledge.h @@ -1,49 +1,71 @@ /* Accumulation of various pieces of knowledge about ELF. - Copyright (C) 2000, 2001, 2002, 2003 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _ELF_KNOWLEDGE_H #define _ELF_KNOWLEDGE_H 1 +#include <stdbool.h> + /* Test whether a section can be stripped or not. */ -#define SECTION_STRIP_P(ebl, elf, ehdr, shdr, name, remove_comment, remove_debug) \ - (/* Sections which are allocated are not removed. */ \ - ((shdr)->sh_flags & SHF_ALLOC) == 0 \ +#define SECTION_STRIP_P(shdr, name, remove_comment) \ + /* Sections which are allocated are not removed. */ \ + (((shdr)->sh_flags & SHF_ALLOC) == 0 \ /* We never remove .note sections. */ \ && (shdr)->sh_type != SHT_NOTE \ - /* If only debug information should be removed check the name. There \ - is unfortunately no way. */ \ - && (!remove_debug \ - || ebl_debugscn_p (ebl, name) \ - || (((shdr)->sh_type == SHT_RELA || (shdr)->sh_type == SHT_REL) \ - && ({ Elf_Scn *scn_l = elf_getscn (elf, (shdr)->sh_info); \ - GElf_Shdr shdr_mem_l; \ - GElf_Shdr *shdr_l = gelf_getshdr (scn_l, &shdr_mem_l); \ - const char *s_l; \ - shdr_l != NULL \ - && (s_l = elf_strptr (elf, \ - ((GElf_Ehdr *) (ehdr))->e_shstrndx, \ - shdr_l->sh_name)) != NULL \ - && ebl_debugscn_p (ebl, s_l); }))) \ - && ((shdr)->sh_type != SHT_PROGBITS \ - /* Never remove .gnu.warning.* sections. */ \ + && (((shdr)->sh_type) != SHT_PROGBITS \ + /* Never remove .gnu.warning.* sections. */ \ || (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) != 0 \ - /* We remove .comment sections only if explicitly told to do so. */ \ - && ((remove_comment) || strcmp (name, ".comment") != 0))) \ + /* We remove .comment sections only if explicitly told to do so. */\ + && (remove_comment \ + || strcmp (name, ".comment") != 0))) \ /* So far we do not remove any of the non-standard sections. \ XXX Maybe in future. */ \ && (shdr)->sh_type < SHT_NUM) diff --git a/libelf/elf.h b/libelf/elf.h index f963eac5..f18288ca 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -1,5 +1,6 @@ /* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2003,2004,2005,2006,2007,2008 + 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 @@ -20,7 +21,17 @@ #ifndef _ELF_H #define _ELF_H 1 -//#include <features.h> +/* ANDROID_CHANGE_BEGIN */ +/* + * elf.h may be directly included from a different project, and features.h does + * not exist on host Mac OS. + */ +#ifndef __APPLE__ +#include <features.h> +#endif +/* ANDROID_CHANGE_END */ + +__BEGIN_DECLS /* Standard ELF types. */ @@ -327,7 +338,9 @@ typedef struct #define SHT_GROUP 17 /* Section group */ #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_LOOS 0x60000000 /* Start OS-specific. */ +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ +#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ @@ -599,7 +612,13 @@ typedef struct #define NT_UTSNAME 15 /* Contains copy of utsname struct */ #define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ #define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/ +#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ +#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ +#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ +#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ /* Legal values for the note segment descriptor types for object files. */ @@ -697,6 +716,9 @@ typedef struct If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ +#define DT_TLSDESC_PLT 0x6ffffef6 +#define DT_TLSDESC_GOT 0x6ffffef7 #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ #define DT_CONFIG 0x6ffffefa /* Configuration information. */ @@ -707,7 +729,7 @@ typedef struct #define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ #define DT_ADDRRNGHI 0x6ffffeff #define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -#define DT_ADDRNUM 10 +#define DT_ADDRNUM 11 /* The versioning entry types. The next are defined as part of the GNU extension. */ @@ -897,23 +919,25 @@ typedef struct typedef struct { - int a_type; /* Entry type */ + uint32_t a_type; /* Entry type */ union { - long int a_val; /* Integer value */ - void *a_ptr; /* Pointer value */ - void (*a_fcn) (void); /* Function pointer value */ + uint32_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ } a_un; } Elf32_auxv_t; typedef struct { - long int a_type; /* Entry type */ + uint64_t a_type; /* Entry type */ union { - long int a_val; /* Integer value */ - void *a_ptr; /* Pointer value */ - void (*a_fcn) (void); /* Function pointer value */ + uint64_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ } a_un; } Elf64_auxv_t; @@ -956,11 +980,19 @@ typedef struct #define AT_SECURE 23 /* Boolean, was exec setuid-like? */ +#define AT_EXECFN 31 /* Filename of executable. */ + /* Pointer to the global system page used for system calls and other nice things. */ #define AT_SYSINFO 32 #define AT_SYSINFO_EHDR 33 +/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains + log2 of line size; mask those to get cache size. */ +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 /* Note section contents. Each entry in the note section begins with a header of a fixed form. */ @@ -1002,15 +1034,28 @@ typedef struct word 2: minor version of the ABI word 3: subminor version of the ABI */ -#define ELF_NOTE_ABI 1 +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI - note section entry. */ +/* Known OSes. These values can appear in word 0 of an + NT_GNU_ABI_TAG note section entry. */ #define ELF_NOTE_OS_LINUX 0 #define ELF_NOTE_OS_GNU 1 #define ELF_NOTE_OS_SOLARIS2 2 #define ELF_NOTE_OS_FREEBSD 3 +/* Synthetic hwcap information. The descriptor begins with two words: + word 0: number of entries + word 1: bitmask of enabled entries + Then follow variable-length entries, one byte followed by a + '\0'-terminated hwcap name string. The byte gives the bit + number to test if enabled, (1U << bit) & bitmask. */ +#define NT_GNU_HWCAP 2 + +/* Build ID bits as generated by ld --build-id. + The descriptor consists of any nonzero number of bytes. */ +#define NT_GNU_BUILD_ID 3 + /* Move records. */ typedef struct @@ -1126,8 +1171,17 @@ typedef struct #define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ #define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ #define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ +/* 38? */ +#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ +#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS + descriptor for + relaxation. */ +#define R_386_TLS_DESC 41 /* TLS descriptor containing + pointer to code and to + argument, returning the TLS + offset for the symbol. */ /* Keep this the last entry. */ -#define R_386_NUM 38 +#define R_386_NUM 42 /* SUN SPARC specific definitions. */ @@ -1240,14 +1294,16 @@ typedef struct #define DT_SPARC_REGISTER 0x70000001 #define DT_SPARC_NUM 2 -/* Bits present in AT_HWCAP, primarily for Sparc32. */ +/* Bits present in AT_HWCAP on SPARC. */ -#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */ +#define HWCAP_SPARC_FLUSH 1 /* The CPU supports flush insn. */ #define HWCAP_SPARC_STBAR 2 #define HWCAP_SPARC_SWAP 4 #define HWCAP_SPARC_MULDIV 8 -#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */ +#define HWCAP_SPARC_V9 16 /* The CPU is v9, so v8plus is ok. */ #define HWCAP_SPARC_ULTRA3 32 +#define HWCAP_SPARC_BLKINIT 64 /* Sun4v with block-init/load-twin. */ +#define HWCAP_SPARC_N2 128 /* MIPS R3000 specific definitions. */ @@ -1351,6 +1407,7 @@ typedef struct #define STO_MIPS_INTERNAL 0x1 #define STO_MIPS_HIDDEN 0x2 #define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 #define STO_MIPS_SC_ALIGN_UNUSED 0xff /* MIPS specific values for `st_info'. */ @@ -1483,8 +1540,24 @@ typedef struct #define R_MIPS_PJUMP 35 #define R_MIPS_RELGOT 36 #define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ +#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ +#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ +#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ +#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ +#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ +#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ +#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ +#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ +#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ +#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ +#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ +#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 /* Keep this the last entry. */ -#define R_MIPS_NUM 38 +#define R_MIPS_NUM 128 /* Legal values for p_type field of Elf32_Phdr. */ @@ -1550,7 +1623,13 @@ typedef struct #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -#define DT_MIPS_NUM 0x32 +/* The address of .got.plt in an executable using the new non-PIC ABI. */ +#define DT_MIPS_PLTGOT 0x70000032 +/* The base of the PLT in an executable using the new non-PIC ABI if that + PLT is writable. For a non-writable PLT, this is omitted or has a zero + value. */ +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_NUM 0x35 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ @@ -1680,6 +1759,8 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ #define R_PARISC_FPTR64 64 /* 64 bits function address. */ #define R_PARISC_PLABEL32 65 /* 32 bits function address. */ +#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ +#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ @@ -1740,6 +1821,26 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_GNU_VTENTRY 232 +#define R_PARISC_GNU_VTINHERIT 233 +#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ +#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ +#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ +#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ +#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ +#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ +#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ +#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ +#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ +#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ +#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ +#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 #define R_PARISC_HIRESERVE 255 /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ @@ -1843,6 +1944,9 @@ typedef Elf32_Addr Elf32_Conflict; #define LITUSE_ALPHA_TLS_GD 4 #define LITUSE_ALPHA_TLS_LDM 5 +/* Legal values for d_tag of Elf64_Dyn. */ +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 /* PowerPC specific declarations */ @@ -1953,10 +2057,19 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ #define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ +/* GNU relocs used in PIC code sequences. */ +#define R_PPC_REL16 249 /* word32 (sym-.) */ +#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */ +#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */ +#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */ + /* This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files. */ #define R_PPC_TOC16 255 +/* PowerPC specific values for the Dyn d_tag field. */ +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_NUM 1 /* PowerPC64 relocations defined by the ABIs */ #define R_PPC64_NONE R_PPC_NONE @@ -2117,7 +2230,11 @@ typedef Elf32_Addr Elf32_Conflict; #define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base */ +/* Processor specific values for the Phdr p_type field. */ +#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */ + /* ARM relocs. */ + #define R_ARM_NONE 0 /* No reloc */ #define R_ARM_PC24 1 /* PC relative 26 bit branch */ #define R_ARM_ABS32 2 /* Direct 32 bit */ @@ -2135,6 +2252,9 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_THM_SWI8 14 #define R_ARM_XPC25 15 #define R_ARM_THM_XPC22 16 +#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ +#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ +#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ #define R_ARM_COPY 20 /* Copy symbol at runtime */ #define R_ARM_GLOB_DAT 21 /* Create GOT entry */ #define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ @@ -2153,6 +2273,16 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_GNU_VTINHERIT 101 #define R_ARM_THM_PC11 102 /* thumb unconditional branch */ #define R_ARM_THM_PC9 103 /* thumb conditional branch */ +#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic + thread local data */ +#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic + thread local data */ +#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS + block */ +#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of + static TLS block offset */ +#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static + TLS block */ #define R_ARM_RXPC25 249 #define R_ARM_RSBREL32 250 #define R_ARM_THM_RPC22 251 @@ -2394,9 +2524,14 @@ typedef Elf32_Addr Elf32_Conflict; #define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ #define R_390_TLS_TPOFF 56 /* Negated offset in static TLS block. */ - +#define R_390_20 57 /* Direct 20 bit. */ +#define R_390_GOT20 58 /* 20 bit GOT offset. */ +#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ +#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS + block offset. */ /* Keep this the last entry. */ -#define R_390_NUM 57 +#define R_390_NUM 61 + /* CRIS relocations. */ #define R_CRIS_NONE 0 @@ -2422,6 +2557,7 @@ typedef Elf32_Addr Elf32_Conflict; #define R_CRIS_NUM 20 + /* AMD x86-64 relocations. */ #define R_X86_64_NONE 0 /* No reloc */ #define R_X86_64_64 1 /* Direct 64 bit */ @@ -2451,7 +2587,104 @@ typedef Elf32_Addr Elf32_Conflict; #define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset to GOT entry for IE symbol */ #define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ - -#define R_X86_64_NUM 24 +#define R_X86_64_PC64 24 /* PC relative 64 bit */ +#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ +#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative + offset to GOT */ +/* 27 .. 33 */ +#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ +#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS + descriptor. */ +#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ + +#define R_X86_64_NUM 37 + + +/* AM33 relocations. */ +#define R_MN10300_NONE 0 /* No reloc. */ +#define R_MN10300_32 1 /* Direct 32 bit. */ +#define R_MN10300_16 2 /* Direct 16 bit. */ +#define R_MN10300_8 3 /* Direct 8 bit. */ +#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ +#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ +#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ +#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ +#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ +#define R_MN10300_24 9 /* Direct 24 bit. */ +#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ +#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ +#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ +#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ +#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ +#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ +#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ +#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ +#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ +#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ +#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ +#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ +#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ +#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ + +#define R_MN10300_NUM 24 + + +/* M32R relocs. */ +#define R_M32R_NONE 0 /* No reloc. */ +#define R_M32R_16 1 /* Direct 16 bit. */ +#define R_M32R_32 2 /* Direct 32 bit. */ +#define R_M32R_24 3 /* Direct 24 bit. */ +#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ +#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ +#define R_M32R_LO16 9 /* Low 16 bit. */ +#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 +/* M32R relocs use SHT_RELA. */ +#define R_M32R_16_RELA 33 /* Direct 16 bit. */ +#define R_M32R_32_RELA 34 /* Direct 32 bit. */ +#define R_M32R_24_RELA 35 /* Direct 24 bit. */ +#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ +#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ +#define R_M32R_LO16_RELA 41 /* Low 16 bit */ +#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 +#define R_M32R_REL32 45 /* PC relative 32 bit. */ + +#define R_M32R_GOT24 48 /* 24 bit GOT entry */ +#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ +#define R_M32R_COPY 50 /* Copy symbol at runtime */ +#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ +#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ +#define R_M32R_RELATIVE 53 /* Adjust by program base */ +#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ +#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ +#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned + low */ +#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed + low */ +#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ +#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to + GOT with unsigned low */ +#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to + GOT with signed low */ +#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to + GOT */ +#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT + with unsigned low */ +#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT + with signed low */ +#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ +#define R_M32R_NUM 256 /* Keep this the last entry. */ + + +__END_DECLS #endif /* elf.h */ diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c index 066da041..32b4a02d 100644 --- a/libelf/elf32_checksum.c +++ b/libelf/elf32_checksum.c @@ -1,25 +1,59 @@ /* Compute simple checksum from permanent parts of the ELF file. - Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> +#include <endian.h> #include <stdbool.h> #include <stddef.h> #include <string.h> @@ -71,6 +105,14 @@ elfw2(LIBELFBITS,checksum) (elf) || (ident[EI_DATA] == ELFDATA2MSB && __BYTE_ORDER == __BIG_ENDIAN)); + /* If we don't have native byte order, we will likely need to + convert the data with xlate functions. We do it upfront instead + of relocking mid-iteration. */ + if (!likely (same_byte_order)) + rwlock_wrlock (elf->lock); + else + rwlock_rdlock (elf->lock); + /* Iterate over all sections to find those which are not strippable. */ scn = NULL; while ((scn = INTUSE(elf_nextscn) (elf, scn)) != NULL) @@ -84,15 +126,20 @@ elfw2(LIBELFBITS,checksum) (elf) if (shdr == NULL) { __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); - return -1l; + result = -1l; + goto out; } - if (SECTION_STRIP_P (NULL, NULL, NULL, shdr, - elf_strptr (elf, shstrndx, shdr->sh_name), - true, false)) + if (SECTION_STRIP_P (shdr, + INTUSE(elf_strptr) (elf, shstrndx, shdr->sh_name), + true)) /* The section can be stripped. Don't use it. */ continue; + /* Do not look at NOBITS sections. */ + if (shdr->sh_type == SHT_NOBITS) + continue; + /* To compute the checksum we need to get to the data. For repeatable results we must use the external format. The data we get with 'elf'getdata' might be changed for endianess @@ -124,17 +171,25 @@ elfw2(LIBELFBITS,checksum) (elf) /* Convert the data to file byte order. */ if (INTUSE(elfw2(LIBELFBITS,xlatetof)) (data, data, ident[EI_DATA]) == NULL) - return -1l; + { + result = -1l; + goto out; + } result = process_block (result, data); /* And convert it back. */ if (INTUSE(elfw2(LIBELFBITS,xlatetom)) (data, data, ident[EI_DATA]) == NULL) - return -1l; + { + result = -1l; + goto out; + } } } + out: + rwlock_unlock (elf->lock); return result; } INTDEF(elfw2(LIBELFBITS,checksum)) diff --git a/libelf/elf32_fsize.c b/libelf/elf32_fsize.c index b6810183..f8be6f87 100644 --- a/libelf/elf32_fsize.c +++ b/libelf/elf32_fsize.c @@ -1,19 +1,52 @@ /* Return the size of an object file type. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -55,5 +88,9 @@ elfw2(LIBELFBITS, fsize) (type, count, version) * __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][type]); #endif } +/* ANDROID_CHANGE_BEGIN */ +#ifndef __APPLE__ #define local_strong_alias(n1, n2) strong_alias (n1, n2) -//local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize)) +local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize)) +#endif +/* ANDROID_CHANGE_END */ diff --git a/libelf/elf32_getehdr.c b/libelf/elf32_getehdr.c index efd60025..8009133b 100644 --- a/libelf/elf32_getehdr.c +++ b/libelf/elf32_getehdr.c @@ -1,19 +1,52 @@ /* Get ELF header. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -29,12 +62,11 @@ #endif -ElfW2(LIBELFBITS,Ehdr) * -elfw2(LIBELFBITS,getehdr) (elf) +static ElfW2(LIBELFBITS,Ehdr) * +getehdr_impl (elf, wrlock) Elf *elf; + int wrlock; { - ElfW2(LIBELFBITS,Ehdr) *result; - if (elf == NULL) return NULL; @@ -44,22 +76,45 @@ elfw2(LIBELFBITS,getehdr) (elf) return NULL; } - rwlock_rdlock (elf->lock); - + again: if (elf->class == 0) - elf->class = ELFW(ELFCLASS,LIBELFBITS); + { + if (!wrlock) + { + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + wrlock = 1; + goto again; + } + elf->class = ELFW(ELFCLASS,LIBELFBITS); + } else if (unlikely (elf->class != ELFW(ELFCLASS,LIBELFBITS))) { __libelf_seterrno (ELF_E_INVALID_CLASS); - result = NULL; - goto out; + return NULL; } - result = elf->state.ELFW(elf,LIBELFBITS).ehdr; + return elf->state.ELFW(elf,LIBELFBITS).ehdr; +} + +ElfW2(LIBELFBITS,Ehdr) * +__elfw2(LIBELFBITS,getehdr_wrlock) (elf) + Elf *elf; +{ + return getehdr_impl (elf, 1); +} - out: +ElfW2(LIBELFBITS,Ehdr) * +elfw2(LIBELFBITS,getehdr) (elf) + Elf *elf; +{ + ElfW2(LIBELFBITS,Ehdr) *result; + if (elf == NULL) + return NULL; + + rwlock_rdlock (elf->lock); + result = getehdr_impl (elf, 0); rwlock_unlock (elf->lock); return result; } -INTDEF(elfw2(LIBELFBITS,getehdr)) diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c index 9a7b883c..c32c2827 100644 --- a/libelf/elf32_getphdr.c +++ b/libelf/elf32_getphdr.c @@ -1,27 +1,64 @@ /* Get ELF program header table. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <errno.h> +#include <stdbool.h> #include <stdlib.h> #include <unistd.h> +#include <assert.h> +#include <system.h> #include "libelfP.h" #include "common.h" @@ -29,22 +66,12 @@ # define LIBELFBITS 32 #endif - ElfW2(LIBELFBITS,Phdr) * -elfw2(LIBELFBITS,getphdr) (elf) +__elfw2(LIBELFBITS,getphdr_wrlock) (elf) Elf *elf; { ElfW2(LIBELFBITS,Phdr) *result; - if (elf == NULL) - return NULL; - - if (unlikely (elf->kind != ELF_K_ELF)) - { - __libelf_seterrno (ELF_E_INVALID_HANDLE); - return NULL; - } - /* If the program header entry has already been filled in the code below must already have been run. So the class is set, too. No need to waste any more time here. */ @@ -52,8 +79,6 @@ elfw2(LIBELFBITS,getphdr) (elf) if (likely (result != NULL)) return result; - rwlock_wrlock (elf->lock); - if (elf->class == 0) elf->class = ELFW(ELFCLASS,LIBELFBITS); else if (elf->class != ELFW(ELFCLASS,LIBELFBITS)) @@ -67,32 +92,30 @@ elfw2(LIBELFBITS,getphdr) (elf) { /* Read the section header table. */ ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; - size_t phnum; - size_t size; /* If no program header exists return NULL. */ - phnum = ehdr->e_phnum; + size_t phnum = ehdr->e_phnum; if (phnum == 0) { __libelf_seterrno (ELF_E_NO_PHDR); goto out; } - size = phnum * sizeof (ElfW2(LIBELFBITS,Phdr)); + size_t size = phnum * sizeof (ElfW2(LIBELFBITS,Phdr)); if (elf->map_address != NULL) { /* All the data is already mapped. Use it. */ + void *file_phdr = ((char *) elf->map_address + + elf->start_offset + ehdr->e_phoff); if (ehdr->e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED - || (ehdr->e_phoff + || ((uintptr_t) file_phdr & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1)) == 0)) /* Simply use the mapped data. */ - elf->state.ELFW(elf,LIBELFBITS).phdr = (ElfW2(LIBELFBITS,Phdr) *) - ((char *) elf->map_address + elf->start_offset + ehdr->e_phoff); + elf->state.ELFW(elf,LIBELFBITS).phdr = file_phdr; else { - size_t cnt; ElfW2(LIBELFBITS,Phdr) *notcvt; ElfW2(LIBELFBITS,Phdr) *phdr; @@ -110,30 +133,35 @@ elfw2(LIBELFBITS,getphdr) (elf) /* Now copy the data and at the same time convert the byte order. */ - if (ALLOW_UNALIGNED - || (ehdr->e_phoff - & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1)) == 0) - notcvt = (ElfW2(LIBELFBITS,Phdr) *) - ((char *) elf->map_address - + elf->start_offset + ehdr->e_phoff); - else + + if (ehdr->e_ident[EI_DATA] == MY_ELFDATA) { - notcvt = (ElfW2(LIBELFBITS,Phdr) *) alloca (size); - memcpy (notcvt, ((char *) elf->map_address + - elf->start_offset + ehdr->e_phoff), - size); + assert (! ALLOW_UNALIGNED); + memcpy (phdr, file_phdr, size); } - - for (cnt = 0; cnt < phnum; ++cnt) + else { - CONVERT_TO (phdr[cnt].p_type, notcvt[cnt].p_type); - CONVERT_TO (phdr[cnt].p_offset, notcvt[cnt].p_offset); - CONVERT_TO (phdr[cnt].p_vaddr, notcvt[cnt].p_vaddr); - CONVERT_TO (phdr[cnt].p_paddr, notcvt[cnt].p_paddr); - CONVERT_TO (phdr[cnt].p_filesz, notcvt[cnt].p_filesz); - CONVERT_TO (phdr[cnt].p_memsz, notcvt[cnt].p_memsz); - CONVERT_TO (phdr[cnt].p_flags, notcvt[cnt].p_flags); - CONVERT_TO (phdr[cnt].p_align, notcvt[cnt].p_align); + if (ALLOW_UNALIGNED + || ((uintptr_t) file_phdr + & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1)) == 0) + notcvt = file_phdr; + else + { + notcvt = (ElfW2(LIBELFBITS,Phdr) *) alloca (size); + memcpy (notcvt, file_phdr, size); + } + + for (size_t cnt = 0; cnt < phnum; ++cnt) + { + CONVERT_TO (phdr[cnt].p_type, notcvt[cnt].p_type); + CONVERT_TO (phdr[cnt].p_offset, notcvt[cnt].p_offset); + CONVERT_TO (phdr[cnt].p_vaddr, notcvt[cnt].p_vaddr); + CONVERT_TO (phdr[cnt].p_paddr, notcvt[cnt].p_paddr); + CONVERT_TO (phdr[cnt].p_filesz, notcvt[cnt].p_filesz); + CONVERT_TO (phdr[cnt].p_memsz, notcvt[cnt].p_memsz); + CONVERT_TO (phdr[cnt].p_flags, notcvt[cnt].p_flags); + CONVERT_TO (phdr[cnt].p_align, notcvt[cnt].p_align); + } } } } @@ -151,9 +179,10 @@ elfw2(LIBELFBITS,getphdr) (elf) elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_MALLOCED; /* Read the header. */ - if ((size_t) pread (elf->fildes, - elf->state.ELFW(elf,LIBELFBITS).phdr, size, - (elf->start_offset + ehdr->e_phoff)) != size) + ssize_t n = pread_retry (elf->fildes, + elf->state.ELFW(elf,LIBELFBITS).phdr, size, + elf->start_offset + ehdr->e_phoff); + if (unlikely ((size_t) n != size)) { /* Severe problems. We cannot read the data. */ __libelf_seterrno (ELF_E_READ_ERROR); @@ -166,11 +195,10 @@ elfw2(LIBELFBITS,getphdr) (elf) of the host convert the data now. */ if (ehdr->e_ident[EI_DATA] != MY_ELFDATA) { - ElfW2(LIBELFBITS,Phdr) *phdr; - size_t cnt; + ElfW2(LIBELFBITS,Phdr) *phdr + = elf->state.ELFW(elf,LIBELFBITS).phdr; - phdr = elf->state.ELFW(elf,LIBELFBITS).phdr; - for (cnt = 0; cnt < phnum; ++cnt) + for (size_t cnt = 0; cnt < phnum; ++cnt) { CONVERT (phdr[cnt].p_type); CONVERT (phdr[cnt].p_offset); @@ -195,6 +223,33 @@ elfw2(LIBELFBITS,getphdr) (elf) } out: + return result; +} + +ElfW2(LIBELFBITS,Phdr) * +elfw2(LIBELFBITS,getphdr) (elf) + Elf *elf; +{ + ElfW2(LIBELFBITS,Phdr) *result; + + if (elf == NULL) + return NULL; + + if (unlikely (elf->kind != ELF_K_ELF)) + { + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return NULL; + } + + /* If the program header entry has already been filled in the code + * in getphdr_wrlock must already have been run. So the class is + * set, too. No need to waste any more time here. */ + result = elf->state.ELFW(elf,LIBELFBITS).phdr; + if (likely (result != NULL)) + return result; + + rwlock_wrlock (elf->lock); + result = __elfw2(LIBELFBITS,getphdr_wrlock) (elf); rwlock_unlock (elf->lock); return result; diff --git a/libelf/elf32_getshdr.c b/libelf/elf32_getshdr.c index 1caf206c..91f5b3a1 100644 --- a/libelf/elf32_getshdr.c +++ b/libelf/elf32_getshdr.c @@ -1,27 +1,63 @@ /* Return section header. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> +#include <errno.h> +#include <stdbool.h> #include <unistd.h> +#include <system.h> #include "libelfP.h" #include "common.h" @@ -30,75 +66,60 @@ #endif -ElfW2(LIBELFBITS,Shdr) * -elfw2(LIBELFBITS,getshdr) (scn) - Elf_Scn *scn; +static ElfW2(LIBELFBITS,Shdr) * +load_shdr_wrlock (Elf_Scn *scn) { ElfW2(LIBELFBITS,Shdr) *result; - if (scn == NULL) - return NULL; + /* Read the section header table. */ + Elf *elf = scn->elf; + ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; - if (unlikely (scn->elf->state.elf.ehdr == NULL)) - { - __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); - return NULL; - } + /* Try again, maybe the data is there now. */ + result = scn->shdr.ELFW(e,LIBELFBITS); + if (result != NULL) + goto out; - if (unlikely (scn->elf->class != ELFW(ELFCLASS,LIBELFBITS))) + size_t shnum; + if (__elf_getshnum_rdlock (elf, &shnum) != 0) + goto out; + size_t size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr)); + + /* Allocate memory for the section headers. We know the number + of entries from the ELF header. */ + ElfW2(LIBELFBITS,Shdr) *shdr = elf->state.ELFW(elf,LIBELFBITS).shdr = + (ElfW2(LIBELFBITS,Shdr) *) malloc (size); + if (elf->state.ELFW(elf,LIBELFBITS).shdr == NULL) { - __libelf_seterrno (ELF_E_INVALID_CLASS); - return NULL; + __libelf_seterrno (ELF_E_NOMEM); + goto out; } + elf->state.ELFW(elf,LIBELFBITS).shdr_malloced = 1; - result = scn->shdr.ELFW(e,LIBELFBITS); - if (result == NULL) + if (elf->map_address != NULL) { - /* Read the section header table. */ - Elf *elf = scn->elf; - ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; - size_t shnum; - ElfW2(LIBELFBITS,Shdr) *shdr; - size_t size; - size_t cnt; + ElfW2(LIBELFBITS,Shdr) *notcvt; - rwlock_wrlock (elf->lock); + /* All the data is already mapped. If we could use it + directly this would already have happened. */ + void *file_shdr = ((char *) elf->map_address + + elf->start_offset + ehdr->e_shoff); - /* Try again, maybe the data is there now. */ - result = scn->shdr.ELFW(e,LIBELFBITS); - if (result != NULL) - goto out; - - if (INTUSE (elf_getshnum) (elf, &shnum) != 0) - goto out; - size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr)); - - /* Allocate memory for the program headers. We know the number - of entries from the ELF header. */ - shdr = elf->state.ELFW(elf,LIBELFBITS).shdr = - (ElfW2(LIBELFBITS,Shdr) *) malloc (size); - if (elf->state.ELFW(elf,LIBELFBITS).shdr == NULL) + assert (ehdr->e_ident[EI_DATA] != MY_ELFDATA + || (! ALLOW_UNALIGNED + && ((uintptr_t) file_shdr + & (__alignof__ (ElfW2(LIBELFBITS,Shdr)) - 1)) != 0)); + + /* Now copy the data and at the same time convert the byte order. */ + if (ehdr->e_ident[EI_DATA] == MY_ELFDATA) { - __libelf_seterrno (ELF_E_NOMEM); - goto out; + assert (! ALLOW_UNALIGNED); + memcpy (shdr, file_shdr, size); } - elf->state.ELFW(elf,LIBELFBITS).shdr_malloced = 1; - - if (elf->map_address != NULL) + else { - ElfW2(LIBELFBITS,Shdr) *notcvt; - - /* All the data is already mapped. If we could use it - directly this would already have happened. */ - assert (ehdr->e_ident[EI_DATA] != MY_ELFDATA - || (! ALLOW_UNALIGNED - && (ehdr->e_shoff - & (__alignof__ (ElfW2(LIBELFBITS,Shdr)) - 1)) != 0)); - - /* Now copy the data and at the same time convert the byte - order. */ if (ALLOW_UNALIGNED - || (ehdr->e_shoff + || ((uintptr_t) file_shdr & (__alignof__ (ElfW2(LIBELFBITS,Shdr)) - 1)) == 0) notcvt = (ElfW2(LIBELFBITS,Shdr) *) ((char *) elf->map_address @@ -111,7 +132,7 @@ elfw2(LIBELFBITS,getshdr) (scn) size); } - for (cnt = 0; cnt < shnum; ++cnt) + for (size_t cnt = 0; cnt < shnum; ++cnt) { CONVERT_TO (shdr[cnt].sh_name, notcvt[cnt].sh_name); CONVERT_TO (shdr[cnt].sh_type, notcvt[cnt].sh_type); @@ -121,65 +142,153 @@ elfw2(LIBELFBITS,getshdr) (scn) CONVERT_TO (shdr[cnt].sh_size, notcvt[cnt].sh_size); CONVERT_TO (shdr[cnt].sh_link, notcvt[cnt].sh_link); CONVERT_TO (shdr[cnt].sh_info, notcvt[cnt].sh_info); - CONVERT_TO (shdr[cnt].sh_addralign, notcvt[cnt].sh_addralign); + CONVERT_TO (shdr[cnt].sh_addralign, + notcvt[cnt].sh_addralign); CONVERT_TO (shdr[cnt].sh_entsize, notcvt[cnt].sh_entsize); + + /* If this is a section with an extended index add a + reference in the section which uses the extended + index. */ + if (shdr[cnt].sh_type == SHT_SYMTAB_SHNDX + && shdr[cnt].sh_link < shnum) + elf->state.ELFW(elf,LIBELFBITS).scns.data[shdr[cnt].sh_link].shndx_index + = cnt; + + /* Set the own shndx_index field in case it has not yet + been set. */ + if (elf->state.ELFW(elf,LIBELFBITS).scns.data[cnt].shndx_index == 0) + elf->state.ELFW(elf,LIBELFBITS).scns.data[cnt].shndx_index + = -1; } } - else if (elf->fildes != -1) + } + else if (likely (elf->fildes != -1)) + { + /* Read the header. */ + ssize_t n = pread_retry (elf->fildes, + elf->state.ELFW(elf,LIBELFBITS).shdr, size, + elf->start_offset + ehdr->e_shoff); + if (unlikely ((size_t) n != size)) { - /* Read the header. */ - if ((size_t) pread (elf->fildes, - elf->state.ELFW(elf,LIBELFBITS).shdr, size, - elf->start_offset + ehdr->e_shoff) != size) - { - /* Severe problems. We cannot read the data. */ - __libelf_seterrno (ELF_E_READ_ERROR); - goto free_and_out; - } - - /* If the byte order of the file is not the same as the one - of the host convert the data now. */ - if (ehdr->e_ident[EI_DATA] != MY_ELFDATA) - for (cnt = 0; cnt < shnum; ++cnt) - { - CONVERT (shdr[cnt].sh_name); - CONVERT (shdr[cnt].sh_type); - CONVERT (shdr[cnt].sh_flags); - CONVERT (shdr[cnt].sh_addr); - CONVERT (shdr[cnt].sh_offset); - CONVERT (shdr[cnt].sh_size); - CONVERT (shdr[cnt].sh_link); - CONVERT (shdr[cnt].sh_info); - CONVERT (shdr[cnt].sh_addralign); - CONVERT (shdr[cnt].sh_entsize); - } + /* Severe problems. We cannot read the data. */ + __libelf_seterrno (ELF_E_READ_ERROR); + goto free_and_out; } - else - { - /* The file descriptor was already enabled and not all data was - read. Undo the allocation. */ - __libelf_seterrno (ELF_E_FD_DISABLED); - free_and_out: - free (shdr); - elf->state.ELFW(elf,LIBELFBITS).shdr = NULL; - elf->state.ELFW(elf,LIBELFBITS).shdr_malloced = 0; + /* If the byte order of the file is not the same as the one + of the host convert the data now. */ + if (ehdr->e_ident[EI_DATA] != MY_ELFDATA) + for (size_t cnt = 0; cnt < shnum; ++cnt) + { + CONVERT (shdr[cnt].sh_name); + CONVERT (shdr[cnt].sh_type); + CONVERT (shdr[cnt].sh_flags); + CONVERT (shdr[cnt].sh_addr); + CONVERT (shdr[cnt].sh_offset); + CONVERT (shdr[cnt].sh_size); + CONVERT (shdr[cnt].sh_link); + CONVERT (shdr[cnt].sh_info); + CONVERT (shdr[cnt].sh_addralign); + CONVERT (shdr[cnt].sh_entsize); + } + } + else + { + /* The file descriptor was already enabled and not all data was + read. Undo the allocation. */ + __libelf_seterrno (ELF_E_FD_DISABLED); - goto out; - } + free_and_out: + free (shdr); + elf->state.ELFW(elf,LIBELFBITS).shdr = NULL; + elf->state.ELFW(elf,LIBELFBITS).shdr_malloced = 0; - /* Set the pointers in the `scn's. */ - for (cnt = 0; cnt < shnum; ++cnt) - elf->state.ELFW(elf,LIBELFBITS).scns.data[cnt].shdr.ELFW(e,LIBELFBITS) - = &elf->state.ELFW(elf,LIBELFBITS).shdr[cnt]; + goto out; + } - result = scn->shdr.ELFW(e,LIBELFBITS); - assert (result != NULL); + /* Set the pointers in the `scn's. */ + for (size_t cnt = 0; cnt < shnum; ++cnt) + elf->state.ELFW(elf,LIBELFBITS).scns.data[cnt].shdr.ELFW(e,LIBELFBITS) + = &elf->state.ELFW(elf,LIBELFBITS).shdr[cnt]; + + result = scn->shdr.ELFW(e,LIBELFBITS); + assert (result != NULL); + +out: + return result; +} - out: - rwlock_unlock (elf->lock); +static bool +scn_valid (Elf_Scn *scn) +{ + if (scn == NULL) + return false; + + if (unlikely (scn->elf->state.elf.ehdr == NULL)) + { + __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); + return false; + } + + if (unlikely (scn->elf->class != ELFW(ELFCLASS,LIBELFBITS))) + { + __libelf_seterrno (ELF_E_INVALID_CLASS); + return false; } + return true; +} + +ElfW2(LIBELFBITS,Shdr) * +__elfw2(LIBELFBITS,getshdr_rdlock) (scn) + Elf_Scn *scn; +{ + ElfW2(LIBELFBITS,Shdr) *result; + + if (!scn_valid (scn)) + return NULL; + + result = scn->shdr.ELFW(e,LIBELFBITS); + if (result == NULL) + { + rwlock_unlock (scn->elf->lock); + rwlock_wrlock (scn->elf->lock); + result = scn->shdr.ELFW(e,LIBELFBITS); + if (result == NULL) + result = load_shdr_wrlock (scn); + } + + return result; +} + +ElfW2(LIBELFBITS,Shdr) * +__elfw2(LIBELFBITS,getshdr_wrlock) (scn) + Elf_Scn *scn; +{ + ElfW2(LIBELFBITS,Shdr) *result; + + if (!scn_valid (scn)) + return NULL; + + result = scn->shdr.ELFW(e,LIBELFBITS); + if (result == NULL) + result = load_shdr_wrlock (scn); + + return result; +} + +ElfW2(LIBELFBITS,Shdr) * +elfw2(LIBELFBITS,getshdr) (scn) + Elf_Scn *scn; +{ + ElfW2(LIBELFBITS,Shdr) *result; + + if (!scn_valid (scn)) + return NULL; + + rwlock_rdlock (scn->elf->lock); + result = __elfw2(LIBELFBITS,getshdr_rdlock) (scn); + rwlock_unlock (scn->elf->lock); + return result; } -INTDEF(elfw2(LIBELFBITS,getshdr)) diff --git a/libelf/elf32_newehdr.c b/libelf/elf32_newehdr.c index 658ad462..4e20056f 100644 --- a/libelf/elf32_newehdr.c +++ b/libelf/elf32_newehdr.c @@ -1,19 +1,52 @@ /* Create new ELF header. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf32_newphdr.c b/libelf/elf32_newphdr.c index 74a2387a..d1b16088 100644 --- a/libelf/elf32_newphdr.c +++ b/libelf/elf32_newphdr.c @@ -1,19 +1,52 @@ /* Create new ELF program header table. Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c new file mode 100644 index 00000000..86eff8b1 --- /dev/null +++ b/libelf/elf32_offscn.c @@ -0,0 +1,121 @@ +/* Get section at specific index. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <stddef.h> +#include <stdlib.h> + +#include "libelfP.h" + +#ifndef LIBELFBITS +# define LIBELFBITS 32 +#endif + + +Elf_Scn * +elfw2(LIBELFBITS,offscn) (elf, offset) + Elf *elf; + ElfW2(LIBELFBITS,Off) offset; +{ + if (elf == NULL) + return NULL; + + if (unlikely (elf->kind != ELF_K_ELF)) + { + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return NULL; + } + + Elf_ScnList *runp = &elf->state.ELFW(elf,LIBELFBITS).scns; + + /* If we have not looked at section headers before, + we might need to read them in first. */ + if (runp->cnt > 0 + && unlikely (runp->data[0].shdr.ELFW(e,LIBELFBITS) == NULL) + && unlikely (elfw2(LIBELFBITS,getshdr) (&runp->data[0]) == NULL)) + return NULL; + + rwlock_rdlock (elf->lock); + + Elf_Scn *result = NULL; + + /* Find the section in the list. */ + while (1) + { + for (unsigned int i = 0; i < runp->cnt; ++i) + if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_offset == offset) + { + result = &runp->data[i]; + + /* If this section is empty, the following one has the same + sh_offset. We presume the caller is looking for a nonempty + section, so keep looking if this one is empty. */ + if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0) + goto out; + } + + runp = runp->next; + if (runp == NULL) + { + __libelf_seterrno (ELF_E_INVALID_OFFSET); + break; + } + } + + out: + rwlock_unlock (elf->lock); + + return result; +} +INTDEF(elfw2(LIBELFBITS,offscn)) diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 1a628811..e88f4a45 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -1,32 +1,68 @@ /* Write changed data structures. - Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> +#include <errno.h> #include <libelf.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/mman.h> #include <sys/param.h> +#include <system.h> #include "libelfP.h" @@ -49,6 +85,14 @@ compare_sections (const void *a, const void *b) > (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_offset) return 1; + if ((*scna)->shdr.ELFW(e,LIBELFBITS)->sh_size + < (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_size) + return -1; + + if ((*scna)->shdr.ELFW(e,LIBELFBITS)->sh_size + > (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_size) + return 1; + if ((*scna)->index < (*scnb)->index) return -1; @@ -61,18 +105,17 @@ compare_sections (const void *a, const void *b) /* Insert the sections in the list into the provided array and sort them according to their start offsets. For sections with equal - start offsets the section index is used. */ + start offsets, the size is used; for sections with equal start + offsets and sizes, the section index is used. Sorting by size + ensures that zero-length sections are processed first, which + is what we want since they do not advance our file writing position. */ static void sort_sections (Elf_Scn **scns, Elf_ScnList *list) { Elf_Scn **scnp = scns; do - { - size_t cnt; - - for (cnt = 0; cnt < list->cnt; ++cnt) - *scnp++ = &list->data[cnt]; - } + for (size_t cnt = 0; cnt < list->cnt; ++cnt) + *scnp++ = &list->data[cnt]; while ((list = list->next) != NULL); qsort (scns, scnp - scns, sizeof (*scns), compare_sections); @@ -80,11 +123,10 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list) int -internal_function_def +internal_function __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) { ElfW2(LIBELFBITS,Ehdr) *ehdr; - xfct_t fctp; char *last_position; /* We need the ELF header several times. */ @@ -102,6 +144,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) { /* Today there is only one version of the ELF header. */ #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_EHDR]; #else # undef fctp @@ -139,6 +182,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) { /* Today there is only one version of the ELF header. */ #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_PHDR]; #else # undef fctp @@ -168,13 +212,11 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { - ElfW2(LIBELFBITS,Shdr) *shdr_dest; Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); - char *shdr_start = ((char *) elf->map_address + elf->start_offset - + ehdr->e_shoff); - char *shdr_end = shdr_start + ehdr->e_shnum * ehdr->e_shentsize; - size_t cnt; + char *const shdr_start = ((char *) elf->map_address + elf->start_offset + + ehdr->e_shoff); + char *const shdr_end = shdr_start + ehdr->e_shnum * ehdr->e_shentsize; #if EV_NUM != 2 xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; @@ -182,67 +224,120 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) # undef shdr_fctp # define shdr_fctp __elf_xfctstom[0][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR] #endif - shdr_dest = (ElfW2(LIBELFBITS,Shdr) *) - ((char *) elf->map_address + elf->start_offset + ehdr->e_shoff); +#define shdr_dest ((ElfW2(LIBELFBITS,Shdr) *) shdr_start) /* Get all sections into the array and sort them. */ sort_sections (scns, list); + /* We possibly have to copy the section header data because moving + the sections might overwrite the data. */ + for (size_t cnt = 0; cnt < shnum; ++cnt) + { + Elf_Scn *scn = scns[cnt]; + + if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced + && (scn->shdr_flags & ELF_F_MALLOCED) == 0 + && scn->shdr.ELFW(e,LIBELFBITS) != &shdr_dest[scn->index]) + { + assert ((char *) elf->map_address + elf->start_offset + < (char *) scn->shdr.ELFW(e,LIBELFBITS)); + assert ((char *) scn->shdr.ELFW(e,LIBELFBITS) + < ((char *) elf->map_address + elf->start_offset + + elf->maximum_size)); + + void *p = alloca (sizeof (ElfW2(LIBELFBITS,Shdr))); + scn->shdr.ELFW(e,LIBELFBITS) + = memcpy (p, scn->shdr.ELFW(e,LIBELFBITS), + sizeof (ElfW2(LIBELFBITS,Shdr))); + } + + /* If the file is mmaped and the original position of the + section in the file is lower than the new position we + need to save the section content since otherwise it is + overwritten before it can be copied. If there are + multiple data segments in the list only the first can be + from the file. */ + if (((char *) elf->map_address + elf->start_offset + <= (char *) scn->data_list.data.d.d_buf) + && ((char *) scn->data_list.data.d.d_buf + < ((char *) elf->map_address + elf->start_offset + + elf->maximum_size)) + && (((char *) elf->map_address + elf->start_offset + + scn->shdr.ELFW(e,LIBELFBITS)->sh_offset) + > (char *) scn->data_list.data.d.d_buf)) + { + void *p = malloc (scn->data_list.data.d.d_size); + if (p == NULL) + { + __libelf_seterrno (ELF_E_NOMEM); + return -1; + } + scn->data_list.data.d.d_buf = scn->data_base + = memcpy (p, scn->data_list.data.d.d_buf, + scn->data_list.data.d.d_size); + } + } + /* Iterate over all the section in the order in which they appear in the output file. */ - for (cnt = 0; cnt < shnum; ++cnt) + for (size_t cnt = 0; cnt < shnum; ++cnt) { Elf_Scn *scn = scns[cnt]; - ElfW2(LIBELFBITS,Shdr) *shdr; - char *scn_start; - Elf_Data_List *dl; - shdr = scn->shdr.ELFW(e,LIBELFBITS); + ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); - scn_start = ((char *) elf->map_address - + elf->start_offset + shdr->sh_offset); - dl = &scn->data_list; + char *scn_start = ((char *) elf->map_address + + elf->start_offset + shdr->sh_offset); + Elf_Data_List *dl = &scn->data_list; if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL) do { + assert (dl->data.d.d_off >= 0); + assert ((GElf_Off) dl->data.d.d_off <= shdr->sh_size); + assert (dl->data.d.d_size <= (shdr->sh_size + - (GElf_Off) dl->data.d.d_off)); + if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) { - if (scn_start + dl->data.d.d_off != last_position) + if (scn_start + dl->data.d.d_off > last_position) { - if (scn_start + dl->data.d.d_off > last_position) + /* This code assumes that the data blocks for + a section are ordered by offset. */ + size_t written = 0; + + if (last_position < shdr_start) { - /* This code assumes that the data blocks for - a section are ordered by offset. */ - size_t written = 0; + written = MIN (scn_start + dl->data.d.d_off + - last_position, + shdr_start - last_position); - if (last_position < shdr_start) - { - written = MIN (scn_start + dl->data.d.d_off - - last_position, - shdr_start - last_position); + memset (last_position, __libelf_fill_byte, + written); + } - memset (last_position, __libelf_fill_byte, - written); - } + if (last_position + written + != scn_start + dl->data.d.d_off + && shdr_end < scn_start + dl->data.d.d_off) + memset (shdr_end, __libelf_fill_byte, + scn_start + dl->data.d.d_off - shdr_end); + } - if (last_position + written - != scn_start + dl->data.d.d_off - && shdr_end < scn_start + dl->data.d.d_off) - memset (shdr_end, __libelf_fill_byte, - scn_start + dl->data.d.d_off - shdr_end); + /* Let it go backward if the sections use a bogus + layout with overlaps. We'll overwrite the stupid + user's section data with the latest one, rather than + crashing. */ - last_position = scn_start + dl->data.d.d_off; - } - } + last_position = scn_start + dl->data.d.d_off; if (unlikely (change_bo)) { #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][dl->data.d.d_version - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type]; #else # undef fctp - fctp = __elf_xfctstom[0][0][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type]; +# define fctp __elf_xfctstom[0][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type] #endif /* Do the real work. */ @@ -259,6 +354,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) else last_position += dl->data.d.d_size; + assert (scn_start + dl->data.d.d_off + dl->data.d.d_size + == last_position); + dl->flags &= ~ELF_F_DIRTY; dl = dl->next; @@ -268,7 +366,23 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) /* We have to trust the existing section header information. */ last_position += shdr->sh_size; - /* Write the section header table entry if necessary. */ + scn->flags &= ~ELF_F_DIRTY; + } + + /* Fill the gap between last section and section header table if + necessary. */ + if ((elf->flags & ELF_F_DIRTY) + && last_position < ((char *) elf->map_address + elf->start_offset + + ehdr->e_shoff)) + memset (last_position, __libelf_fill_byte, + (char *) elf->map_address + elf->start_offset + ehdr->e_shoff + - last_position); + + /* Write the section header table entry if necessary. */ + for (size_t cnt = 0; cnt < shnum; ++cnt) + { + Elf_Scn *scn = scns[cnt]; + if ((scn->shdr_flags | elf->flags) & ELF_F_DIRTY) { if (unlikely (change_bo)) @@ -280,25 +394,29 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) scn->shdr.ELFW(e,LIBELFBITS), sizeof (ElfW2(LIBELFBITS,Shdr))); - scn->shdr_flags &= ~ELF_F_DIRTY; - } + /* If we previously made a copy of the section header + entry we now have to adjust the pointer again so + point to new place in the mapping. */ + if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced + && (scn->shdr_flags & ELF_F_MALLOCED) == 0) + scn->shdr.ELFW(e,LIBELFBITS) = &shdr_dest[scn->index]; - scn->flags &= ~ELF_F_DIRTY; + scn->shdr_flags &= ~ELF_F_DIRTY; + } } - - /* Fill the gap between last section and section header table if - necessary. */ - if ((elf->flags & ELF_F_DIRTY) - && last_position < ((char *) elf->map_address + elf->start_offset - + ehdr->e_shoff)) - memset (last_position, __libelf_fill_byte, - (char *) elf->map_address + elf->start_offset + ehdr->e_shoff - - last_position); } /* That was the last part. Clear the overall flag. */ elf->flags &= ~ELF_F_DIRTY; + /* Make sure the content hits the disk. */ + char *msync_start = ((char *) elf->map_address + + (elf->start_offset & ~(sysconf (_SC_PAGESIZE) - 1))); + char *msync_end = ((char *) elf->map_address + + elf->start_offset + ehdr->e_shoff + + ehdr->e_shentsize * shnum); + (void) msync (msync_start, msync_end - msync_start, MS_SYNC); + return 0; } @@ -331,7 +449,7 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp) /* This many bytes we want to write in this round. */ size_t n = MIN (filled, len); - if (unlikely ((size_t) pwrite (fd, fillbuf, n, pos) != n)) + if (unlikely ((size_t) pwrite_retry (fd, fillbuf, n, pos) != n)) { __libelf_seterrno (ELF_E_WRITE_ERROR); return 1; @@ -347,17 +465,14 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp) int -internal_function_def +internal_function __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) { char fillbuf[FILLBUFSIZE]; size_t filled = 0; - ElfW2(LIBELFBITS,Ehdr) *ehdr; - xfct_t fctp; - off_t last_offset; /* We need the ELF header several times. */ - ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; + ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; /* Write out the ELF header. */ if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY) @@ -374,6 +489,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) { /* Today there is only one version of the ELF header. */ #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_EHDR]; #else # undef fctp @@ -388,8 +504,8 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } /* Write out the ELF header. */ - if (unlikely (pwrite (elf->fildes, out_ehdr, - sizeof (ElfW2(LIBELFBITS,Ehdr)), 0) + if (unlikely (pwrite_retry (elf->fildes, out_ehdr, + sizeof (ElfW2(LIBELFBITS,Ehdr)), 0) != sizeof (ElfW2(LIBELFBITS,Ehdr)))) { __libelf_seterrno (ELF_E_WRITE_ERROR); @@ -424,6 +540,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) { /* Today there is only one version of the ELF header. */ #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_PHDR]; #else # undef fctp @@ -448,10 +565,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } /* Write out the ELF header. */ - if (unlikely ((size_t) pwrite (elf->fildes, out_phdr, - sizeof (ElfW2(LIBELFBITS,Phdr)) - * ehdr->e_phnum, ehdr->e_phoff) - != sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum)) + size_t phdr_size = sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum; + if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr, + phdr_size, ehdr->e_phoff) + != phdr_size)) { __libelf_seterrno (ELF_E_WRITE_ERROR); return 1; @@ -465,6 +582,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* From now on we have to keep track of the last position to eventually fill the gaps with the prescribed fill byte. */ + off_t last_offset; if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) last_offset = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); else @@ -474,14 +592,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { - off_t shdr_offset; - Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; - ElfW2(LIBELFBITS,Shdr) *shdr_data; - Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); - int shdr_flags; - size_t cnt; - - shdr_offset = elf->start_offset + ehdr->e_shoff; + off_t shdr_offset = elf->start_offset + ehdr->e_shoff; #if EV_NUM != 2 xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; #else @@ -489,27 +600,27 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) # define shdr_fctp __elf_xfctstom[0][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR] #endif + ElfW2(LIBELFBITS,Shdr) *shdr_data; if (change_bo || elf->state.ELFW(elf,LIBELFBITS).shdr == NULL) shdr_data = (ElfW2(LIBELFBITS,Shdr) *) alloca (shnum * sizeof (ElfW2(LIBELFBITS,Shdr))); else shdr_data = elf->state.ELFW(elf,LIBELFBITS).shdr; - shdr_flags = elf->flags; + int shdr_flags = elf->flags; /* Get all sections into the array and sort them. */ + Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; + Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); sort_sections (scns, list); - for (cnt = 0; cnt < shnum; ++cnt) + for (size_t cnt = 0; cnt < shnum; ++cnt) { Elf_Scn *scn = scns[cnt]; - ElfW2(LIBELFBITS,Shdr) *shdr; - off_t scn_start; - Elf_Data_List *dl; - shdr = scn->shdr.ELFW(e,LIBELFBITS); + ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); - scn_start = elf->start_offset + shdr->sh_offset; - dl = &scn->data_list; + off_t scn_start = elf->start_offset + shdr->sh_offset; + Elf_Data_List *dl = &scn->data_list; if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL && scn->index != 0) @@ -520,26 +631,30 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) char tmpbuf[MAX_TMPBUF]; void *buf = dl->data.d.d_buf; - if (scn_start + dl->data.d.d_off != last_offset) + if (scn_start + dl->data.d.d_off > last_offset) { - assert (last_offset < scn_start + dl->data.d.d_off); - if (unlikely (fill (elf->fildes, last_offset, (scn_start + dl->data.d.d_off) - last_offset, fillbuf, &filled) != 0)) return 1; - - last_offset = scn_start + dl->data.d.d_off; } + /* Let it go backward if the sections use a bogus + layout with overlaps. We'll overwrite the stupid + user's section data with the latest one, rather than + crashing. */ + + last_offset = scn_start + dl->data.d.d_off; + if (unlikely (change_bo)) { #if EV_NUM != 2 + xfct_t fctp; fctp = __elf_xfctstom[__libelf_version - 1][dl->data.d.d_version - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type]; #else # undef fctp - fctp = __elf_xfctstom[0][0][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type]; +# define fctp __elf_xfctstom[0][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][dl->data.d.d_type] #endif buf = tmpbuf; @@ -557,10 +672,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) (*fctp) (buf, dl->data.d.d_buf, dl->data.d.d_size, 1); } - if (unlikely ((size_t) pwrite (elf->fildes, buf, - dl->data.d.d_size, - last_offset) - != dl->data.d.d_size)) + ssize_t n = pwrite_retry (elf->fildes, buf, + dl->data.d.d_size, + last_offset); + if (unlikely ((size_t) n != dl->data.d.d_size)) { if (buf != dl->data.d.d_buf && buf != tmpbuf) free (buf); @@ -593,7 +708,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) sizeof (ElfW2(LIBELFBITS,Shdr))); shdr_flags |= scn->shdr_flags; - scn->shdr_flags &= ~ELF_F_DIRTY; + scn->shdr_flags &= ~ELF_F_DIRTY; } /* Fill the gap between last section and section header table if @@ -606,9 +721,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* Write out the section header table. */ if (shdr_flags & ELF_F_DIRTY - && unlikely ((size_t) pwrite (elf->fildes, shdr_data, - sizeof (ElfW2(LIBELFBITS,Shdr)) - * shnum, shdr_offset) + && unlikely ((size_t) pwrite_retry (elf->fildes, shdr_data, + sizeof (ElfW2(LIBELFBITS,Shdr)) + * shnum, shdr_offset) != sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum)) { __libelf_seterrno (ELF_E_WRITE_ERROR); diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index 6811ad1f..a18d0bea 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -1,26 +1,59 @@ /* Update data structures for changes. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> -//#include <endian.h> +#include <endian.h> #include <libelf.h> #include <stdbool.h> #include <string.h> @@ -99,26 +132,33 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr, off_t -internal_function_def -__elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) +internal_function +__elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) { - ElfW2(LIBELFBITS,Ehdr) *ehdr = INTUSE(elfw2(LIBELFBITS,getehdr)) (elf); + ElfW2(LIBELFBITS,Ehdr) *ehdr; int changed = 0; int ehdr_flags = 0; - off_t size; + + ehdr = __elfw2(LIBELFBITS,getehdr_wrlock) (elf); /* Set the default values. */ if (ELFW(default_ehdr,LIBELFBITS) (elf, ehdr, shnum, change_bop) != 0) return -1; /* At least the ELF header is there. */ - size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); + off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); /* Set the program header position. */ + if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL + && (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN + || ehdr->e_type == ET_CORE)) + (void) __elfw2(LIBELFBITS,getphdr_wrlock) (elf); if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL) { - /* Only executables or shared objects have a program header. */ - if (ehdr->e_type != ET_EXEC && unlikely (ehdr->e_type != ET_DYN)) + /* Only executables, shared objects, and core files have a program + header. */ + if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN + && unlikely (ehdr->e_type != ET_CORE)) { __libelf_seterrno (ELF_E_INVALID_PHDR); return -1; @@ -154,31 +194,31 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) { /* We have to fill in the number of sections in the header of the zeroth section. */ - elf->state.ELFW(elf,LIBELFBITS).scns.data[0].shdr.ELFW(e,LIBELFBITS)->sh_size - = shnum; - elf->state.ELFW(elf,LIBELFBITS).scns.data[0].shdr_flags - |= ELF_F_DIRTY; - } + Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0]; + update_if_changed (scn0->shdr.ELFW(e,LIBELFBITS)->sh_size, + shnum, scn0->shdr_flags); + } /* Go over all sections and find out how large they are. */ list = &elf->state.ELFW(elf,LIBELFBITS).scns; + /* Load the section headers if necessary. This loads the + headers for all sections. */ + if (list->data[1].shdr.ELFW(e,LIBELFBITS) == NULL) + (void) __elfw2(LIBELFBITS,getshdr_wrlock) (&list->data[1]); + do { - size_t cnt; - - for (cnt = first == true; cnt < list->cnt; ++cnt) + for (size_t cnt = first == true; cnt < list->cnt; ++cnt) { Elf_Scn *scn = &list->data[cnt]; ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); off_t offset = 0; - ElfW2(LIBELFBITS,Word) sh_entsize; - ElfW2(LIBELFBITS,Word) sh_align; assert (shdr != NULL); - sh_entsize = shdr->sh_entsize; - sh_align = shdr->sh_addralign ?: 1; + ElfW2(LIBELFBITS,Word) sh_entsize = shdr->sh_entsize; + ElfW2(LIBELFBITS,Word) sh_align = shdr->sh_addralign ?: 1; /* Set the sh_entsize value if we can reliably detect it. */ switch (shdr->sh_type) @@ -227,6 +267,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) update_if_changed (shdr->sh_entsize, sh_entsize, scn->shdr_flags); + if (scn->data_read == 0 + && __libelf_set_rawdata_wrlock (scn) != 0) + /* Something went wrong. The error value is already set. */ + return -1; + /* Iterate over all data blocks. */ if (list->data[cnt].data_list_rear != NULL) { @@ -234,28 +279,33 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) while (dl != NULL) { - if (unlikely (dl->data.d.d_version == EV_NONE) - || unlikely (dl->data.d.d_version >= EV_NUM)) + Elf_Data *data = &dl->data.d; + if (dl == &scn->data_list && data->d_buf == NULL + && scn->rawdata.d.d_buf != NULL) + data = &scn->rawdata.d; + + if (unlikely (data->d_version == EV_NONE) + || unlikely (data->d_version >= EV_NUM)) { __libelf_seterrno (ELF_E_UNKNOWN_VERSION); return -1; } - if (unlikely (! powerof2 (dl->data.d.d_align))) + if (unlikely (! powerof2 (data->d_align))) { __libelf_seterrno (ELF_E_INVALID_ALIGN); return -1; } - sh_align = MAX (sh_align, dl->data.d.d_align); + sh_align = MAX (sh_align, data->d_align); if (elf->flags & ELF_F_LAYOUT) { /* The user specified the offset and the size. All we have to do is check whether this block fits in the size specified for the section. */ - if (unlikely ((GElf_Word) (dl->data.d.d_off - + dl->data.d.d_size) + if (unlikely ((GElf_Word) (data->d_off + + data->d_size) > shdr->sh_size)) { __libelf_seterrno (ELF_E_SECTION_TOO_SMALL); @@ -265,19 +315,22 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) else { /* Determine the padding. */ - offset = ((offset + dl->data.d.d_align - 1) - & ~(dl->data.d.d_align - 1)); + offset = ((offset + data->d_align - 1) + & ~(data->d_align - 1)); - update_if_changed (dl->data.d.d_off, offset, - changed); + update_if_changed (data->d_off, offset, changed); - offset += dl->data.d.d_size; + offset += data->d_size; } /* Next data block. */ dl = dl->next; } } + else + /* Get the size of the section from the raw data. If + none is available the value is zero. */ + offset += scn->rawdata.d.d_size; if (elf->flags & ELF_F_LAYOUT) { @@ -305,8 +358,18 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) scn->shdr_flags); size = (size + sh_align - 1) & ~(sh_align - 1); + int offset_changed = 0; update_if_changed (shdr->sh_offset, (GElf_Word) size, - changed); + offset_changed); + changed |= offset_changed; + + if (offset_changed && scn->data_list_rear == NULL) + { + /* The position of the section in the file + changed. Create the section data list. */ + if (__elf_getdata_rdlock (scn, NULL) == NULL) + return -1; + } /* See whether the section size is correct. */ update_if_changed (shdr->sh_size, (GElf_Word) offset, diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c index 156f0da5..dc686ec0 100644 --- a/libelf/elf32_xlatetof.c +++ b/libelf/elf32_xlatetof.c @@ -1,26 +1,59 @@ /* Convert from memory to file representation. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> -//#include <endian.h> +#include <endian.h> #include <string.h> #include "libelfP.h" diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c index 7495201e..4f54df25 100644 --- a/libelf/elf32_xlatetom.c +++ b/libelf/elf32_xlatetom.c @@ -1,26 +1,59 @@ /* Convert from file to memory representation. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> -//#include <endian.h> +#include <endian.h> #include <string.h> #include "libelfP.h" diff --git a/libelf/elf64_checksum.c b/libelf/elf64_checksum.c index bdb9210c..000b66f8 100644 --- a/libelf/elf64_checksum.c +++ b/libelf/elf64_checksum.c @@ -1,19 +1,52 @@ /* Compute simple checksum from permanent parts of the ELF file. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_checksum.c" diff --git a/libelf/elf64_fsize.c b/libelf/elf64_fsize.c index 0b1f414b..2ee05122 100644 --- a/libelf/elf64_fsize.c +++ b/libelf/elf64_fsize.c @@ -1,19 +1,52 @@ /* Return the size of an object file type. Copyright (C) 1998, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_fsize.c" diff --git a/libelf/elf64_getehdr.c b/libelf/elf64_getehdr.c index 89a69fff..c649679d 100644 --- a/libelf/elf64_getehdr.c +++ b/libelf/elf64_getehdr.c @@ -1,19 +1,52 @@ /* Return program header table. Copyright (C) 1998, 1999, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_getehdr.c" diff --git a/libelf/elf64_getphdr.c b/libelf/elf64_getphdr.c index d06d7c10..5e2d0ead 100644 --- a/libelf/elf64_getphdr.c +++ b/libelf/elf64_getphdr.c @@ -1,19 +1,52 @@ /* Return program header table. Copyright (C) 1998, 1999, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_getphdr.c" diff --git a/libelf/elf64_getshdr.c b/libelf/elf64_getshdr.c index 1a5da574..5b86dbec 100644 --- a/libelf/elf64_getshdr.c +++ b/libelf/elf64_getshdr.c @@ -1,19 +1,52 @@ /* Return section header. Copyright (C) 1998, 1999, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_getshdr.c" diff --git a/libelf/elf64_newehdr.c b/libelf/elf64_newehdr.c index aba6e630..eaea2b1a 100644 --- a/libelf/elf64_newehdr.c +++ b/libelf/elf64_newehdr.c @@ -1,19 +1,52 @@ /* Create new program header table. Copyright (C) 1999, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_newehdr.c" diff --git a/libelf/elf64_newphdr.c b/libelf/elf64_newphdr.c index 90ff4632..91a41331 100644 --- a/libelf/elf64_newphdr.c +++ b/libelf/elf64_newphdr.c @@ -1,19 +1,52 @@ /* Create new program header table. Copyright (C) 1999, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_newphdr.c" diff --git a/libelf/elf64_offscn.c b/libelf/elf64_offscn.c new file mode 100644 index 00000000..6d312150 --- /dev/null +++ b/libelf/elf64_offscn.c @@ -0,0 +1,52 @@ +/* Return program header table. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#define LIBELFBITS 64 +#include "elf32_offscn.c" diff --git a/libelf/elf64_updatefile.c b/libelf/elf64_updatefile.c index 6b604f10..5502d188 100644 --- a/libelf/elf64_updatefile.c +++ b/libelf/elf64_updatefile.c @@ -1,18 +1,51 @@ /* Copyright (C) 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_updatefile.c" diff --git a/libelf/elf64_updatenull.c b/libelf/elf64_updatenull.c index ff1f0708..6838fd8f 100644 --- a/libelf/elf64_updatenull.c +++ b/libelf/elf64_updatenull.c @@ -1,18 +1,51 @@ /* Copyright (C) 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_updatenull.c" diff --git a/libelf/elf64_xlatetof.c b/libelf/elf64_xlatetof.c index 3440bbc6..2747ce0f 100644 --- a/libelf/elf64_xlatetof.c +++ b/libelf/elf64_xlatetof.c @@ -1,19 +1,52 @@ /* Convert from memory to file representation. Copyright (C) 1998, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_xlatetof.c" diff --git a/libelf/elf64_xlatetom.c b/libelf/elf64_xlatetom.c index 773f04ee..6fa6a02d 100644 --- a/libelf/elf64_xlatetom.c +++ b/libelf/elf64_xlatetom.c @@ -1,19 +1,52 @@ /* Convert from file to memory representation. Copyright (C) 1998, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #define LIBELFBITS 64 #include "elf32_xlatetom.c" diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 63fe013e..9d06f929 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -1,19 +1,52 @@ /* Create descriptor for processing file. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 1998-2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -31,10 +64,10 @@ #include <sys/param.h> #include <sys/stat.h> +#include <system.h> #include "libelfP.h" #include "common.h" - /* Create descriptor for archive in memory. */ static inline Elf * file_read_ar (int fildes, void *map_address, off_t offset, size_t maxsize, @@ -69,37 +102,57 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, Elf64_Ehdr *e64; void *p; } ehdr; + union + { + Elf32_Ehdr e32; + Elf64_Ehdr e64; + } ehdr_mem; bool is32 = e_ident[EI_CLASS] == ELFCLASS32; /* Make the ELF header available. */ - if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA + if (e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED - || (((size_t) ((char *) map_address + offset)) - & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr)) - - 1)) == 0)) - ehdr.p = (char *) map_address + offset; + || (((size_t) e_ident + & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr)) + - 1)) == 0))) + ehdr.p = e_ident; else { - /* We have to read the data from the file. */ - size_t len = is32 ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr); + /* We already read the ELF header. We have to copy the header + since we possibly modify the data here and the caller + expects the memory it passes in to be preserved. */ + ehdr.p = &ehdr_mem; - ehdr.p = alloca (len); - /* Fill it. */ - if ((size_t) pread (fildes, ehdr.p, len, offset) != len) - /* Failed reading. */ - return (size_t) -1l; + if (is32) + { + if (ALLOW_UNALIGNED) + { + ehdr_mem.e32.e_shnum = ((Elf32_Ehdr *) e_ident)->e_shnum; + ehdr_mem.e32.e_shoff = ((Elf32_Ehdr *) e_ident)->e_shoff; + } + else + memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr)); - if (e_ident[EI_DATA] != MY_ELFDATA) + if (e_ident[EI_DATA] != MY_ELFDATA) + { + CONVERT (ehdr_mem.e32.e_shnum); + CONVERT (ehdr_mem.e32.e_shoff); + } + } + else { - if (is32) + if (ALLOW_UNALIGNED) { - CONVERT (ehdr.e32->e_shnum); - CONVERT (ehdr.e32->e_shoff); + ehdr_mem.e64.e_shnum = ((Elf64_Ehdr *) e_ident)->e_shnum; + ehdr_mem.e64.e_shoff = ((Elf64_Ehdr *) e_ident)->e_shoff; } else + memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr)); + + if (e_ident[EI_DATA] != MY_ELFDATA) { - CONVERT (ehdr.e64->e_shnum); - CONVERT (ehdr.e64->e_shoff); + CONVERT (ehdr_mem.e64.e_shnum); + CONVERT (ehdr_mem.e64.e_shoff); } } } @@ -111,27 +164,34 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, if (unlikely (result == 0) && ehdr.e32->e_shoff != 0) { - if (offset + ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize) + if (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize) /* Cannot read the first section header. */ - return (size_t) -1l; + return 0; if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED || (((size_t) ((char *) map_address + offset)) & (__alignof__ (Elf32_Ehdr) - 1)) == 0)) /* We can directly access the memory. */ - result = ((Elf32_Shdr *) ((char *) map_address - + ehdr.e32->e_shoff + result = ((Elf32_Shdr *) ((char *) map_address + ehdr.e32->e_shoff + offset))->sh_size; else { Elf32_Word size; - if (pread (fildes, &size, sizeof (Elf32_Word), - offset + ehdr.e32->e_shoff - + offsetof (Elf32_Shdr, sh_size)) - != sizeof (Elf32_Word)) - return (size_t) -1l; + if (likely (map_address != NULL)) + /* gcc will optimize the memcpy to a simple memory + access while taking care of alignment issues. */ + memcpy (&size, &((Elf32_Shdr *) ((char *) map_address + + ehdr.e32->e_shoff + + offset))->sh_size, + sizeof (Elf32_Word)); + else + if (unlikely (pread_retry (fildes, &size, sizeof (Elf32_Word), + offset + ehdr.e32->e_shoff + + offsetof (Elf32_Shdr, sh_size)) + != sizeof (Elf32_Word))) + return (size_t) -1l; if (e_ident[EI_DATA] != MY_ELFDATA) CONVERT (size); @@ -139,6 +199,11 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, result = size; } } + + /* If the section headers were truncated, pretend none were there. */ + if (ehdr.e32->e_shoff > maxsize + || maxsize - ehdr.e32->e_shoff < sizeof (Elf32_Shdr) * result) + result = 0; } else { @@ -147,34 +212,49 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, if (unlikely (result == 0) && ehdr.e64->e_shoff != 0) { - if (offset + ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize) + if (ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize) /* Cannot read the first section header. */ - return (size_t) -1l; + return 0; + Elf64_Xword size; if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED || (((size_t) ((char *) map_address + offset)) & (__alignof__ (Elf64_Ehdr) - 1)) == 0)) /* We can directly access the memory. */ - result = ((Elf64_Shdr *) ((char *) map_address - + ehdr.e64->e_shoff - + offset))->sh_size; + size = ((Elf64_Shdr *) ((char *) map_address + ehdr.e64->e_shoff + + offset))->sh_size; else { - Elf64_Word size; - - if (pread (fildes, &size, sizeof (Elf64_Word), - offset + ehdr.e64->e_shoff - + offsetof (Elf64_Shdr, sh_size)) - != sizeof (Elf64_Word)) - return (size_t) -1l; + if (likely (map_address != NULL)) + /* gcc will optimize the memcpy to a simple memory + access while taking care of alignment issues. */ + memcpy (&size, &((Elf64_Shdr *) ((char *) map_address + + ehdr.e64->e_shoff + + offset))->sh_size, + sizeof (Elf64_Xword)); + else + if (unlikely (pread_retry (fildes, &size, sizeof (Elf64_Word), + offset + ehdr.e64->e_shoff + + offsetof (Elf64_Shdr, sh_size)) + != sizeof (Elf64_Xword))) + return (size_t) -1l; if (e_ident[EI_DATA] != MY_ELFDATA) CONVERT (size); - - result = size; } + + if (size > ~((GElf_Word) 0)) + /* Invalid value, it is too large. */ + return (size_t) -1l; + + result = size; } + + /* If the section headers were truncated, pretend none were there. */ + if (ehdr.e64->e_shoff > maxsize + || maxsize - ehdr.e64->e_shoff < sizeof (Elf64_Shdr) * result) + result = 0; } return result; @@ -183,35 +263,15 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, /* Create descriptor for ELF file in memory. */ static Elf * -file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, - Elf_Cmd cmd, Elf *parent) +file_read_elf (int fildes, void *map_address, unsigned char *e_ident, + off_t offset, size_t maxsize, Elf_Cmd cmd, Elf *parent) { - /* We only read the ELF header now. */ - unsigned char *e_ident; - size_t scncnt; - Elf *elf; - - if (map_address != NULL) - /* It's right at the beginning of the file. No word access - required, just bytes. */ - e_ident = (unsigned char *) map_address + offset; - else - { - e_ident = (unsigned char *) alloca (EI_NIDENT); - - if (pread (fildes, e_ident, EI_NIDENT, offset) != EI_NIDENT) - { - __libelf_seterrno (ELF_E_READ_ERROR); - return NULL; - } - } - /* Verify the binary is of the class we can handle. */ - if ((e_ident[EI_CLASS] != ELFCLASS32 - && e_ident[EI_CLASS] != ELFCLASS64) - /* We also can only handle two encodings. */ - || (e_ident[EI_DATA] != ELFDATA2LSB - && e_ident[EI_DATA] != ELFDATA2MSB)) + if (unlikely ((e_ident[EI_CLASS] != ELFCLASS32 + && e_ident[EI_CLASS] != ELFCLASS64) + /* We also can only handle two encodings. */ + || (e_ident[EI_DATA] != ELFDATA2LSB + && e_ident[EI_DATA] != ELFDATA2MSB))) { /* Cannot handle this. */ __libelf_seterrno (ELF_E_INVALID_FILE); @@ -219,14 +279,14 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, } /* Determine the number of sections. */ - scncnt = get_shnum (map_address, e_ident, fildes, offset, maxsize); + size_t scncnt = get_shnum (map_address, e_ident, fildes, offset, maxsize); if (scncnt == (size_t) -1l) /* Could not determine the number of sections. */ return NULL; /* We can now allocate the memory. */ - elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, - ELF_K_ELF, scncnt * sizeof (Elf_Scn)); + Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, + ELF_K_ELF, scncnt * sizeof (Elf_Scn)); if (elf == NULL) /* Not enough memory. */ return NULL; @@ -234,12 +294,14 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, /* Some more or less arbitrary value. */ elf->state.elf.scnincr = 10; + /* Make the class easily available. */ + elf->class = e_ident[EI_CLASS]; + if (e_ident[EI_CLASS] == ELFCLASS32) { /* This pointer might not be directly usable if the alignment is not sufficient for the architecture. */ Elf32_Ehdr *ehdr = (Elf32_Ehdr *) ((char *) map_address + offset); - size_t cnt; assert ((unsigned int) scncnt == scncnt); elf->state.elf32.scns.cnt = elf->state.elf32.scns.max = scncnt; @@ -254,19 +316,16 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, & (__alignof__ (Elf32_Phdr) - 1)) == 0))) { /* We can use the mmapped memory. */ - elf->state.elf32.ehdr = - (Elf32_Ehdr *) ((char *) map_address + offset); - elf->state.elf32.shdr = - (Elf32_Shdr *) ((char *) map_address + offset - + elf->state.elf32.ehdr->e_shoff); - if (elf->state.elf32.ehdr->e_phnum) + elf->state.elf32.ehdr = ehdr; + elf->state.elf32.shdr + = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff); + if (ehdr->e_phnum > 0) /* Assign a value only if there really is a program header. Otherwise the value remains NULL. */ elf->state.elf32.phdr - = (Elf32_Phdr *) ((char *) map_address + offset - + elf->state.elf32.ehdr->e_phoff); + = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff); - for (cnt = 0; cnt < scncnt; ++cnt) + for (size_t cnt = 0; cnt < scncnt; ++cnt) { elf->state.elf32.scns.data[cnt].index = cnt; elf->state.elf32.scns.data[cnt].elf = elf; @@ -277,18 +336,26 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, ((char *) map_address + offset + elf->state.elf32.shdr[cnt].sh_offset); elf->state.elf32.scns.data[cnt].list = &elf->state.elf32.scns; + + /* If this is a section with an extended index add a + reference in the section which uses the extended + index. */ + if (elf->state.elf32.shdr[cnt].sh_type == SHT_SYMTAB_SHNDX + && elf->state.elf32.shdr[cnt].sh_link < scncnt) + elf->state.elf32.scns.data[elf->state.elf32.shdr[cnt].sh_link].shndx_index + = cnt; + + /* Set the own shndx_index field in case it has not yet + been set. */ + if (elf->state.elf32.scns.data[cnt].shndx_index == 0) + elf->state.elf32.scns.data[cnt].shndx_index = -1; } } else { - /* Read the data. */ - if (pread (elf->fildes, &elf->state.elf32.ehdr_mem, - sizeof (Elf32_Ehdr), offset) != sizeof (Elf32_Ehdr)) - { - /* We must be able to read the ELF header. */ - __libelf_seterrno (ELF_E_INVALID_FILE); - return NULL; - } + /* Copy the ELF header. */ + elf->state.elf32.ehdr = memcpy (&elf->state.elf32.ehdr_mem, e_ident, + sizeof (Elf32_Ehdr)); if (e_ident[EI_DATA] != MY_ELFDATA) { @@ -307,9 +374,7 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, CONVERT (elf->state.elf32.ehdr_mem.e_shstrndx); } - elf->state.elf32.ehdr = &elf->state.elf32.ehdr_mem; - - for (cnt = 0; cnt < scncnt; ++cnt) + for (size_t cnt = 0; cnt < scncnt; ++cnt) { elf->state.elf32.scns.data[cnt].index = cnt; elf->state.elf32.scns.data[cnt].elf = elf; @@ -325,7 +390,6 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, /* This pointer might not be directly usable if the alignment is not sufficient for the architecture. */ Elf64_Ehdr *ehdr = (Elf64_Ehdr *) ((char *) map_address + offset); - size_t cnt; assert ((unsigned int) scncnt == scncnt); elf->state.elf64.scns.cnt = elf->state.elf64.scns.max = scncnt; @@ -340,19 +404,16 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, & (__alignof__ (Elf64_Phdr) - 1)) == 0))) { /* We can use the mmapped memory. */ - elf->state.elf64.ehdr = - (Elf64_Ehdr *) ((char *) map_address + offset); - elf->state.elf64.shdr = - (Elf64_Shdr *) ((char *) map_address + offset - + elf->state.elf64.ehdr->e_shoff); - if (elf->state.elf64.ehdr->e_phnum) + elf->state.elf64.ehdr = ehdr; + elf->state.elf64.shdr + = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff); + if (ehdr->e_phnum > 0) /* Assign a value only if there really is a program header. Otherwise the value remains NULL. */ elf->state.elf64.phdr - = (Elf64_Phdr *) ((char *) map_address + offset - + elf->state.elf64.ehdr->e_phoff); + = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff); - for (cnt = 0; cnt < scncnt; ++cnt) + for (size_t cnt = 0; cnt < scncnt; ++cnt) { elf->state.elf64.scns.data[cnt].index = cnt; elf->state.elf64.scns.data[cnt].elf = elf; @@ -363,18 +424,26 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, ((char *) map_address + offset + elf->state.elf64.shdr[cnt].sh_offset); elf->state.elf64.scns.data[cnt].list = &elf->state.elf64.scns; + + /* If this is a section with an extended index add a + reference in the section which uses the extended + index. */ + if (elf->state.elf64.shdr[cnt].sh_type == SHT_SYMTAB_SHNDX + && elf->state.elf64.shdr[cnt].sh_link < scncnt) + elf->state.elf64.scns.data[elf->state.elf64.shdr[cnt].sh_link].shndx_index + = cnt; + + /* Set the own shndx_index field in case it has not yet + been set. */ + if (elf->state.elf64.scns.data[cnt].shndx_index == 0) + elf->state.elf64.scns.data[cnt].shndx_index = -1; } } else { - /* Read the data. */ - if (pread (elf->fildes, &elf->state.elf64.ehdr_mem, - sizeof (Elf64_Ehdr), offset) != sizeof (Elf64_Ehdr)) - { - /* We must be able to read the ELF header. */ - __libelf_seterrno (ELF_E_INVALID_FILE); - return NULL; - } + /* Copy the ELF header. */ + elf->state.elf64.ehdr = memcpy (&elf->state.elf64.ehdr_mem, e_ident, + sizeof (Elf64_Ehdr)); if (e_ident[EI_DATA] != MY_ELFDATA) { @@ -393,9 +462,7 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, CONVERT (elf->state.elf64.ehdr_mem.e_shstrndx); } - elf->state.elf64.ehdr = &elf->state.elf64.ehdr_mem; - - for (cnt = 0; cnt < scncnt; ++cnt) + for (size_t cnt = 0; cnt < scncnt; ++cnt) { elf->state.elf64.scns.data[cnt].index = cnt; elf->state.elf64.scns.data[cnt].elf = elf; @@ -407,15 +474,12 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize, elf->state.elf64.scns_last = &elf->state.elf64.scns; } - /* Make the class easily available. */ - elf->class = e_ident[EI_CLASS]; - return elf; } Elf * -internal_function_def +internal_function __libelf_read_mmaped_file (int fildes, void *map_address, off_t offset, size_t maxsize, Elf_Cmd cmd, Elf *parent) { @@ -423,15 +487,16 @@ __libelf_read_mmaped_file (int fildes, void *map_address, off_t offset, files and archives. To find out what we have we must look at the header. The header for an ELF file is EI_NIDENT bytes in size, the header for an archive file SARMAG bytes long. */ - Elf_Kind kind; + unsigned char *e_ident = (unsigned char *) map_address + offset; /* See what kind of object we have here. */ - kind = determine_kind (map_address + offset, maxsize); + Elf_Kind kind = determine_kind (e_ident, maxsize); switch (kind) { case ELF_K_ELF: - return file_read_elf (fildes, map_address, offset, maxsize, cmd, parent); + return file_read_elf (fildes, map_address, e_ident, offset, maxsize, + cmd, parent); case ELF_K_AR: return file_read_ar (fildes, map_address, offset, maxsize, cmd, parent); @@ -453,25 +518,33 @@ read_unmmaped_file (int fildes, off_t offset, size_t maxsize, Elf_Cmd cmd, { /* We have to find out what kind of file this is. We handle ELF files and archives. To find out what we have we must read the - header. The header for an ELF file is EI_NIDENT bytes in size, - the header for an archive file SARMAG bytes long. Read the - maximum of these numbers. + header. The identification header for an ELF file is EI_NIDENT + bytes in size, but we read the whole ELF header since we will + need it anyway later. For archives the header in SARMAG bytes + long. Read the maximum of these numbers. - XXX We have to change this for the extended `ar' format some day. */ - unsigned char header[MAX (EI_NIDENT, SARMAG)]; - ssize_t nread; - Elf_Kind kind; + XXX We have to change this for the extended `ar' format some day. + + Use a union to ensure alignment. We might later access the + memory as a ElfXX_Ehdr. */ + union + { + Elf64_Ehdr ehdr; + unsigned char header[MAX (sizeof (Elf64_Ehdr), SARMAG)]; + } mem; /* Read the head of the file. */ - nread = pread (fildes, header, MIN (MAX (EI_NIDENT, SARMAG), maxsize), - offset); - if (nread == -1) + ssize_t nread = pread_retry (fildes, mem.header, + MIN (MAX (sizeof (Elf64_Ehdr), SARMAG), + maxsize), + offset); + if (unlikely (nread == -1)) /* We cannot even read the head of the file. Maybe FILDES is associated with an unseekable device. This is nothing we can handle. */ return NULL; /* See what kind of object we have here. */ - kind = determine_kind (header, nread); + Elf_Kind kind = determine_kind (mem.header, nread); switch (kind) { @@ -480,9 +553,10 @@ read_unmmaped_file (int fildes, off_t offset, size_t maxsize, Elf_Cmd cmd, case ELF_K_ELF: /* Make sure at least the ELF header is contained in the file. */ - if (maxsize >= (header[EI_CLASS] == ELFCLASS32 - ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr))) - return file_read_elf (fildes, NULL, offset, maxsize, cmd, parent); + if ((size_t) nread >= (mem.header[EI_CLASS] == ELFCLASS32 + ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr))) + return file_read_elf (fildes, NULL, mem.header, offset, maxsize, cmd, + parent); /* FALLTHROUGH */ default: @@ -506,6 +580,11 @@ read_file (int fildes, off_t offset, size_t maxsize, || cmd == ELF_C_WRITE_MMAP || cmd == ELF_C_READ_MMAP_PRIVATE); +#if _MUDFLAP + /* Mudflap doesn't grok that our mmap'd data is ok. */ + use_mmap = 0; +#endif + if (use_mmap) { if (parent == NULL) @@ -527,6 +606,7 @@ read_file (int fildes, off_t offset, size_t maxsize, ? PROT_READ : PROT_READ|PROT_WRITE), cmd == ELF_C_READ_MMAP_PRIVATE + || cmd == ELF_C_READ_MMAP ? MAP_PRIVATE : MAP_SHARED, fildes, offset); @@ -545,10 +625,11 @@ read_file (int fildes, off_t offset, size_t maxsize, /* If we have the file in memory optimize the access. */ if (map_address != NULL) { - struct Elf *result; + assert (map_address != MAP_FAILED); - result = __libelf_read_mmaped_file (fildes, map_address, offset, maxsize, - cmd, parent); + struct Elf *result = __libelf_read_mmaped_file (fildes, map_address, + offset, maxsize, cmd, + parent); /* If something went wrong during the initialization unmap the memory if we mmaped here. */ @@ -592,8 +673,9 @@ read_long_names (Elf *elf) else { /* Read the header from the file. */ - if (pread (elf->fildes, &hdrm, sizeof (hdrm), - elf->start_offset + offset) != sizeof (hdrm)) + if (unlikely (pread_retry (elf->fildes, &hdrm, sizeof (hdrm), + elf->start_offset + offset) + != sizeof (hdrm))) return NULL; hdr = &hdrm; @@ -623,10 +705,10 @@ read_long_names (Elf *elf) len); else { - if ((size_t) pread (elf->fildes, newp, len, - elf->start_offset + offset - + sizeof (struct ar_hdr)) - != len) + if (unlikely ((size_t) pread_retry (elf->fildes, newp, len, + elf->start_offset + offset + + sizeof (struct ar_hdr)) + != len)) { /* We were not able to read all data. */ free (newp); @@ -650,7 +732,7 @@ read_long_names (Elf *elf) /* NUL-terminate the string. */ *runp = '\0'; - /* Skip the NUL bzte and the \012. */ + /* Skip the NUL byte and the \012. */ runp += 2; /* A sanity check. Somebody might have generated invalid @@ -666,8 +748,8 @@ read_long_names (Elf *elf) /* Read the next archive header. */ int -internal_function_def -__libelf_next_arhdr (elf) +internal_function +__libelf_next_arhdr_wrlock (elf) Elf *elf; { struct ar_hdr *ar_hdr; @@ -676,8 +758,8 @@ __libelf_next_arhdr (elf) if (elf->map_address != NULL) { /* See whether this entry is in the file. */ - if (elf->state.ar.offset + sizeof (struct ar_hdr) - > elf->start_offset + elf->maximum_size) + if (unlikely (elf->state.ar.offset + sizeof (struct ar_hdr) + > elf->start_offset + elf->maximum_size)) { /* This record is not anymore in the file. */ __libelf_seterrno (ELF_E_RANGE); @@ -689,9 +771,9 @@ __libelf_next_arhdr (elf) { ar_hdr = &elf->state.ar.ar_hdr; - if (pread (elf->fildes, ar_hdr, sizeof (struct ar_hdr), - elf->state.ar.offset) - != sizeof (struct ar_hdr)) + if (unlikely (pread_retry (elf->fildes, ar_hdr, sizeof (struct ar_hdr), + elf->state.ar.offset) + != sizeof (struct ar_hdr))) { /* Something went wrong while reading the file. */ __libelf_seterrno (ELF_E_RANGE); @@ -700,7 +782,7 @@ __libelf_next_arhdr (elf) } /* One little consistency check. */ - if (memcmp (ar_hdr->ar_fmag, ARFMAG, 2) != 0) + if (unlikely (memcmp (ar_hdr->ar_fmag, ARFMAG, 2) != 0)) { /* This is no valid archive. */ __libelf_seterrno (ELF_E_ARCHIVE_FMAG); @@ -724,14 +806,14 @@ __libelf_next_arhdr (elf) && memcmp (ar_hdr->ar_name, "// ", 16) == 0) /* This is the array with the long names. */ elf_ar_hdr->ar_name = memcpy (elf->state.ar.ar_name, "//", 3); - else if (isdigit (ar_hdr->ar_name[1])) + else if (likely (isdigit (ar_hdr->ar_name[1]))) { size_t offset; /* This is a long name. First we have to read the long name table, if this hasn't happened already. */ - if (elf->state.ar.long_names == NULL - && read_long_names (elf) == NULL) + if (unlikely (elf->state.ar.long_names == NULL + && read_long_names (elf) == NULL)) { /* No long name table although it is reference. The archive is broken. */ @@ -740,7 +822,7 @@ __libelf_next_arhdr (elf) } offset = atol (ar_hdr->ar_name + 1); - if (offset >= elf->state.ar.long_names_len) + if (unlikely (offset >= elf->state.ar.long_names_len)) { /* The index in the long name table is larger than the table. */ __libelf_seterrno (ELF_E_INVALID_ARCHIVE); @@ -765,117 +847,57 @@ __libelf_next_arhdr (elf) if (endp != NULL) endp[-1] = '\0'; else - elf->state.ar.raw_name[16] = '\0'; + { + /* In the old BSD style of archive, there is no / terminator. + Instead, there is space padding at the end of the name. */ + size_t i = 15; + do + elf->state.ar.ar_name[i] = '\0'; + while (i > 0 && elf->state.ar.ar_name[--i] == ' '); + } elf_ar_hdr->ar_name = elf->state.ar.ar_name; } + if (unlikely (ar_hdr->ar_size[0] == ' ')) + /* Something is really wrong. We cannot live without a size for + the member since it will not be possible to find the next + archive member. */ + { + __libelf_seterrno (ELF_E_INVALID_ARCHIVE); + return -1; + } + /* Since there are no specialized functions to convert ASCII to time_t, uid_t, gid_t, mode_t, and off_t we use either atol or atoll depending on the size of the types. We are also prepared for the case where the whole field in the `struct ar_hdr' is filled in which case we cannot simply use atol/l but instead have to create a temporary copy. */ - if (ar_hdr->ar_date[sizeof (ar_hdr->ar_date) - 1] == ' ') - { - if (ar_hdr->ar_date[0] == ' ') - elf_ar_hdr->ar_date = 0; - else - elf_ar_hdr->ar_date = (sizeof (time_t) <= sizeof (long int) - ? (time_t) atol (ar_hdr->ar_date) - : (time_t) atoll (ar_hdr->ar_date)); - } - else - { - char buf[sizeof (ar_hdr->ar_date) + 1]; - *((char *) __mempcpy (buf, ar_hdr->ar_date, sizeof (ar_hdr->ar_date))) - = '\0'; - elf_ar_hdr->ar_date = (sizeof (time_t) <= sizeof (long int) - ? (time_t) atol (ar_hdr->ar_date) - : (time_t) atoll (ar_hdr->ar_date)); - } - if (ar_hdr->ar_uid[sizeof (ar_hdr->ar_uid) - 1] == ' ') - { - if (ar_hdr->ar_uid[0] == ' ') - elf_ar_hdr->ar_uid = 0; - else - elf_ar_hdr->ar_uid = (sizeof (uid_t) <= sizeof (long int) - ? (uid_t) atol (ar_hdr->ar_uid) - : (uid_t) atoll (ar_hdr->ar_uid)); - } - else - { - char buf[sizeof (ar_hdr->ar_uid) + 1]; - *((char *) __mempcpy (buf, ar_hdr->ar_uid, sizeof (ar_hdr->ar_uid))) - = '\0'; - elf_ar_hdr->ar_uid = (sizeof (uid_t) <= sizeof (long int) - ? (uid_t) atol (ar_hdr->ar_uid) - : (uid_t) atoll (ar_hdr->ar_uid)); - } - - if (ar_hdr->ar_gid[sizeof (ar_hdr->ar_gid) - 1] == ' ') - { - if (ar_hdr->ar_gid[0] == ' ') - elf_ar_hdr->ar_gid = 0; - else - elf_ar_hdr->ar_gid = (sizeof (gid_t) <= sizeof (long int) - ? (gid_t) atol (ar_hdr->ar_gid) - : (gid_t) atoll (ar_hdr->ar_gid)); - } - else - { - char buf[sizeof (ar_hdr->ar_gid) + 1]; - *((char *) __mempcpy (buf, ar_hdr->ar_gid, sizeof (ar_hdr->ar_gid))) - = '\0'; - elf_ar_hdr->ar_gid = (sizeof (gid_t) <= sizeof (long int) - ? (gid_t) atol (ar_hdr->ar_gid) - : (gid_t) atoll (ar_hdr->ar_gid)); - } - - if (ar_hdr->ar_mode[sizeof (ar_hdr->ar_mode) - 1] == ' ') - { - if (ar_hdr->ar_mode[0] == ' ') - elf_ar_hdr->ar_mode = 0; - else - elf_ar_hdr->ar_mode = (sizeof (mode_t) <= sizeof (long int) - ? (mode_t) strtol (ar_hdr->ar_mode, NULL, 8) - : (mode_t) strtoll (ar_hdr->ar_mode, NULL, 8)); - } - else - { - char buf[sizeof (ar_hdr->ar_mode) + 1]; - *((char *) __mempcpy (buf, ar_hdr->ar_mode, sizeof (ar_hdr->ar_mode))) - = '\0'; - elf_ar_hdr->ar_mode = (sizeof (mode_t) <= sizeof (long int) - ? (mode_t) strtol (ar_hdr->ar_mode, NULL, 8) - : (mode_t) strtoll (ar_hdr->ar_mode, NULL, 8)); - } - - if (ar_hdr->ar_size[sizeof (ar_hdr->ar_size) - 1] == ' ') - { - if (ar_hdr->ar_size[0] == ' ') - /* Something is really wrong. We cannot live without a size for - the member since it will not be possible to find the next - archive member. */ - { - __libelf_seterrno (ELF_E_INVALID_ARCHIVE); - return -1; - } - else - elf_ar_hdr->ar_size = (sizeof (time_t) == sizeof (long int) - ? (off_t) atol (ar_hdr->ar_size) - : (off_t) atoll (ar_hdr->ar_size)); - } - else - { - char buf[sizeof (ar_hdr->ar_size) + 1]; - *((char *) __mempcpy (buf, ar_hdr->ar_size, sizeof (ar_hdr->ar_size))) - = '\0'; - elf_ar_hdr->ar_size = (sizeof (time_t) == sizeof (long int) - ? (off_t) atol (ar_hdr->ar_size) - : (off_t) atoll (ar_hdr->ar_size)); - } +#define INT_FIELD(FIELD) \ + do \ + { \ + char buf[sizeof (ar_hdr->FIELD) + 1]; \ + const char *string = ar_hdr->FIELD; \ + if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] != ' ') \ + { \ + *((char *) __mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \ + = '\0'; \ + string = buf; \ + } \ + if (sizeof (elf_ar_hdr->FIELD) <= sizeof (long int)) \ + elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atol (string); \ + else \ + elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atoll (string); \ + } \ + while (0) + + INT_FIELD (ar_date); + INT_FIELD (ar_uid); + INT_FIELD (ar_gid); + INT_FIELD (ar_mode); + INT_FIELD (ar_size); return 0; } @@ -894,7 +916,7 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref) fildes = ref->fildes; /* The file descriptor better should be the same. If it was disconnected already (using `elf_cntl') we do not test it. */ - else if (ref->fildes != -1 && fildes != ref->fildes) + else if (unlikely (ref->fildes != -1 && fildes != ref->fildes)) { __libelf_seterrno (ELF_E_FD_MISMATCH); return NULL; @@ -903,10 +925,10 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref) /* The mode must allow reading. I.e., a descriptor creating with a command different then ELF_C_READ, ELF_C_WRITE and ELF_C_RDWR is not allowed. */ - if (ref->cmd != ELF_C_READ && ref->cmd != ELF_C_READ_MMAP - && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP - && ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP - && ref->cmd != ELF_C_READ_MMAP_PRIVATE) + if (unlikely (ref->cmd != ELF_C_READ && ref->cmd != ELF_C_READ_MMAP + && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP + && ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP + && ref->cmd != ELF_C_READ_MMAP_PRIVATE)) { __libelf_seterrno (ELF_E_INVALID_OP); return NULL; @@ -926,7 +948,7 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref) pointing to. First read the header of the next member if this has not happened already. */ if (ref->state.ar.elf_ar_hdr.ar_name == NULL - && __libelf_next_arhdr (ref) != 0) + && __libelf_next_arhdr_wrlock (ref) != 0) /* Something went wrong. Maybe there is no member left. */ return NULL; @@ -983,7 +1005,7 @@ elf_begin (fildes, cmd, ref) { Elf *retval; - if (! __libelf_version_initialized) + if (unlikely (! __libelf_version_initialized)) { /* Version wasn't set so far. */ __libelf_seterrno (ELF_E_NO_VERSION); @@ -993,13 +1015,26 @@ elf_begin (fildes, cmd, ref) if (ref != NULL) /* Make sure the descriptor is not suddenly going away. */ rwlock_rdlock (ref->lock); - else if (fcntl (fildes, F_GETFL) == -1 && errno == EBADF) + else if (unlikely (fcntl (fildes, F_GETFL) == -1 && errno == EBADF)) { /* We cannot do anything productive without a file descriptor. */ __libelf_seterrno (ELF_E_INVALID_FILE); return NULL; } + Elf *lock_dup_elf () + { + /* We need wrlock to dup an archive. */ + if (ref->kind == ELF_K_AR) + { + rwlock_unlock (ref->lock); + rwlock_wrlock (ref->lock); + } + + /* Duplicate the descriptor. */ + return dup_elf (fildes, cmd, ref); + } + switch (cmd) { case ELF_C_NULL: @@ -1009,7 +1044,7 @@ elf_begin (fildes, cmd, ref) case ELF_C_READ_MMAP_PRIVATE: /* If we have a reference it must also be opened this way. */ - if (ref != NULL && ref->cmd != ELF_C_READ_MMAP_PRIVATE) + if (unlikely (ref != NULL && ref->cmd != ELF_C_READ_MMAP_PRIVATE)) { __libelf_seterrno (ELF_E_INVALID_CMD); retval = NULL; @@ -1020,8 +1055,7 @@ elf_begin (fildes, cmd, ref) case ELF_C_READ: case ELF_C_READ_MMAP: if (ref != NULL) - /* Duplicate the descriptor. */ - retval = dup_elf (fildes, cmd, ref); + retval = lock_dup_elf (); else /* Create descriptor for existing file. */ retval = read_file (fildes, 0, ~((size_t) 0), cmd, NULL); @@ -1033,16 +1067,16 @@ elf_begin (fildes, cmd, ref) command. */ if (ref != NULL) { - if (ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP - && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP) + if (unlikely (ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP + && ref->cmd != ELF_C_WRITE + && ref->cmd != ELF_C_WRITE_MMAP)) { /* This is not ok. REF must also be opened for writing. */ __libelf_seterrno (ELF_E_INVALID_CMD); retval = NULL; } else - /* Duplicate this descriptor. */ - retval = dup_elf (fildes, cmd, ref); + retval = lock_dup_elf (); } else /* Create descriptor for existing file. */ diff --git a/libelf/elf_clone.c b/libelf/elf_clone.c index 516d2ae4..8b699fa6 100644 --- a/libelf/elf_clone.c +++ b/libelf/elf_clone.c @@ -1,19 +1,52 @@ /* Create clone of a given descriptor. Copyright (C) 2003, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c index eea0f362..fd5b47b9 100644 --- a/libelf/elf_cntl.c +++ b/libelf/elf_cntl.c @@ -1,19 +1,52 @@ /* Control an ELF file desrciptor. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_end.c b/libelf/elf_end.c index 086ff633..5112eaea 100644 --- a/libelf/elf_end.c +++ b/libelf/elf_end.c @@ -1,19 +1,52 @@ /* Free resources associated with Elf descriptor. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 1998,1999,2000,2001,2002,2004,2005,2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -56,7 +89,8 @@ elf_end (elf) descriptor. The long name table cannot be freed yet since the archive headers for the ELF files in the archive point into this array. */ - free (elf->state.ar.ar_sym); + if (elf->state.ar.ar_sym != (Elf_Arsym *) -1l) + free (elf->state.ar.ar_sym); elf->state.ar.ar_sym = NULL; if (elf->state.ar.children != NULL) @@ -101,6 +135,21 @@ elf_end (elf) case ELF_K_ELF: { + Elf_Data_Chunk *rawchunks + = (elf->class == ELFCLASS32 + || (offsetof (struct Elf, state.elf32.rawchunks) + == offsetof (struct Elf, state.elf64.rawchunks)) + ? elf->state.elf32.rawchunks + : elf->state.elf64.rawchunks); + while (rawchunks != NULL) + { + Elf_Data_Chunk *next = rawchunks->next; + if (rawchunks->dummy_scn.flags & ELF_F_MALLOCED) + free (rawchunks->data.d.d_buf); + free (rawchunks); + rawchunks = next; + } + Elf_ScnList *list = (elf->class == ELFCLASS32 || (offsetof (struct Elf, state.elf32.scns) == offsetof (struct Elf, state.elf64.scns)) @@ -197,5 +246,7 @@ elf_end (elf) /* Finally the descriptor itself. */ free (elf); - return parent != NULL && parent->ref_count == 0 ? elf_end (parent) : 0; + return (parent != NULL && parent->ref_count == 0 + ? INTUSE(elf_end) (parent) : 0); } +INTDEF(elf_end) diff --git a/libelf/elf_error.c b/libelf/elf_error.c index acbe406c..5e00372a 100644 --- a/libelf/elf_error.c +++ b/libelf/elf_error.c @@ -1,26 +1,59 @@ /* Error handling in libelf. - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> -//#include <libintl.h> +#include <libintl.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> @@ -237,12 +270,19 @@ static const char msgstr[] = #define ELF_E_INVALID_PHDR_IDX \ (ELF_E_GROUP_NOT_REL_IDX \ + sizeof "only relocatable files can contain section groups") - N_("program header only allowed in executables and shared objects") + N_("program header only allowed in executables, shared objects, and \ +core files") "\0" #define ELF_E_NO_PHDR_IDX \ (ELF_E_INVALID_PHDR_IDX \ - + sizeof "program header only allowed in executables and shared objects") + + sizeof "program header only allowed in executables, shared objects, and \ +core files") N_("file has no program header") + "\0" +#define ELF_E_INVALID_OFFSET_IDX \ + (ELF_E_NO_PHDR_IDX \ + + sizeof "file has no program header") + N_("invalid offset") }; @@ -289,7 +329,8 @@ static const uint_fast16_t msgidx[ELF_E_NUM] = [ELF_E_NOFILE] = ELF_E_NOFILE_IDX, [ELF_E_GROUP_NOT_REL] = ELF_E_GROUP_NOT_REL_IDX, [ELF_E_INVALID_PHDR] = ELF_E_INVALID_PHDR_IDX, - [ELF_E_NO_PHDR] = ELF_E_NO_PHDR_IDX + [ELF_E_NO_PHDR] = ELF_E_NO_PHDR_IDX, + [ELF_E_INVALID_OFFSET] = ELF_E_INVALID_OFFSET_IDX }; #define nmsgidx ((int) (sizeof (msgidx) / sizeof (msgidx[0]))) @@ -346,7 +387,7 @@ elf_errmsg (error) #ifndef USE_TLS /* Free the thread specific data, this is done if a thread terminates. */ static void -free_key_mem (void *mem) +free_key_mem (void *mem __attribute__ ((unused))) { setspecific (key, NULL); } diff --git a/libelf/elf_fill.c b/libelf/elf_fill.c index 2880c2ed..ae69951b 100644 --- a/libelf/elf_fill.c +++ b/libelf/elf_fill.c @@ -1,19 +1,52 @@ /* Set fill byte used when constructing ELF objects. Copyright (C) 1998, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -23,7 +56,9 @@ #include "libelfP.h" -extern int __libelf_fill_byte = 0; + +int __libelf_fill_byte; + void elf_fill (fill) diff --git a/libelf/elf_flagdata.c b/libelf/elf_flagdata.c index b5191316..a2cbdd9a 100644 --- a/libelf/elf_flagdata.c +++ b/libelf/elf_flagdata.c @@ -1,19 +1,52 @@ /* Manipulate ELF data flag. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_flagehdr.c b/libelf/elf_flagehdr.c index 2099fc51..499cf1da 100644 --- a/libelf/elf_flagehdr.c +++ b/libelf/elf_flagehdr.c @@ -1,19 +1,52 @@ /* Manipulate ELF header flags. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_flagelf.c b/libelf/elf_flagelf.c index 3a001f67..4ea45001 100644 --- a/libelf/elf_flagelf.c +++ b/libelf/elf_flagelf.c @@ -1,19 +1,52 @@ /* Manipulate ELF file flags. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_flagphdr.c b/libelf/elf_flagphdr.c index c2f8794d..de1bccf5 100644 --- a/libelf/elf_flagphdr.c +++ b/libelf/elf_flagphdr.c @@ -1,19 +1,52 @@ /* Manipulate ELF program header flags. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_flagscn.c b/libelf/elf_flagscn.c index 9cd1cc40..f4dba959 100644 --- a/libelf/elf_flagscn.c +++ b/libelf/elf_flagscn.c @@ -1,19 +1,52 @@ /* Manipulate ELF section flags. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_flagshdr.c b/libelf/elf_flagshdr.c index 0972d27f..de645bbd 100644 --- a/libelf/elf_flagshdr.c +++ b/libelf/elf_flagshdr.c @@ -1,19 +1,52 @@ /* Manipulate ELF section header flags. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c index da0b4a42..61e4e0a2 100644 --- a/libelf/elf_getarhdr.c +++ b/libelf/elf_getarhdr.c @@ -1,19 +1,52 @@ /* Read header of next archive member. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -30,6 +63,9 @@ Elf_Arhdr * elf_getarhdr (elf) Elf *elf; { + if (elf == NULL) + return NULL; + Elf *parent = elf->parent; /* Calling this function is not ok for any file type but archives. */ @@ -41,10 +77,16 @@ elf_getarhdr (elf) /* Make sure we have read the archive header. */ if (parent->state.ar.elf_ar_hdr.ar_name == NULL - && __libelf_next_arhdr (parent) != 0) - /* Something went wrong. Maybe there is no member left. */ - return NULL; + && __libelf_next_arhdr_wrlock (parent) != 0) + { + rwlock_wrlock (parent->lock); + int st = __libelf_next_arhdr_wrlock (parent); + rwlock_unlock (parent->lock); + if (st != 0) + /* Something went wrong. Maybe there is no member left. */ + return NULL; + } /* We can be sure the parent is an archive. */ assert (parent->kind == ELF_K_AR); diff --git a/libelf/elf_getaroff.c b/libelf/elf_getaroff.c new file mode 100644 index 00000000..8dea0614 --- /dev/null +++ b/libelf/elf_getaroff.c @@ -0,0 +1,75 @@ +/* Return offset in archive for current file ELF. + Copyright (C) 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <libelf.h> +#include <stddef.h> + +#include "libelfP.h" + + +off_t +elf_getaroff (elf) + Elf *elf; +{ + /* Be gratious, the specs demand it. */ + if (elf == NULL || elf->parent == NULL) + return ELF_C_NULL; + + /* We can be sure the parent is an archive. */ + Elf *parent = elf->parent; + assert (parent->kind == ELF_K_AR); + + return elf->start_offset - sizeof (struct ar_hdr) - parent->start_offset; +} diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 33e4bff4..e6ecaadc 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -1,32 +1,67 @@ /* Return symbol table of archive. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> -//#include <byteswap.h> -//#include <endian.h> +#include <byteswap.h> +#include <endian.h> +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <system.h> #include <dl-hash.h> #include "libelfP.h" @@ -36,8 +71,6 @@ elf_getarsym (elf, ptr) Elf *elf; size_t *ptr; { - Elf_Arsym *result; - if (elf->kind != ELF_K_AR) { /* This is no archive. */ @@ -57,29 +90,22 @@ elf_getarsym (elf, ptr) return NULL; } - result = elf->state.ar.ar_sym; + Elf_Arsym *result = elf->state.ar.ar_sym; if (result == NULL) { /* We have not yet read the index. */ - struct ar_hdr *index_hdr; - uint32_t n; - size_t index_size; - char tmpbuf[17]; - size_t ar_sym_len; - Elf_Arsym *arsym; - size_t cnt; - rwlock_wrlock (elf->lock); /* In case we find no index remember this for the next call. */ elf->state.ar.ar_sym = (Elf_Arsym *) -1l; + struct ar_hdr *index_hdr; if (elf->map_address == NULL) { /* We must read index from the file. */ assert (elf->fildes != -1); - if (pread (elf->fildes, &elf->state.ar.ar_hdr, - sizeof (struct ar_hdr), elf->start_offset + SARMAG) + if (pread_retry (elf->fildes, &elf->state.ar.ar_hdr, + sizeof (struct ar_hdr), elf->start_offset + SARMAG) != sizeof (struct ar_hdr)) { /* It is not possible to read the index. Maybe it does not @@ -126,10 +152,11 @@ elf_getarsym (elf, ptr) /* We have an archive. The first word in there is the number of entries in the table. */ + uint32_t n; if (elf->map_address == NULL) { - if (pread (elf->fildes, &n, sizeof (n), - elf->start_offset + SARMAG + sizeof (struct ar_hdr)) + if (pread_retry (elf->fildes, &n, sizeof (n), + elf->start_offset + SARMAG + sizeof (struct ar_hdr)) != sizeof (n)) { /* Cannot read the number of entries. */ @@ -146,9 +173,10 @@ elf_getarsym (elf, ptr) /* Now we can perform some first tests on whether all the data needed for the index is available. */ + char tmpbuf[17]; memcpy (tmpbuf, index_hdr->ar_size, 10); tmpbuf[10] = '\0'; - index_size = atol (tmpbuf); + size_t index_size = atol (tmpbuf); if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size || n * sizeof (uint32_t) > index_size) @@ -160,7 +188,7 @@ elf_getarsym (elf, ptr) } /* Now we can allocate the arrays needed to store the index. */ - ar_sym_len = (n + 1) * sizeof (Elf_Arsym); + size_t ar_sym_len = (n + 1) * sizeof (Elf_Arsym); elf->state.ar.ar_sym = (Elf_Arsym *) malloc (ar_sym_len); if (elf->state.ar.ar_sym != NULL) { @@ -169,14 +197,11 @@ elf_getarsym (elf, ptr) if (elf->map_address == NULL) { - char *new_str; - Elf_Arsym *newp; - file_data = (uint32_t *) alloca (n * sizeof (uint32_t)); ar_sym_len += index_size - n * sizeof (uint32_t); - newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym, - ar_sym_len); + Elf_Arsym *newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym, + ar_sym_len); if (newp == NULL) { free (elf->state.ar.ar_sym); @@ -186,18 +211,20 @@ elf_getarsym (elf, ptr) } elf->state.ar.ar_sym = newp; - new_str = (char *) (elf->state.ar.ar_sym + n + 1); + char *new_str = (char *) (elf->state.ar.ar_sym + n + 1); /* Now read the data from the file. */ - if ((size_t) pread (elf->fildes, file_data, - n * sizeof (uint32_t), elf->start_offset - + SARMAG + sizeof (struct ar_hdr) - + sizeof (uint32_t)) != n * sizeof (uint32_t) - || ((size_t) pread (elf->fildes, new_str, - index_size - n * sizeof (uint32_t), - elf->start_offset - + SARMAG + sizeof (struct ar_hdr) - + (n + 1) * sizeof (uint32_t)) + if ((size_t) pread_retry (elf->fildes, file_data, + n * sizeof (uint32_t), + elf->start_offset + SARMAG + + sizeof (struct ar_hdr) + + sizeof (uint32_t)) + != n * sizeof (uint32_t) + || ((size_t) pread_retry (elf->fildes, new_str, + index_size - n * sizeof (uint32_t), + elf->start_offset + + SARMAG + sizeof (struct ar_hdr) + + (n + 1) * sizeof (uint32_t)) != index_size - n * sizeof (uint32_t))) { /* We were not able to read the data. */ @@ -218,8 +245,8 @@ elf_getarsym (elf, ptr) } /* Now we can build the data structure. */ - arsym = elf->state.ar.ar_sym; - for (cnt = 0; cnt < n; ++cnt) + Elf_Arsym *arsym = elf->state.ar.ar_sym; + for (size_t cnt = 0; cnt < n; ++cnt) { arsym[cnt].as_name = str_data; if (__BYTE_ORDER == __LITTLE_ENDIAN) diff --git a/libelf/elf_getbase.c b/libelf/elf_getbase.c index ea76f416..2b6cf853 100644 --- a/libelf/elf_getbase.c +++ b/libelf/elf_getbase.c @@ -1,19 +1,52 @@ /* Return offset of first byte for the object. Copyright (C) 1998, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c index 2d5f27af..e083b033 100644 --- a/libelf/elf_getdata.c +++ b/libelf/elf_getdata.c @@ -1,132 +1,144 @@ /* Return the next data element from the section after possibly converting it. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 1998-2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <errno.h> #include <stddef.h> #include <string.h> #include <unistd.h> #include "libelfP.h" +#include <system.h> #include "common.h" #include "elf-knowledge.h" -#if _STRING_ARCH_unaligned -# define ALLOW_ALIGNED 1 -#else -# define ALLOW_ALIGNED 0 -#endif - - #define TYPEIDX(Sh_Type) \ (Sh_Type >= SHT_NULL && Sh_Type < SHT_NUM \ ? Sh_Type \ - : (Sh_Type >= SHT_GNU_LIBLIST && Sh_Type <= SHT_HISUNW \ - ? SHT_NUM + Sh_Type - SHT_GNU_LIBLIST \ + : (Sh_Type >= SHT_GNU_HASH && Sh_Type <= SHT_HISUNW \ + ? SHT_NUM + Sh_Type - SHT_GNU_HASH \ : 0)) -static const struct -{ - Elf_Type type; - size_t size; -#if ALLOW_ALIGNED -# define AL(val) -#else - size_t align; -# define AL(val), val -#endif -} shtype_map[EV_NUM - 1][ELFCLASSNUM - 1][TYPEIDX (SHT_HISUNW) + 1] = -{ - [EV_CURRENT - 1] = +/* Associate section types with libelf types. */ +static const Elf_Type shtype_map[EV_NUM - 1][TYPEIDX (SHT_HISUNW) + 1] = { - [ELFCLASS32 - 1] = + [EV_CURRENT - 1] = { - /* Associate section types with libelf types, their sizes and - alignment. SHT_GNU_verdef is special since the section does - not contain entries of only one size. */ -#define DEFINE(Bits) \ - [SHT_SYMTAB] = { ELF_T_SYM, sizeof (ElfW2(Bits,Sym)) \ - AL (__alignof__ (ElfW2(Bits,Sym))) }, \ - [SHT_RELA] = { ELF_T_RELA, sizeof (ElfW2(Bits,Rela)) \ - AL (__alignof__ (ElfW2(Bits,Rela))) }, \ - [SHT_HASH] = { ELF_T_WORD, sizeof (ElfW2(Bits,Word)) \ - AL (__alignof__ (ElfW2(Bits,Word))) }, \ - [SHT_DYNAMIC] = { ELF_T_DYN, sizeof (ElfW2(Bits,Dyn)) \ - AL (__alignof__ (ElfW2(Bits,Dyn))) }, \ - [SHT_REL] = { ELF_T_REL, sizeof (ElfW2(Bits,Rel)) \ - AL (__alignof__ (ElfW2(Bits,Rel))) }, \ - [SHT_DYNSYM] = { ELF_T_SYM, sizeof (ElfW2(Bits,Sym)) \ - AL (__alignof__ (ElfW2(Bits,Sym))) }, \ - [SHT_INIT_ARRAY] = { ELF_T_ADDR, sizeof (ElfW2(Bits,Addr)) \ - AL (__alignof__ (ElfW2(Bits,Addr))) }, \ - [SHT_FINI_ARRAY] = { ELF_T_ADDR, sizeof (ElfW2(Bits,Addr)) \ - AL (__alignof__ (ElfW2(Bits,Addr))) }, \ - [SHT_PREINIT_ARRAY] = { ELF_T_ADDR, sizeof (ElfW2(Bits,Addr)) \ - AL (__alignof__ (ElfW2(Bits,Addr))) }, \ - [SHT_GROUP] = { ELF_T_WORD, sizeof (Elf32_Word) \ - AL (__alignof__ (Elf32_Word)) }, \ - [SHT_SYMTAB_SHNDX] = { ELF_T_WORD, sizeof (Elf32_Word) \ - AL (__alignof__ (Elf32_Word)) }, \ - [TYPEIDX (SHT_GNU_verdef)] = { ELF_T_VDEF, 1 AL (1) }, \ - [TYPEIDX (SHT_GNU_verneed)] = { ELF_T_VNEED, \ - sizeof (ElfW2(Bits,Verneed)) \ - AL (__alignof__ (ElfW2(Bits,Verneed)))},\ - [TYPEIDX (SHT_GNU_versym)] = { ELF_T_HALF, sizeof (ElfW2(Bits,Versym)) \ - AL (__alignof__ (ElfW2(Bits,Versym))) }, \ - [TYPEIDX (SHT_SUNW_syminfo)] = { ELF_T_SYMINFO, \ - sizeof (ElfW2(Bits,Syminfo)) \ - AL(__alignof__ (ElfW2(Bits,Syminfo)))},\ - [TYPEIDX (SHT_SUNW_move)] = { ELF_T_MOVE, sizeof (ElfW2(Bits,Move)) \ - AL (__alignof__ (ElfW2(Bits,Move))) }, \ - [TYPEIDX (SHT_GNU_LIBLIST)] = { ELF_T_LIB, sizeof (ElfW2(Bits,Lib)) \ - AL (__alignof__ (ElfW2(Bits,Lib))) } - DEFINE (32) - }, - [ELFCLASS64 - 1] = + [SHT_SYMTAB] = ELF_T_SYM, + [SHT_RELA] = ELF_T_RELA, + [SHT_HASH] = ELF_T_WORD, + [SHT_DYNAMIC] = ELF_T_DYN, + [SHT_REL] = ELF_T_REL, + [SHT_DYNSYM] = ELF_T_SYM, + [SHT_INIT_ARRAY] = ELF_T_ADDR, + [SHT_FINI_ARRAY] = ELF_T_ADDR, + [SHT_PREINIT_ARRAY] = ELF_T_ADDR, + [SHT_GROUP] = ELF_T_WORD, + [SHT_SYMTAB_SHNDX] = ELF_T_WORD, + [SHT_NOTE] = ELF_T_NHDR, + [TYPEIDX (SHT_GNU_verdef)] = ELF_T_VDEF, + [TYPEIDX (SHT_GNU_verneed)] = ELF_T_VNEED, + [TYPEIDX (SHT_GNU_versym)] = ELF_T_HALF, + [TYPEIDX (SHT_SUNW_syminfo)] = ELF_T_SYMINFO, + [TYPEIDX (SHT_SUNW_move)] = ELF_T_MOVE, + [TYPEIDX (SHT_GNU_LIBLIST)] = ELF_T_LIB, + [TYPEIDX (SHT_GNU_HASH)] = ELF_T_GNUHASH, + } + }; + +#if !ALLOW_UNALIGNED +/* Associate libelf types with their internal alignment requirements. */ +const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] = + { +# define TYPE_ALIGNS(Bits) \ + { \ + [ELF_T_ADDR] = __alignof__ (ElfW2(Bits,Addr)), \ + [ELF_T_HALF] = __alignof__ (ElfW2(Bits,Half)), \ + [ELF_T_WORD] = __alignof__ (ElfW2(Bits,Word)), \ + [ELF_T_SYM] = __alignof__ (ElfW2(Bits,Sym)), \ + [ELF_T_SYMINFO] = __alignof__ (ElfW2(Bits,Syminfo)), \ + [ELF_T_REL] = __alignof__ (ElfW2(Bits,Rel)), \ + [ELF_T_RELA] = __alignof__ (ElfW2(Bits,Rela)), \ + [ELF_T_DYN] = __alignof__ (ElfW2(Bits,Dyn)), \ + [ELF_T_VDEF] = __alignof__ (ElfW2(Bits,Verdef)), \ + [ELF_T_VDAUX] = __alignof__ (ElfW2(Bits,Verdaux)), \ + [ELF_T_VNEED] = __alignof__ (ElfW2(Bits,Verneed)), \ + [ELF_T_VNAUX] = __alignof__ (ElfW2(Bits,Vernaux)), \ + [ELF_T_MOVE] = __alignof__ (ElfW2(Bits,Move)), \ + [ELF_T_LIB] = __alignof__ (ElfW2(Bits,Lib)), \ + [ELF_T_NHDR] = __alignof__ (ElfW2(Bits,Nhdr)), \ + } + [EV_CURRENT - 1] = { - DEFINE (64) + [ELFCLASS32 - 1] = TYPE_ALIGNS (32), + [ELFCLASS64 - 1] = TYPE_ALIGNS (64), } - } -}; +# undef TYPE_ALIGNS + }; +#endif /* Convert the data in the current section. */ static void -convert_data (Elf_Scn *scn, int version, int eclass, int data, - size_t size, size_t type) +convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass, + int data, size_t size, Elf_Type type) { -#if ALLOW_ALIGNED - /* No need to compute the alignment requirement of the host. */ - const size_t align = 1; -#else -# if EV_NUM != 2 - size_t align = shtype_map[__libelf_version - 1][eclass - 1][type].align; -# else - size_t align = shtype_map[0][eclass - 1][type].align; -# endif -#endif + const size_t align = __libelf_type_align (eclass, type); if (data == MY_ELFDATA) { - if (ALLOW_ALIGNED - || (((size_t) ((char *) scn->rawdata_base)) & (align - 1)) == 0) + if (((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0) /* No need to copy, we can use the raw data. */ scn->data_base = scn->rawdata_base; else @@ -176,8 +188,8 @@ convert_data (Elf_Scn *scn, int version, int eclass, int data, /* Store the information for the raw data in the `rawdata' element. */ int -internal_function_def -__libelf_set_rawdata (Elf_Scn *scn) +internal_function +__libelf_set_rawdata_wrlock (Elf_Scn *scn) { size_t offset; size_t size; @@ -187,7 +199,8 @@ __libelf_set_rawdata (Elf_Scn *scn) if (elf->class == ELFCLASS32) { - Elf32_Shdr *shdr = scn->shdr.e32 ?: INTUSE(elf32_getshdr) (scn); + Elf32_Shdr *shdr + = scn->shdr.e32 ?: __elf32_getshdr_wrlock (scn); if (shdr == NULL) /* Something went terribly wrong. */ @@ -200,7 +213,8 @@ __libelf_set_rawdata (Elf_Scn *scn) } else { - Elf64_Shdr *shdr = scn->shdr.e64 ?: INTUSE(elf64_getshdr) (scn); + Elf64_Shdr *shdr + = scn->shdr.e64 ?: __elf64_getshdr_wrlock (scn); if (shdr == NULL) /* Something went terribly wrong. */ @@ -222,16 +236,17 @@ __libelf_set_rawdata (Elf_Scn *scn) if (type == SHT_HASH) { GElf_Ehdr ehdr_mem; - - entsize = SH_ENTSIZE_HASH (gelf_getehdr (elf, &ehdr_mem)); + GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (elf, &ehdr_mem); + entsize = SH_ENTSIZE_HASH (ehdr); } else { -#if EV_NUM != 2 - entsize = shtype_map[__libelf_version - 1][elf->class - 1][TYPEIDX (type)].size; -#else - entsize = shtype_map[0][elf->class - 1][TYPEIDX (type)].size; -#endif + Elf_Type t = shtype_map[LIBELF_EV_IDX][TYPEIDX (type)]; + if (t == ELF_T_VDEF || t == ELF_T_NHDR + || (t == ELF_T_GNUHASH && elf->class == ELFCLASS64)) + entsize = 1; + else + entsize = __libelf_type_sizes[LIBELF_EV_IDX][elf->class - 1][t]; } /* We assume it is an array of bytes if it is none of the structured @@ -239,7 +254,7 @@ __libelf_set_rawdata (Elf_Scn *scn) if (entsize == 0) entsize = 1; - if (size % entsize != 0) + if (unlikely (size % entsize != 0)) { __libelf_seterrno (ELF_E_INVALID_DATA); return 1; @@ -250,7 +265,7 @@ __libelf_set_rawdata (Elf_Scn *scn) { /* First see whether the information in the section header is valid and it does not ask for too much. */ - if (offset + size > elf->maximum_size) + if (unlikely (offset + size > elf->maximum_size)) { /* Something is wrong. */ __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); @@ -260,7 +275,7 @@ __libelf_set_rawdata (Elf_Scn *scn) scn->rawdata_base = scn->rawdata.d.d_buf = (char *) elf->map_address + elf->start_offset + offset; } - else if (elf->fildes != -1) + else if (likely (elf->fildes != -1)) { /* We have to read the data from the file. Allocate the needed memory. */ @@ -272,8 +287,9 @@ __libelf_set_rawdata (Elf_Scn *scn) return 1; } - if ((size_t) pread (elf->fildes, scn->rawdata.d.d_buf, size, - elf->start_offset + offset) != size) + ssize_t n = pread_retry (elf->fildes, scn->rawdata.d.d_buf, size, + elf->start_offset + offset); + if (unlikely ((size_t) n != size)) { /* Cannot read the data. */ free (scn->rawdata.d.d_buf); @@ -297,20 +313,12 @@ __libelf_set_rawdata (Elf_Scn *scn) if (type == SHT_HASH && elf->class == ELFCLASS64) { GElf_Ehdr ehdr_mem; - - scn->rawdata.d.d_type = (SH_ENTSIZE_HASH (gelf_getehdr (elf, &ehdr_mem)) - == 4 ? ELF_T_WORD : ELF_T_XWORD); + GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (elf, &ehdr_mem); + scn->rawdata.d.d_type + = (SH_ENTSIZE_HASH (ehdr) == 4 ? ELF_T_WORD : ELF_T_XWORD); } else - { -#if EV_NUM != 2 - scn->rawdata.d.d_type = - shtype_map[__libelf_version - 1][elf->class - 1][TYPEIDX (type)].type; -#else - scn->rawdata.d.d_type = - shtype_map[0][elf->class - 1][TYPEIDX (type)].type; -#endif - } + scn->rawdata.d.d_type = shtype_map[LIBELF_EV_IDX][TYPEIDX (type)]; scn->rawdata.d.d_off = 0; scn->rawdata.d.d_align = align; if (elf->class == ELFCLASS32 @@ -332,14 +340,31 @@ __libelf_set_rawdata (Elf_Scn *scn) return 0; } +int +internal_function +__libelf_set_rawdata (Elf_Scn *scn) +{ + int result; + + if (scn == NULL) + return 1; + + rwlock_wrlock (scn->elf->lock); + result = __libelf_set_rawdata_wrlock (scn); + rwlock_unlock (scn->elf->lock); + + return result; +} Elf_Data * -elf_getdata (scn, data) +internal_function +__elf_getdata_rdlock (scn, data) Elf_Scn *scn; Elf_Data *data; { Elf_Data *result = NULL; Elf *elf; + int locked = 0; if (scn == NULL) return NULL; @@ -353,8 +378,6 @@ elf_getdata (scn, data) /* We will need this multiple times later on. */ elf = scn->elf; - rwlock_rdlock (elf->lock); - /* If `data' is not NULL this means we are not addressing the initial data in the file. But this also means this data is already read (since otherwise it is not possible to have a valid `data' pointer) @@ -409,11 +432,12 @@ elf_getdata (scn, data) modified, therefore start the tests again. */ rwlock_unlock (elf->lock); rwlock_wrlock (elf->lock); + locked = 1; /* Read the data from the file. There is always a file (or memory region) associated with this descriptor since otherwise the `data_read' flag would be set. */ - if (scn->data_read == 0 && __libelf_set_rawdata (scn) != 0) + if (scn->data_read == 0 && __libelf_set_rawdata_wrlock (scn) != 0) /* Something went wrong. The error value is already set. */ goto out; } @@ -424,15 +448,24 @@ elf_getdata (scn, data) if (scn->data_list_rear == NULL) { if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0) - /* Convert according to the version and the type. */ - convert_data (scn, __libelf_version, elf->class, - (elf->class == ELFCLASS32 - || (offsetof (struct Elf, state.elf32.ehdr) - == offsetof (struct Elf, state.elf64.ehdr)) - ? elf->state.elf32.ehdr->e_ident[EI_DATA] - : elf->state.elf64.ehdr->e_ident[EI_DATA]), - scn->rawdata.d.d_size, - scn->rawdata.d.d_type); + { + if (!locked) + { + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + if (scn->data_list_rear != NULL) + goto pass; + } + + /* Convert according to the version and the type. */ + convert_data (scn, __libelf_version, elf->class, + (elf->class == ELFCLASS32 + || (offsetof (struct Elf, state.elf32.ehdr) + == offsetof (struct Elf, state.elf64.ehdr)) + ? elf->state.elf32.ehdr->e_ident[EI_DATA] + : elf->state.elf64.ehdr->e_ident[EI_DATA]), + scn->rawdata.d.d_size, scn->rawdata.d.d_type); + } else /* This is an empty or NOBITS section. There is no buffer but the size information etc is important. */ @@ -443,11 +476,27 @@ elf_getdata (scn, data) /* If no data is present we cannot return any. */ if (scn->data_list_rear != NULL) + pass: /* Return the first data element in the list. */ result = &scn->data_list.data.d; out: - rwlock_unlock (elf->lock); + return result; +} + +Elf_Data * +elf_getdata (scn, data) + Elf_Scn *scn; + Elf_Data *data; +{ + Elf_Data *result; + + if (scn == NULL) + return NULL; + + rwlock_rdlock (scn->elf->lock); + result = __elf_getdata_rdlock (scn, data); + rwlock_unlock (scn->elf->lock); return result; } diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c new file mode 100644 index 00000000..5af0f7f3 --- /dev/null +++ b/libelf/elf_getdata_rawchunk.c @@ -0,0 +1,197 @@ +/* Return converted data from raw chunk of ELF file. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <system.h> +#include "libelfP.h" +#include "common.h" + +Elf_Data * +elf_getdata_rawchunk (elf, offset, size, type) + Elf *elf; + off64_t offset; + size_t size; + Elf_Type type; +{ + if (unlikely (elf == NULL)) + return NULL; + + if (unlikely (elf->kind != ELF_K_ELF)) + { + /* No valid descriptor. */ + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return NULL; + } + + if (unlikely (size > elf->maximum_size + || (off64_t) (elf->maximum_size - size) < offset)) + { + /* Invalid request. */ + __libelf_seterrno (ELF_E_INVALID_OP); + return NULL; + } + + if (type >= ELF_T_NUM) + { + __libelf_seterrno (ELF_E_UNKNOWN_TYPE); + return NULL; + } + + /* Get the raw bytes from the file. */ + void *rawchunk; + int flags = 0; + Elf_Data *result = NULL; + + rwlock_rdlock (elf->lock); + + /* If the file is mmap'ed we can use it directly. */ + if (elf->map_address != NULL) + rawchunk = elf->map_address + elf->start_offset + offset; + else + { + /* We allocate the memory and read the data from the file. */ + rawchunk = malloc (size); + if (rawchunk == NULL) + { + nomem: + __libelf_seterrno (ELF_E_NOMEM); + goto out; + } + + /* Read the file content. */ + if (unlikely ((size_t) pread_retry (elf->fildes, rawchunk, size, + elf->start_offset + offset) + != size)) + { + /* Something went wrong. */ + free (rawchunk); + __libelf_seterrno (ELF_E_READ_ERROR); + goto out; + } + + flags = ELF_F_MALLOCED; + } + + /* Copy and/or convert the data as needed for aligned native-order access. */ + size_t align = __libelf_type_align (elf->class, type); + void *buffer; + if (elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA) + { + if (((uintptr_t) rawchunk & (align - 1)) == 0) + /* No need to copy, we can use the raw data. */ + buffer = rawchunk; + else + { + /* A malloc'd block is always sufficiently aligned. */ + assert (flags == 0); + + buffer = malloc (size); + if (unlikely (buffer == NULL)) + goto nomem; + flags = ELF_F_MALLOCED; + + /* The copy will be appropriately aligned for direct access. */ + memcpy (buffer, rawchunk, size); + } + } + else + { + if (flags) + buffer = rawchunk; + else + { + buffer = malloc (size); + if (unlikely (buffer == NULL)) + goto nomem; + flags = ELF_F_MALLOCED; + } + + /* Call the conversion function. */ + (*__elf_xfctstom[LIBELF_EV_IDX][LIBELF_EV_IDX][elf->class - 1][type]) + (buffer, rawchunk, size, 0); + } + + /* Allocate the dummy container to point at this buffer. */ + Elf_Data_Chunk *chunk = calloc (1, sizeof *chunk); + if (chunk == NULL) + { + if (flags) + free (buffer); + goto nomem; + } + + chunk->dummy_scn.elf = elf; + chunk->dummy_scn.flags = flags; + chunk->data.s = &chunk->dummy_scn; + chunk->data.d.d_buf = buffer; + chunk->data.d.d_size = size; + chunk->data.d.d_type = type; + chunk->data.d.d_align = align; + chunk->data.d.d_version = __libelf_version; + + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + + chunk->next = elf->state.elf.rawchunks; + elf->state.elf.rawchunks = chunk; + result = &chunk->data.d; + + out: + rwlock_unlock (elf->lock); + return result; +} diff --git a/libelf/elf_getident.c b/libelf/elf_getident.c index b673b5c6..f9bac104 100644 --- a/libelf/elf_getident.c +++ b/libelf/elf_getident.c @@ -1,19 +1,52 @@ /* Retrieve file identification data. Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_getscn.c b/libelf/elf_getscn.c index a6b4767c..5c14a580 100644 --- a/libelf/elf_getscn.c +++ b/libelf/elf_getscn.c @@ -1,19 +1,52 @@ /* Get section at specific index. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_getshnum.c b/libelf/elf_getshnum.c index 52d6a056..3c65ef4c 100644 --- a/libelf/elf_getshnum.c +++ b/libelf/elf_getshnum.c @@ -1,19 +1,52 @@ /* Return number of sections in the ELF file. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,7 +60,7 @@ int -elf_getshnum (elf, dst) +__elf_getshnum_rdlock (elf, dst) Elf *elf; size_t *dst; { @@ -43,8 +76,6 @@ elf_getshnum (elf, dst) return -1; } - rwlock_rdlock (elf->lock); - idx = elf->state.elf.scns_last->cnt; if (idx != 0 || (elf->state.elf.scns_last @@ -57,8 +88,22 @@ elf_getshnum (elf, dst) else *dst = 0; + return result; +} + +int +elf_getshnum (elf, dst) + Elf *elf; + size_t *dst; +{ + int result; + + if (elf == NULL) + return -1; + + rwlock_rdlock (elf->lock); + result = __elf_getshnum_rdlock (elf, dst); rwlock_unlock (elf->lock); return result; } -INTDEF(elf_getshnum) diff --git a/libelf/elf_getshstrndx.c b/libelf/elf_getshstrndx.c index 706092b7..52516a8e 100644 --- a/libelf/elf_getshstrndx.c +++ b/libelf/elf_getshstrndx.c @@ -1,29 +1,64 @@ /* Return section index of section header string table. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> +#include <errno.h> #include <gelf.h> #include <stddef.h> #include <unistd.h> +#include <system.h> #include "libelfP.h" #include "common.h" @@ -100,8 +135,9 @@ elf_getshstrndx (elf, dst) the first one. */ Elf32_Shdr shdr_mem; - if (pread (elf->fildes, &shdr_mem, sizeof (Elf32_Shdr), - offset) != sizeof (Elf32_Shdr)) + if (unlikely (pread_retry (elf->fildes, &shdr_mem, + sizeof (Elf32_Shdr), offset) + != sizeof (Elf32_Shdr))) { /* We must be able to read this ELF section header. */ __libelf_seterrno (ELF_E_INVALID_FILE); @@ -116,15 +152,13 @@ elf_getshstrndx (elf, dst) } else { - size_t offset; - if (elf->state.elf64.scns.data[0].shdr.e64 != NULL) { num = elf->state.elf64.scns.data[0].shdr.e64->sh_link; goto success; } - offset = elf->state.elf64.ehdr->e_shoff; + size_t offset = elf->state.elf64.ehdr->e_shoff; if (elf->map_address != NULL && elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA @@ -139,8 +173,9 @@ elf_getshstrndx (elf, dst) the first one. */ Elf64_Shdr shdr_mem; - if (pread (elf->fildes, &shdr_mem, sizeof (Elf64_Shdr), - offset) != sizeof (Elf64_Shdr)) + if (unlikely (pread_retry (elf->fildes, &shdr_mem, + sizeof (Elf64_Shdr), offset) + != sizeof (Elf64_Shdr))) { /* We must be able to read this ELF section header. */ __libelf_seterrno (ELF_E_INVALID_FILE); diff --git a/libelf/elf_gnu_hash.c b/libelf/elf_gnu_hash.c new file mode 100644 index 00000000..efaee435 --- /dev/null +++ b/libelf/elf_gnu_hash.c @@ -0,0 +1,68 @@ +/* GNU-style Hash function used in ELF implementations. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libelfP.h> + +/* Get the implementation. */ +#include <dl-hash.h> + +unsigned long int +elf_gnu_hash (string) + const char *string; +{ + uint_fast32_t h = 5381; + for (unsigned char c = *string; c != '\0'; c = *++string) + h = h * 33 + c; + return h & 0xffffffff; +} diff --git a/libelf/elf_hash.c b/libelf/elf_hash.c index 38f4ae06..94c0a853 100644 --- a/libelf/elf_hash.c +++ b/libelf/elf_hash.c @@ -1,19 +1,52 @@ /* Hash function used in ELF implementations. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_kind.c b/libelf/elf_kind.c index a67ebe72..06aeaa9c 100644 --- a/libelf/elf_kind.c +++ b/libelf/elf_kind.c @@ -1,19 +1,52 @@ /* Return the kind of file associated with the descriptor. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_memory.c b/libelf/elf_memory.c index 57221f99..f6468c8b 100644 --- a/libelf/elf_memory.c +++ b/libelf/elf_memory.c @@ -1,19 +1,52 @@ /* Create descriptor for memory region. Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_ndxscn.c b/libelf/elf_ndxscn.c index edd6bdae..53082aee 100644 --- a/libelf/elf_ndxscn.c +++ b/libelf/elf_ndxscn.c @@ -1,19 +1,52 @@ /* Get index of section. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_newdata.c b/libelf/elf_newdata.c index bae3b3f5..db17ea58 100644 --- a/libelf/elf_newdata.c +++ b/libelf/elf_newdata.c @@ -1,19 +1,52 @@ /* Create new, empty section data. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_newscn.c b/libelf/elf_newscn.c index f3ea0d80..aefab334 100644 --- a/libelf/elf_newscn.c +++ b/libelf/elf_newscn.c @@ -1,19 +1,52 @@ /* Append new section. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_next.c b/libelf/elf_next.c index 58a07753..fbfb2721 100644 --- a/libelf/elf_next.c +++ b/libelf/elf_next.c @@ -1,19 +1,52 @@ /* Advance in archive to next element. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -31,6 +64,7 @@ elf_next (elf) Elf *elf; { Elf *parent; + Elf_Cmd ret; /* Be gratious, the specs demand it. */ if (elf == NULL || elf->parent == NULL) @@ -40,14 +74,17 @@ elf_next (elf) parent = elf->parent; assert (parent->kind == ELF_K_AR); + rwlock_wrlock (parent->lock); + /* Now advance the offset. */ parent->state.ar.offset += (sizeof (struct ar_hdr) + ((parent->state.ar.elf_ar_hdr.ar_size + 1) & ~1l)); /* Get the next archive header. */ - if (__libelf_next_arhdr (parent) != 0) - return ELF_C_NULL; + ret = __libelf_next_arhdr_wrlock (parent) != 0 ? ELF_C_NULL : elf->cmd; + + rwlock_unlock (parent->lock); - return elf->cmd; + return ret; } diff --git a/libelf/elf_nextscn.c b/libelf/elf_nextscn.c index de9df64b..a1842bb3 100644 --- a/libelf/elf_nextscn.c +++ b/libelf/elf_nextscn.c @@ -1,19 +1,52 @@ /* Get next section. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_rand.c b/libelf/elf_rand.c index 76c3862f..a766d38f 100644 --- a/libelf/elf_rand.c +++ b/libelf/elf_rand.c @@ -1,19 +1,52 @@ /* Select specific element in archive. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -34,16 +67,20 @@ elf_rand (elf, offset) if (elf == NULL || elf->kind != ELF_K_AR) return 0; + rwlock_wrlock (elf->lock); + /* Save the old offset and set the offset. */ elf->state.ar.offset = elf->start_offset + offset; /* Get the next archive header. */ - if (__libelf_next_arhdr (elf) != 0) + if (__libelf_next_arhdr_wrlock (elf) != 0) { /* Mark the archive header as unusable. */ elf->state.ar.elf_ar_hdr.ar_name = NULL; return 0; } + rwlock_unlock (elf->lock); + return offset; } diff --git a/libelf/elf_rawdata.c b/libelf/elf_rawdata.c index 547c37f4..b8bb0f4b 100644 --- a/libelf/elf_rawdata.c +++ b/libelf/elf_rawdata.c @@ -1,19 +1,52 @@ /* Return raw section content. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/elf_rawfile.c b/libelf/elf_rawfile.c index 3f6dc3c8..a62a3549 100644 --- a/libelf/elf_rawfile.c +++ b/libelf/elf_rawfile.c @@ -1,19 +1,52 @@ /* Retrieve uninterpreted file contents. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -30,6 +63,8 @@ elf_rawfile (elf, ptr) Elf *elf; size_t *ptr; { + char *result; + if (elf == NULL) { /* No valid descriptor. */ @@ -44,8 +79,12 @@ elf_rawfile (elf, ptr) if (elf->map_address == NULL && __libelf_readall (elf) == NULL) goto error_out; + rwlock_rdlock (elf->lock); if (ptr != NULL) *ptr = elf->maximum_size; - return (char *) elf->map_address + elf->start_offset; + result = (char *) elf->map_address + elf->start_offset; + rwlock_unlock (elf->lock); + + return result; } diff --git a/libelf/elf_readall.c b/libelf/elf_readall.c index d36da270..8f171b21 100644 --- a/libelf/elf_readall.c +++ b/libelf/elf_readall.c @@ -1,26 +1,61 @@ /* Read all of the file associated with the descriptor. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <errno.h> #include <unistd.h> +#include <system.h> #include "libelfP.h" #include "common.h" @@ -78,8 +113,10 @@ __libelf_readall (elf) if (mem != NULL) { /* Read the file content. */ - if ((size_t) pread (elf->fildes, mem, elf->maximum_size, - elf->start_offset) != elf->maximum_size) + if (unlikely ((size_t) pread_retry (elf->fildes, mem, + elf->maximum_size, + elf->start_offset) + != elf->maximum_size)) { /* Something went wrong. */ __libelf_seterrno (ELF_E_READ_ERROR); diff --git a/libelf/elf_scnshndx.c b/libelf/elf_scnshndx.c new file mode 100644 index 00000000..987d23e4 --- /dev/null +++ b/libelf/elf_scnshndx.c @@ -0,0 +1,71 @@ +/* Get the section index of the extended section index table. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libelfP.h" + + +int +elf_scnshndx (Elf_Scn *scn) +{ + if (unlikely (scn->shndx_index == 0)) + { + /* We do not have the value yet. We get it as a side effect of + getting a section header. */ + GElf_Shdr shdr_mem; + (void) INTUSE(gelf_getshdr) (scn, &shdr_mem); + } + + return scn->shndx_index; +} +INTDEF(elf_scnshndx) diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c index 327adfd1..35a0e9b6 100644 --- a/libelf/elf_strptr.c +++ b/libelf/elf_strptr.c @@ -1,19 +1,52 @@ /* Return string pointer from string section. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -107,12 +140,35 @@ elf_strptr (elf, idx, offset) } } - if (strscn->rawdata_base == NULL - /* Read the section data. */ - && __libelf_set_rawdata (strscn) != 0) - goto out; + if (strscn->rawdata_base == NULL && ! strscn->data_read) + { + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + if (strscn->rawdata_base == NULL && ! strscn->data_read + /* Read the section data. */ + && __libelf_set_rawdata_wrlock (strscn) != 0) + goto out; + } + + if (likely (strscn->rawdata_base != NULL)) + result = &strscn->rawdata_base[offset]; + else + { + /* This is a file which is currently created. Use the list of + data blocks. */ + struct Elf_Data_List *dl = &strscn->data_list; + while (dl != NULL) + { + if (offset >= (size_t) dl->data.d.d_off + && offset < dl->data.d.d_off + dl->data.d.d_size) + { + result = (char *) dl->data.d.d_buf + (offset - dl->data.d.d_off); + break; + } - result = &strscn->rawdata_base[offset]; + dl = dl->next; + } + } out: rwlock_unlock (elf->lock); diff --git a/libelf/elf_update.c b/libelf/elf_update.c index ece22251..5daece40 100644 --- a/libelf/elf_update.c +++ b/libelf/elf_update.c @@ -1,19 +1,52 @@ /* Update data structures for changes and write them out. - Copyright (C) 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -22,6 +55,7 @@ #include <libelf.h> #include <unistd.h> #include <sys/mman.h> +#include <sys/stat.h> #include "libelfP.h" @@ -31,13 +65,22 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum) { int class = elf->class; + /* Check the mode bits now, before modification might change them. */ + struct stat st; + if (unlikely (fstat (elf->fildes, &st) != 0)) + { + __libelf_seterrno (ELF_E_WRITE_ERROR); + return -1; + } + /* Adjust the size in any case. We do this even if we use `write'. We cannot do this if this file is in an archive. We also don't do it *now* if we are shortening the file since this would prevent programs to use the data of the file in generating the new file. We truncate the file later in this case. */ if (elf->parent == NULL - && (elf->maximum_size == ~((size_t) 0) || size > elf->maximum_size) + && (elf->maximum_size == ~((size_t) 0) + || (size_t) size > elf->maximum_size) && unlikely (ftruncate (elf->fildes, size) != 0)) { __libelf_seterrno (ELF_E_WRITE_ERROR); @@ -47,10 +90,14 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum) /* Try to map the file if this isn't done yet. */ if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP) { +#if _MUDFLAP + /* Mudflap doesn't grok that our mmap'd data is ok. */ +#else elf->map_address = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, elf->fildes, 0); if (unlikely (elf->map_address == MAP_FAILED)) elf->map_address = NULL; +#endif } if (elf->map_address != NULL) @@ -75,13 +122,25 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum) if (size != -1 && elf->parent == NULL && elf->maximum_size != ~((size_t) 0) - && size < elf->maximum_size + && (size_t) size < elf->maximum_size && unlikely (ftruncate (elf->fildes, size) != 0)) { __libelf_seterrno (ELF_E_WRITE_ERROR); size = -1; } + /* POSIX says that ftruncate and write may clear the S_ISUID and S_ISGID + mode bits. So make sure we restore them afterwards if they were set. + This is not atomic if someone else chmod's the file while we operate. */ + if (size != -1 + && unlikely (st.st_mode & (S_ISUID | S_ISGID)) + /* fchmod ignores the bits we cannot change. */ + && unlikely (fchmod (elf->fildes, st.st_mode) != 0)) + { + __libelf_seterrno (ELF_E_WRITE_ERROR); + size = -1; + } + if (size != -1 && elf->parent == NULL) elf->maximum_size = size; @@ -115,7 +174,7 @@ elf_update (elf, cmd) return -1; } - rwlock_rdlock (elf->lock); + rwlock_wrlock (elf->lock); /* Make sure we have an ELF header. */ if (elf->state.elf.ehdr == NULL) @@ -134,8 +193,8 @@ elf_update (elf, cmd) will come right after the ELF header. The count the size of all sections and finally place the section table. */ size = (elf->class == ELFCLASS32 - ? __elf32_updatenull (elf, &change_bo, shnum) - : __elf64_updatenull (elf, &change_bo, shnum)); + ? __elf32_updatenull_wrlock (elf, &change_bo, shnum) + : __elf64_updatenull_wrlock (elf, &change_bo, shnum)); if (likely (size != -1) /* See whether we actually have to write out the data. */ && (cmd == ELF_C_WRITE || cmd == ELF_C_WRITE_MMAP)) @@ -155,15 +214,7 @@ elf_update (elf, cmd) size = -1; } else - { - if (elf->parent != NULL) - { - extern int puts (const char *); - puts ("this is an archive member"); - } - - size = write_file (elf, size, change_bo, shnum); - } + size = write_file (elf, size, change_bo, shnum); } out: diff --git a/libelf/elf_version.c b/libelf/elf_version.c index 16bfce10..cbed496f 100644 --- a/libelf/elf_version.c +++ b/libelf/elf_version.c @@ -1,19 +1,52 @@ /* Coordinate ELF library and application versions. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/exttypes.h b/libelf/exttypes.h index b6bde829..3bb90c3a 100644 --- a/libelf/exttypes.h +++ b/libelf/exttypes.h @@ -1,19 +1,52 @@ /* External ELF types. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _EXTTYPES_H #define _EXTTYPES_H 1 @@ -61,6 +94,7 @@ Verneed32 (Ext_); Vernaux32 (Ext_); Syminfo32 (Ext_); Move32 (Ext_); +auxv_t32 (Ext_); Ehdr64 (Ext_); Phdr64 (Ext_); @@ -76,6 +110,7 @@ Verneed64 (Ext_); Vernaux64 (Ext_); Syminfo64 (Ext_); Move64 (Ext_); +auxv_t64 (Ext_); #undef START #undef END diff --git a/libelf/gelf.h b/libelf/gelf.h index 9d9b3239..533e15a9 100644 --- a/libelf/gelf.h +++ b/libelf/gelf.h @@ -1,18 +1,51 @@ /* This file defines generic ELF types, structures, and macros. - Copyright (C) 1999, 2000, 2001, 2002, 2004 Red Hat, 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _GELF_H #define _GELF_H 1 @@ -153,6 +186,9 @@ extern int gelf_update_ehdr (Elf *__elf, GElf_Ehdr *__src); /* Create new ELF header if none exists. */ extern unsigned long int gelf_newehdr (Elf *__elf, int __class); +/* Get section at OFFSET. */ +extern Elf_Scn *gelf_offscn (Elf *__elf, GElf_Off __offset); + /* Retrieve section header. */ extern GElf_Shdr *gelf_getshdr (Elf_Scn *__scn, GElf_Shdr *__dst); @@ -291,11 +327,24 @@ extern int gelf_update_verdaux (Elf_Data *__data, int __offset, GElf_Verdaux *__src); -/* Retrieve uninterpreted chunk of the file contents. */ -extern char *gelf_rawchunk (Elf *__elf, GElf_Off __offset, GElf_Word __size); +/* Get auxv entry at the given index. */ +extern GElf_auxv_t *gelf_getauxv (Elf_Data *__data, int __ndx, + GElf_auxv_t *__dst); + +/* Update auxv entry at the given index. */ +extern int gelf_update_auxv (Elf_Data *__data, int __ndx, GElf_auxv_t *__src); + + +/* Get note header at the given offset into the data, and the offsets of + the note's name and descriptor data. Returns the offset of the next + note header, or 0 for an invalid offset or corrupt note header. */ +extern size_t gelf_getnote (Elf_Data *__data, size_t __offset, + GElf_Nhdr *__result, + size_t *__name_offset, size_t *__desc_offset); + -/* Release uninterpreted chunk of the file contents. */ -extern void gelf_freechunk (Elf *__elf, char *__ptr); +/* Compute simple checksum from permanent parts of the ELF file. */ +extern long int gelf_checksum (Elf *__elf); #ifdef __cplusplus } diff --git a/libelf/gelf_checksum.c b/libelf/gelf_checksum.c index bbd04df9..fb0daa51 100644 --- a/libelf/gelf_checksum.c +++ b/libelf/gelf_checksum.c @@ -1,19 +1,52 @@ /* Convert from file to memory representation. Generic ELF version. Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_freechunk.c b/libelf/gelf_freechunk.c deleted file mode 100644 index c47ec9aa..00000000 --- a/libelf/gelf_freechunk.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Release uninterpreted chunk of the file contents. - Copyright (C) 2002 Red Hat, Inc. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libelf.h> -#include <stddef.h> -#include <stdlib.h> - -#include "libelfP.h" - - -void -gelf_freechunk (elf, ptr) - Elf *elf; - char *ptr; -{ - if (elf == NULL) - /* No valid descriptor. */ - return; - - /* We do not have to do anything if the pointer returned by - gelf_rawchunk points into the memory allocated for the ELF - descriptor. */ - if (ptr < (char *) elf->map_address + elf->start_offset - || ptr >= ((char *) elf->map_address + elf->start_offset - + elf->maximum_size)) - free (ptr); -} diff --git a/libelf/gelf_fsize.c b/libelf/gelf_fsize.c index 0432ba0b..98197e0f 100644 --- a/libelf/gelf_fsize.c +++ b/libelf/gelf_fsize.c @@ -1,19 +1,52 @@ /* Return the size of an object file type. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -53,7 +86,8 @@ const size_t __libelf_type_sizes[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] = [ELF_T_VNAUX] = sizeof (ElfW2(LIBELFBITS, Ext_Vernaux)), \ [ELF_T_NHDR] = sizeof (ElfW2(LIBELFBITS, Ext_Nhdr)), \ [ELF_T_SYMINFO] = sizeof (ElfW2(LIBELFBITS, Ext_Syminfo)), \ - [ELF_T_MOVE] = sizeof (ElfW2(LIBELFBITS, Ext_Move)) + [ELF_T_MOVE] = sizeof (ElfW2(LIBELFBITS, Ext_Move)), \ + [ELF_T_AUXV] = sizeof (ElfW2(LIBELFBITS, Ext_auxv_t)) TYPE_SIZES (32) }, [ELFCLASS64 - 1] = { diff --git a/libelf/gelf_getauxv.c b/libelf/gelf_getauxv.c new file mode 100644 index 00000000..036bdccf --- /dev/null +++ b/libelf/gelf_getauxv.c @@ -0,0 +1,130 @@ +/* Get information from auxiliary vector at the given index. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <gelf.h> +#include <string.h> + +#include "libelfP.h" + + +GElf_auxv_t * +gelf_getauxv (data, ndx, dst) + Elf_Data *data; + int ndx; + GElf_auxv_t *dst; +{ + Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data; + GElf_auxv_t *result = NULL; + Elf *elf; + + if (data_scn == NULL) + return NULL; + + if (unlikely (data_scn->d.d_type != ELF_T_AUXV)) + { + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return NULL; + } + + elf = data_scn->s->elf; + + rwlock_rdlock (elf->lock); + + /* This is the one place where we have to take advantage of the fact + that an `Elf_Data' pointer is also a pointer to `Elf_Data_Scn'. + The interface is broken so that it requires this hack. */ + if (elf->class == ELFCLASS32) + { + Elf32_auxv_t *src; + + /* Here it gets a bit more complicated. The format of the vector + entries has to be converted. The user better have provided a + buffer where we can store the information. While copying the data + we convert the format. */ + if (unlikely ((ndx + 1) * sizeof (Elf32_auxv_t) > data_scn->d.d_size)) + { + __libelf_seterrno (ELF_E_INVALID_INDEX); + goto out; + } + + src = &((Elf32_auxv_t *) data_scn->d.d_buf)[ndx]; + + /* This might look like a simple copy operation but it's + not. There are zero- and sign-extensions going on. */ + dst->a_type = src->a_type; + dst->a_un.a_val = src->a_un.a_val; + } + else + { + /* If this is a 64 bit object it's easy. */ + assert (sizeof (GElf_auxv_t) == sizeof (Elf64_auxv_t)); + + /* The data is already in the correct form. Just make sure the + index is OK. */ + if (unlikely ((ndx + 1) * sizeof (GElf_auxv_t) > data_scn->d.d_size)) + { + __libelf_seterrno (ELF_E_INVALID_INDEX); + goto out; + } + + *dst = ((GElf_auxv_t *) data_scn->d.d_buf)[ndx]; + } + + result = dst; + + out: + rwlock_unlock (elf->lock); + + return result; +} diff --git a/libelf/gelf_getclass.c b/libelf/gelf_getclass.c index 2ae1b329..02784d74 100644 --- a/libelf/gelf_getclass.c +++ b/libelf/gelf_getclass.c @@ -1,19 +1,52 @@ /* Return the class of file associated with the descriptor. Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getdyn.c b/libelf/gelf_getdyn.c index d75744ea..82f8e328 100644 --- a/libelf/gelf_getdyn.c +++ b/libelf/gelf_getdyn.c @@ -1,19 +1,52 @@ /* Get information from dynamic table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getehdr.c b/libelf/gelf_getehdr.c index 6b926442..34b5db3e 100644 --- a/libelf/gelf_getehdr.c +++ b/libelf/gelf_getehdr.c @@ -1,32 +1,67 @@ /* Get ELF header. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <gelf.h> +#include <stddef.h> +#include <stdlib.h> #include <string.h> #include "libelfP.h" GElf_Ehdr * -gelf_getehdr (elf, dest) +__gelf_getehdr_rdlock (elf, dest) Elf *elf; GElf_Ehdr *dest; { @@ -41,47 +76,56 @@ gelf_getehdr (elf, dest) return NULL; } - rwlock_rdlock (elf->lock); - - if (elf->class == ELFCLASS32) + /* The following is an optimization: the ehdr element is at the same + position in both the elf32 and elf64 structure. */ + if (offsetof (struct Elf, state.elf32.ehdr) + != offsetof (struct Elf, state.elf64.ehdr)) + abort (); + /* Just pick one of the values. */ + if (unlikely (elf->state.elf64.ehdr == NULL)) + /* Maybe no ELF header was created yet. */ + __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); + else if (elf->class == ELFCLASS32) { Elf32_Ehdr *ehdr = elf->state.elf32.ehdr; - /* Maybe no ELF header was created yet. */ - if (ehdr == NULL) - __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); - else - { - /* Convert the 32-bit struct to an 64-bit one. */ - memcpy (dest->e_ident, ehdr->e_ident, EI_NIDENT); + /* Convert the 32-bit struct to an 64-bit one. */ + memcpy (dest->e_ident, ehdr->e_ident, EI_NIDENT); #define COPY(name) \ - dest->name = ehdr->name - COPY (e_type); - COPY (e_machine); - COPY (e_version); - COPY (e_entry); - COPY (e_phoff); - COPY (e_shoff); - COPY (e_flags); - COPY (e_ehsize); - COPY (e_phentsize); - COPY (e_phnum); - COPY (e_shentsize); - COPY (e_shnum); - COPY (e_shstrndx); - - result = dest; - } + dest->name = ehdr->name + COPY (e_type); + COPY (e_machine); + COPY (e_version); + COPY (e_entry); + COPY (e_phoff); + COPY (e_shoff); + COPY (e_flags); + COPY (e_ehsize); + COPY (e_phentsize); + COPY (e_phnum); + COPY (e_shentsize); + COPY (e_shnum); + COPY (e_shstrndx); + + result = dest; } else - { - /* Maybe no ELF header was created yet. */ - if (elf->state.elf64.ehdr == NULL) - __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); - else - result = memcpy (dest, elf->state.elf64.ehdr, sizeof (*dest)); - } + result = memcpy (dest, elf->state.elf64.ehdr, sizeof (*dest)); + + return result; +} +GElf_Ehdr * +gelf_getehdr (elf, dest) + Elf *elf; + GElf_Ehdr *dest; +{ + GElf_Ehdr *result; + if (elf == NULL) + return NULL; + + rwlock_rdlock (elf->lock); + result = __gelf_getehdr_rdlock (elf, dest); rwlock_unlock (elf->lock); return result; diff --git a/libelf/gelf_getlib.c b/libelf/gelf_getlib.c index 9366c79a..aa91a73b 100644 --- a/libelf/gelf_getlib.c +++ b/libelf/gelf_getlib.c @@ -1,19 +1,52 @@ /* Get library from table at the given index. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getmove.c b/libelf/gelf_getmove.c index a3b96bbc..6e769484 100644 --- a/libelf/gelf_getmove.c +++ b/libelf/gelf_getmove.c @@ -1,19 +1,52 @@ /* Get move structure at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getnote.c b/libelf/gelf_getnote.c new file mode 100644 index 00000000..e4900185 --- /dev/null +++ b/libelf/gelf_getnote.c @@ -0,0 +1,119 @@ +/* Get note information at the supplied offset. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <gelf.h> +#include <string.h> + +#include "libelfP.h" + +size_t +gelf_getnote (data, offset, result, name_offset, desc_offset) + Elf_Data *data; + size_t offset; + GElf_Nhdr *result; + size_t *name_offset; + size_t *desc_offset; +{ + if (data == NULL) + return 0; + + if (unlikely (data->d_type != ELF_T_NHDR)) + { + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return 0; + } + + /* It's easy to handle this type. It has the same size for 32 and + 64 bit objects. */ + assert (sizeof (GElf_Nhdr) == sizeof (Elf32_Nhdr)); + assert (sizeof (GElf_Nhdr) == sizeof (Elf64_Nhdr)); + + rwlock_rdlock (((Elf_Data_Scn *) data)->s->elf->lock); + + /* The data is already in the correct form. Just make sure the + offset is OK. */ + if (unlikely (offset + sizeof (GElf_Nhdr) > data->d_size)) + { + __libelf_seterrno (ELF_E_OFFSET_RANGE); + offset = 0; + } + else + { + const GElf_Nhdr *n = data->d_buf + offset; + offset += sizeof *n; + + GElf_Word namesz = NOTE_ALIGN (n->n_namesz); + GElf_Word descsz = NOTE_ALIGN (n->n_descsz); + + if (unlikely (data->d_size - offset < namesz)) + offset = 0; + else + { + *name_offset = offset; + offset += namesz; + if (unlikely (data->d_size - offset < descsz)) + offset = 0; + else + { + *desc_offset = offset; + offset += descsz; + *result = *n; + } + } + } + + rwlock_unlock (((Elf_Data_Scn *) data)->s->elf->lock); + + return offset; +} diff --git a/libelf/gelf_getphdr.c b/libelf/gelf_getphdr.c index fd033e56..66cd143d 100644 --- a/libelf/gelf_getphdr.c +++ b/libelf/gelf_getphdr.c @@ -1,19 +1,52 @@ /* Return program header table entry. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -21,6 +54,7 @@ #include <gelf.h> #include <string.h> +#include <stdbool.h> #include "libelfP.h" @@ -57,10 +91,12 @@ gelf_getphdr (elf, ndx, dst) if (phdr == NULL) { + rwlock_unlock (elf->lock); phdr = INTUSE(elf32_getphdr) (elf); if (phdr == NULL) /* The error number is already set. */ - goto out; + return NULL; + rwlock_rdlock (elf->lock); } /* Test whether the index is ok. */ @@ -93,10 +129,12 @@ gelf_getphdr (elf, ndx, dst) if (phdr == NULL) { + rwlock_unlock (elf->lock); phdr = INTUSE(elf64_getphdr) (elf); if (phdr == NULL) /* The error number is already set. */ - goto out; + return NULL; + rwlock_rdlock (elf->lock); } /* Test whether the index is ok. */ diff --git a/libelf/gelf_getrel.c b/libelf/gelf_getrel.c index 7dc78a7e..f3775bd9 100644 --- a/libelf/gelf_getrel.c +++ b/libelf/gelf_getrel.c @@ -1,19 +1,52 @@ /* Get REL relocation information at given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getrela.c b/libelf/gelf_getrela.c index fb94b008..0275c375 100644 --- a/libelf/gelf_getrela.c +++ b/libelf/gelf_getrela.c @@ -1,19 +1,52 @@ /* Get RELA relocation information at given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getshdr.c b/libelf/gelf_getshdr.c index 4ea5886d..8b46dfa8 100644 --- a/libelf/gelf_getshdr.c +++ b/libelf/gelf_getshdr.c @@ -1,19 +1,52 @@ /* Return section header. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -46,7 +79,8 @@ gelf_getshdr (scn, dst) if (scn->elf->class == ELFCLASS32) { /* Copy the elements one-by-one. */ - Elf32_Shdr *shdr = scn->shdr.e32 ?: INTUSE(elf32_getshdr) (scn); + Elf32_Shdr *shdr + = scn->shdr.e32 ?: __elf32_getshdr_rdlock (scn); if (shdr == NULL) { @@ -71,7 +105,8 @@ gelf_getshdr (scn, dst) } else { - Elf64_Shdr *shdr = scn->shdr.e64 ?: INTUSE(elf64_getshdr) (scn); + Elf64_Shdr *shdr + = scn->shdr.e64 ?: __elf64_getshdr_rdlock (scn); if (shdr == NULL) { diff --git a/libelf/gelf_getsym.c b/libelf/gelf_getsym.c index 90536c60..162061f7 100644 --- a/libelf/gelf_getsym.c +++ b/libelf/gelf_getsym.c @@ -1,19 +1,52 @@ /* Get symbol information from symbol table at the given index. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getsyminfo.c b/libelf/gelf_getsyminfo.c index 70cfdcd3..2c07526a 100644 --- a/libelf/gelf_getsyminfo.c +++ b/libelf/gelf_getsyminfo.c @@ -1,19 +1,52 @@ /* Get additional symbol information from symbol table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getsymshndx.c b/libelf/gelf_getsymshndx.c index 856f4919..a9cfc181 100644 --- a/libelf/gelf_getsymshndx.c +++ b/libelf/gelf_getsymshndx.c @@ -1,20 +1,53 @@ /* Get symbol information and separate section index from symbol table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getverdaux.c b/libelf/gelf_getverdaux.c index 0a14b121..b8bcf14e 100644 --- a/libelf/gelf_getverdaux.c +++ b/libelf/gelf_getverdaux.c @@ -1,19 +1,52 @@ /* Get additional symbol version definition information at the given offset. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getverdef.c b/libelf/gelf_getverdef.c index b9492ef7..05cc2e89 100644 --- a/libelf/gelf_getverdef.c +++ b/libelf/gelf_getverdef.c @@ -1,19 +1,52 @@ /* Get symbol version definition information at the given offset. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getvernaux.c b/libelf/gelf_getvernaux.c index fbaa109a..45d3300f 100644 --- a/libelf/gelf_getvernaux.c +++ b/libelf/gelf_getvernaux.c @@ -1,19 +1,52 @@ /* Get additional required symbol version information at the given offset. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getverneed.c b/libelf/gelf_getverneed.c index 573e116a..e82a055d 100644 --- a/libelf/gelf_getverneed.c +++ b/libelf/gelf_getverneed.c @@ -1,19 +1,52 @@ /* Get required symbol version information at the given offset. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_getversym.c b/libelf/gelf_getversym.c index 9274b142..397b7edb 100644 --- a/libelf/gelf_getversym.c +++ b/libelf/gelf_getversym.c @@ -1,19 +1,52 @@ /* Get symbol version information at the given index. Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_newehdr.c b/libelf/gelf_newehdr.c index 587283f4..2f720b8a 100644 --- a/libelf/gelf_newehdr.c +++ b/libelf/gelf_newehdr.c @@ -1,19 +1,52 @@ /* Create new ELF header. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_newphdr.c b/libelf/gelf_newphdr.c index d1d433e8..65306924 100644 --- a/libelf/gelf_newphdr.c +++ b/libelf/gelf_newphdr.c @@ -1,19 +1,52 @@ /* Create new ELF program header. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_offscn.c b/libelf/gelf_offscn.c new file mode 100644 index 00000000..573195cd --- /dev/null +++ b/libelf/gelf_offscn.c @@ -0,0 +1,78 @@ +/* Create new ELF header. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gelf.h> +#include <stdlib.h> + +#include "libelfP.h" + + +Elf_Scn * +gelf_offscn (elf, offset) + Elf *elf; + GElf_Off offset; +{ + if (elf->class == ELFCLASS32) + { + if ((Elf32_Off) offset != offset) + { + __libelf_seterrno (ELF_E_INVALID_OFFSET); + return NULL; + } + + return INTUSE(elf32_offscn) (elf, (Elf32_Off) offset); + } + + return INTUSE(elf64_offscn) (elf, offset); +} diff --git a/libelf/gelf_rawchunk.c b/libelf/gelf_rawchunk.c deleted file mode 100644 index 667f3013..00000000 --- a/libelf/gelf_rawchunk.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Retrieve uninterpreted chunk of the file contents. - Copyright (C) 2002 Red Hat, Inc. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <libelf.h> -#include <stddef.h> -#include <stdlib.h> -#include <unistd.h> - -#include "libelfP.h" - - -char * -gelf_rawchunk (elf, offset, size) - Elf *elf; - GElf_Off offset; - GElf_Word size; -{ - if (elf == NULL) - { - /* No valid descriptor. */ - __libelf_seterrno (ELF_E_INVALID_HANDLE); - return NULL; - } - - if (offset >= elf->maximum_size - || offset + size >= elf->maximum_size - || offset + size < offset) - { - /* Invalid request. */ - __libelf_seterrno (ELF_E_INVALID_OP); - return NULL; - } - - /* If the file is mmap'ed return an appropriate pointer. */ - if (elf->map_address != NULL) - return (char *) elf->map_address + elf->start_offset + offset; - - /* We allocate the memory and read the data from the file. */ - char *result = (char *) malloc (size); - if (result == NULL) - __libelf_seterrno (ELF_E_NOMEM); - else - /* Read the file content. */ - if ((size_t) pread (elf->fildes, result, size, elf->start_offset + offset) - != size) - { - /* Something went wrong. */ - __libelf_seterrno (ELF_E_READ_ERROR); - free (result); - } - - return result; -} diff --git a/libelf/gelf_update_auxv.c b/libelf/gelf_update_auxv.c new file mode 100644 index 00000000..b294ead7 --- /dev/null +++ b/libelf/gelf_update_auxv.c @@ -0,0 +1,135 @@ +/* Update information in dynamic table at the given index. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gelf.h> +#include <string.h> + +#include "libelfP.h" + + +int +gelf_update_auxv (data, ndx, src) + Elf_Data *data; + int ndx; + GElf_auxv_t *src; +{ + Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data; + Elf_Scn *scn; + int result = 0; + + if (data == NULL) + return 0; + + if (unlikely (ndx < 0)) + { + __libelf_seterrno (ELF_E_INVALID_INDEX); + return 0; + } + + if (unlikely (data_scn->d.d_type != ELF_T_AUXV)) + { + /* The type of the data better should match. */ + __libelf_seterrno (ELF_E_DATA_MISMATCH); + return 0; + } + + scn = data_scn->s; + rwlock_wrlock (scn->elf->lock); + + if (scn->elf->class == ELFCLASS32) + { + Elf32_auxv_t *auxv; + + /* There is the possibility that the values in the input are + too large. */ + if (unlikely (src->a_type > 0xffffffffll) + || unlikely (src->a_un.a_val > 0xffffffffull)) + { + __libelf_seterrno (ELF_E_INVALID_DATA); + goto out; + } + + /* Check whether we have to resize the data buffer. */ + if (unlikely ((ndx + 1) * sizeof (Elf32_auxv_t) > data_scn->d.d_size)) + { + __libelf_seterrno (ELF_E_INVALID_INDEX); + goto out; + } + + auxv = &((Elf32_auxv_t *) data_scn->d.d_buf)[ndx]; + + auxv->a_type = src->a_type; + auxv->a_un.a_val = src->a_un.a_val; + } + else + { + /* Check whether we have to resize the data buffer. */ + if (unlikely ((ndx + 1) * sizeof (Elf64_auxv_t) > data_scn->d.d_size)) + { + __libelf_seterrno (ELF_E_INVALID_INDEX); + goto out; + } + + ((Elf64_auxv_t *) data_scn->d.d_buf)[ndx] = *src; + } + + result = 1; + + /* Mark the section as modified. */ + scn->flags |= ELF_F_DIRTY; + + out: + rwlock_unlock (scn->elf->lock); + + return result; +} diff --git a/libelf/gelf_update_dyn.c b/libelf/gelf_update_dyn.c index b066fd62..10bfb6ab 100644 --- a/libelf/gelf_update_dyn.c +++ b/libelf/gelf_update_dyn.c @@ -1,19 +1,52 @@ /* Update information in dynamic table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_ehdr.c b/libelf/gelf_update_ehdr.c index e13121d0..4d5c2b6c 100644 --- a/libelf/gelf_update_ehdr.c +++ b/libelf/gelf_update_ehdr.c @@ -1,19 +1,52 @@ /* Update ELF header. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_lib.c b/libelf/gelf_update_lib.c index 08ce2296..9571016f 100644 --- a/libelf/gelf_update_lib.c +++ b/libelf/gelf_update_lib.c @@ -1,19 +1,52 @@ /* Update library in table at the given index. Copyright (C) 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_move.c b/libelf/gelf_update_move.c index 090e3975..fd67be10 100644 --- a/libelf/gelf_update_move.c +++ b/libelf/gelf_update_move.c @@ -1,19 +1,52 @@ /* Update move structure at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_phdr.c b/libelf/gelf_update_phdr.c index ddd4e1ee..e8b7f788 100644 --- a/libelf/gelf_update_phdr.c +++ b/libelf/gelf_update_phdr.c @@ -1,19 +1,52 @@ /* Update program header program header table entry. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -61,7 +94,7 @@ gelf_update_phdr (Elf *elf, int ndx, GElf_Phdr *src) if (phdr == NULL) { - phdr = INTUSE(elf32_getphdr) (elf); + phdr = __elf32_getphdr_wrlock (elf); if (phdr == NULL) /* The error number is already set. */ goto out; @@ -94,7 +127,7 @@ gelf_update_phdr (Elf *elf, int ndx, GElf_Phdr *src) if (phdr == NULL) { - phdr = INTUSE(elf64_getphdr) (elf); + phdr = __elf64_getphdr_wrlock (elf); if (phdr == NULL) /* The error number is already set. */ goto out; diff --git a/libelf/gelf_update_rel.c b/libelf/gelf_update_rel.c index c59c6dd4..049b71a1 100644 --- a/libelf/gelf_update_rel.c +++ b/libelf/gelf_update_rel.c @@ -1,19 +1,52 @@ /* Update REL relocation information at given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_rela.c b/libelf/gelf_update_rela.c index f932c018..dc99c681 100644 --- a/libelf/gelf_update_rela.c +++ b/libelf/gelf_update_rela.c @@ -1,19 +1,52 @@ /* Update RELA relocation information at given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_shdr.c b/libelf/gelf_update_shdr.c index c54e8c52..c57eab80 100644 --- a/libelf/gelf_update_shdr.c +++ b/libelf/gelf_update_shdr.c @@ -1,19 +1,52 @@ /* Update section header. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -39,7 +72,8 @@ gelf_update_shdr (Elf_Scn *scn, GElf_Shdr *src) if (elf->class == ELFCLASS32) { - Elf32_Shdr *shdr = scn->shdr.e32 ?: INTUSE(elf32_getshdr) (scn); + Elf32_Shdr *shdr + = scn->shdr.e32 ?: __elf32_getshdr_wrlock (scn); if (shdr == NULL) { @@ -73,7 +107,8 @@ gelf_update_shdr (Elf_Scn *scn, GElf_Shdr *src) } else { - Elf64_Shdr *shdr = scn->shdr.e64 ?: INTUSE(elf64_getshdr) (scn); + Elf64_Shdr *shdr + = scn->shdr.e64 ?: __elf64_getshdr_wrlock (scn); if (shdr == NULL) { diff --git a/libelf/gelf_update_sym.c b/libelf/gelf_update_sym.c index 8fc7dd66..fff45fdb 100644 --- a/libelf/gelf_update_sym.c +++ b/libelf/gelf_update_sym.c @@ -1,19 +1,52 @@ /* Update symbol information in symbol table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_syminfo.c b/libelf/gelf_update_syminfo.c index a60aa5c5..a0e176dc 100644 --- a/libelf/gelf_update_syminfo.c +++ b/libelf/gelf_update_syminfo.c @@ -1,19 +1,52 @@ /* Update additional symbol information in symbol table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_symshndx.c b/libelf/gelf_update_symshndx.c index 4f376150..2d393c1f 100644 --- a/libelf/gelf_update_symshndx.c +++ b/libelf/gelf_update_symshndx.c @@ -1,20 +1,53 @@ /* Update symbol information and section index in symbol table at the given index. Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_verdaux.c b/libelf/gelf_update_verdaux.c index e21428e0..17866efc 100644 --- a/libelf/gelf_update_verdaux.c +++ b/libelf/gelf_update_verdaux.c @@ -1,19 +1,52 @@ /* Update additional symbol version definition information. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_verdef.c b/libelf/gelf_update_verdef.c index 833a058b..cd19cb75 100644 --- a/libelf/gelf_update_verdef.c +++ b/libelf/gelf_update_verdef.c @@ -1,19 +1,52 @@ /* Update symbol version definition information. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_vernaux.c b/libelf/gelf_update_vernaux.c index 3f506d48..2be69e1e 100644 --- a/libelf/gelf_update_vernaux.c +++ b/libelf/gelf_update_vernaux.c @@ -1,19 +1,52 @@ /* Update additional required symbol version information. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_verneed.c b/libelf/gelf_update_verneed.c index 6fccd937..95f2d18f 100644 --- a/libelf/gelf_update_verneed.c +++ b/libelf/gelf_update_verneed.c @@ -1,19 +1,52 @@ /* Update required symbol version information. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_update_versym.c b/libelf/gelf_update_versym.c index 404d5bc3..905c8f78 100644 --- a/libelf/gelf_update_versym.c +++ b/libelf/gelf_update_versym.c @@ -1,19 +1,52 @@ /* Update symbol version information. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c index 25284b4d..48a790c6 100644 --- a/libelf/gelf_xlate.c +++ b/libelf/gelf_xlate.c @@ -1,27 +1,61 @@ /* Transformation functions for ELF data types. - Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, Inc. + Copyright (C) 1998,1999,2000,2002,2004,2005,2006,2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif -//#include <byteswap.h> +#include <byteswap.h> #include <stdint.h> #include <string.h> +#include <stdlib.h> #include "libelfP.h" @@ -36,7 +70,8 @@ ? (void) (*((char *) (dest)) = *((char *) (src))) \ : Elf32_cvt_Byte (dest, src, n)) static void -(elf_cvt_Byte) (void *dest, const void *src, size_t n, int encode) +(elf_cvt_Byte) (void *dest, const void *src, size_t n, + int encode __attribute__ ((unused))) { memmove (dest, src, n); } @@ -46,15 +81,25 @@ static void bit. We need only functions for 16, 32, and 64 bits. The functions referenced in the table will be aliases for one of these functions. Which one is decided by the ELFxx_FSZ_type. */ -#define LEN2_SWAP(Src) bswap_16 (*((uint16_t *) Src)) -#define word2_t uint16_t -#define LEN4_SWAP(Src) bswap_32 (*((uint32_t *) Src)) -#define word4_t uint32_t +#if ALLOW_UNALIGNED + +#define FETCH(Bits, ptr) (*(const uint##Bits##_t *) ptr) +#define STORE(Bits, ptr, val) (*(uint##Bits##_t *) ptr = val) + +#else + +union unaligned + { + uint16_t u16; + uint32_t u32; + uint64_t u64; + } __attribute__ ((packed)); -#define LEN8_SWAP(Src) bswap_64 (*((uint64_t *) Src)) -#define word8_t uint64_t +#define FETCH(Bits, ptr) (((const union unaligned *) ptr)->u##Bits) +#define STORE(Bits, ptr, val) (((union unaligned *) ptr)->u##Bits = val) +#endif /* Now define the conversion functions for the basic types. We use here the fact that file and memory types are the same and that we have the @@ -66,36 +111,41 @@ static void INLINE2 (ELFW2(Bits,FSZ_##NAME), ElfW2(Bits,cvt_##Name), ElfW2(Bits,Name)) #define INLINE2(Bytes, FName, TName) \ INLINE3 (Bytes, FName, TName) -#define INLINE3(Bytes, FName, TName) \ - static void FName (void *dest, const void *ptr, size_t len, int encode) \ +#define INLINE3(Bytes, FName, TName) \ + static inline void FName##1 (void *dest, const void *ptr) \ { \ - size_t n = len / sizeof (TName); \ - if (dest < ptr) \ + switch (Bytes) \ { \ - word##Bytes##_t *tdest = (word##Bytes##_t *) dest; \ - const word##Bytes##_t *tptr = (const word##Bytes##_t *) ptr; \ - while (n-- > 0) \ - { \ - *tdest++ = LEN##Bytes##_SWAP (tptr); \ - tptr++; \ - } \ + case 2: STORE (16, dest, bswap_16 (FETCH (16, ptr))); break; \ + case 4: STORE (32, dest, bswap_32 (FETCH (32, ptr))); break; \ + case 8: STORE (64, dest, bswap_64 (FETCH (64, ptr))); break; \ + default: \ + abort (); \ } \ + } \ + \ + static void FName (void *dest, const void *ptr, size_t len, \ + int encode __attribute__ ((unused))) \ + { \ + size_t n = len / sizeof (TName); \ + if (dest < ptr) \ + while (n-- > 0) \ + { \ + FName##1 (dest, ptr); \ + dest += Bytes; \ + ptr += Bytes; \ + } \ else \ { \ - word##Bytes##_t *tdest = (word##Bytes##_t *) dest + n; \ - const word##Bytes##_t *tptr = (const word##Bytes##_t *) ptr + n; \ + dest += len; \ + ptr += len; \ while (n-- > 0) \ { \ - --tptr; \ - *--tdest = LEN##Bytes##_SWAP (tptr); \ + ptr -= Bytes; \ + dest -= Bytes; \ + FName##1 (dest, ptr); \ } \ } \ - } \ - \ - static inline void FName##1 (void *dest, const void *ptr) \ - { \ - *((word##Bytes##_t *) dest) = \ - LEN##Bytes##_SWAP ((((word##Bytes##_t *) ptr))); \ } @@ -105,11 +155,11 @@ static void #define START(Bits, Name, EName) \ static void \ ElfW2 (Bits, cvt_##Name) (void *dest, const void *src, size_t len, \ - int encode) \ + int encode __attribute__ ((unused))) \ { ElfW2(Bits, Name) *tdest = (ElfW2(Bits, Name) *) dest; \ ElfW2(Bits, Name) *tsrc = (ElfW2(Bits, Name) *) src; \ - size_t n = len / sizeof (ElfW2(Bits, Name)); \ - for (; n > 0; ++tdest, ++tsrc, --n) { + size_t n; \ + for (n = len / sizeof (ElfW2(Bits, Name)); n > 0; ++tdest, ++tsrc, --n) { #define END(Bits, Name) } } #define TYPE_EXTRA(Code) #define TYPE_XLATE(Code) Code @@ -134,6 +184,8 @@ static void /* We have a few functions which we must create by hand since the sections do not contain records of only one type. */ #include "version_xlate.h" +#include "gnuhash_xlate.h" +#include "note_xlate.h" /* Now the externally visible table with the function pointers. */ @@ -162,19 +214,26 @@ const xfct_t __elf_xfctstom[EV_NUM - 1][EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] [ELF_T_VDAUX] = elf_cvt_Verdef, \ [ELF_T_VNEED] = elf_cvt_Verneed, \ [ELF_T_VNAUX] = elf_cvt_Verneed, \ - [ELF_T_NHDR] = ElfW2(Bits, cvt_Nhdr), \ + [ELF_T_NHDR] = elf_cvt_note, \ [ELF_T_SYMINFO] = ElfW2(Bits, cvt_Syminfo), \ [ELF_T_MOVE] = ElfW2(Bits, cvt_Move), \ - [ELF_T_LIB] = ElfW2(Bits, cvt_Lib) - define_xfcts (32) + [ELF_T_LIB] = ElfW2(Bits, cvt_Lib), \ + [ELF_T_AUXV] = ElfW2(Bits, cvt_auxv_t) + define_xfcts (32), + [ELF_T_GNUHASH] = Elf32_cvt_Word }, [ELFCLASS64 - 1] = { - define_xfcts (64) + define_xfcts (64), + [ELF_T_GNUHASH] = elf_cvt_gnuhash } } } }; +/* ANDROID_CHANGE_BEGIN */ +#ifndef __APPLE__ /* For now we only handle the case where the memory representation is the same as the file representation. Should this change we have to define separate functions. For now reuse them. */ -//strong_alias (__elf_xfctstom, __elf_xfctstof) +strong_alias (__elf_xfctstom, __elf_xfctstof) +#endif +/* ANDROID_CHANGE_END */ diff --git a/libelf/gelf_xlate.h b/libelf/gelf_xlate.h index 42e91c08..e7659f12 100644 --- a/libelf/gelf_xlate.h +++ b/libelf/gelf_xlate.h @@ -1,19 +1,52 @@ /* Helper file for type conversion function generation. - Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ /* Simple types. */ @@ -37,6 +70,7 @@ TYPE (Dyn, LIBELFBITS) TYPE (Syminfo, LIBELFBITS) TYPE (Move, LIBELFBITS) TYPE (Lib, LIBELFBITS) +TYPE (auxv_t, LIBELFBITS) /* Prepare for the next round. */ diff --git a/libelf/gelf_xlatetof.c b/libelf/gelf_xlatetof.c index 53cfae2e..e7f8238c 100644 --- a/libelf/gelf_xlatetof.c +++ b/libelf/gelf_xlatetof.c @@ -1,19 +1,52 @@ /* Convert from memory to file representation. Generic ELF version. Copyright (C) 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gelf_xlatetom.c b/libelf/gelf_xlatetom.c index 9295ee09..b7da1b29 100644 --- a/libelf/gelf_xlatetom.c +++ b/libelf/gelf_xlatetom.c @@ -1,19 +1,52 @@ /* Convert from file to memory representation. Generic ELF version. Copyright (C) 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h new file mode 100644 index 00000000..d79764d8 --- /dev/null +++ b/libelf/gnuhash_xlate.h @@ -0,0 +1,95 @@ +/* Conversion functions for versioning information. + Copyright (C) 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2006. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <assert.h> +#include <gelf.h> + +#include "libelfP.h" + + +static void +elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode) +{ + /* The GNU hash table format on 64 bit machines mixes 32 bit and 64 bit + words. We must detangle them here. */ + Elf32_Word *dest32 = dest; + const Elf32_Word *src32 = src; + + /* First four control words, 32 bits. */ + for (unsigned int cnt = 0; cnt < 4; ++cnt) + { + if (len < 4) + return; + dest32[cnt] = bswap_32 (src32[cnt]); + len -= 4; + } + + Elf32_Word bitmask_words = encode ? src32[2] : dest32[2]; + + /* Now the 64 bit words. */ + Elf64_Xword *dest64 = (Elf64_Xword *) &dest32[4]; + const Elf64_Xword *src64 = (const Elf64_Xword *) &src32[4]; + for (unsigned int cnt = 0; cnt < bitmask_words; ++cnt) + { + if (len < 8) + return; + dest64[cnt] = bswap_64 (src64[cnt]); + len -= 8; + } + + /* The rest are 32 bit words again. */ + src32 = (const Elf32_Word *) &src64[bitmask_words]; + dest32 = (Elf32_Word *) &dest64[bitmask_words]; + while (len >= 4) + { + *dest32++ = bswap_32 (*src32++); + len -= 4; + } +} diff --git a/libelf/libelf.h b/libelf/libelf.h index 5b3dc00b..dea0d838 100644 --- a/libelf/libelf.h +++ b/libelf/libelf.h @@ -1,18 +1,51 @@ /* Interface for libelf. - Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBELF_H #define _LIBELF_H 1 @@ -49,6 +82,8 @@ typedef enum ELF_T_SYMINFO, /* Elf32_Syminfo, Elf64_Syminfo, ... */ ELF_T_MOVE, /* Elf32_Move, Elf64_Move, ... */ ELF_T_LIB, /* Elf32_Lib, Elf64_Lib, ... */ + ELF_T_GNUHASH, /* GNU-style hash section. */ + ELF_T_AUXV, /* Elf32_auxv_t, Elf64_auxv_t, ... */ /* Keep this the last entry. */ ELF_T_NUM } Elf_Type; @@ -60,7 +95,7 @@ typedef struct Elf_Type d_type; /* Type of this piece of data. */ unsigned int d_version; /* ELF version. */ size_t d_size; /* Size in bytes. */ - off_t d_off; /* Offset into section. */ + loff_t d_off; /* Offset into section. */ size_t d_align; /* Alignment in section. */ } Elf_Data; @@ -122,7 +157,7 @@ typedef struct uid_t ar_uid; /* User ID. */ gid_t ar_gid; /* Group ID. */ mode_t ar_mode; /* File mode. */ - off_t ar_size; /* File size. */ + loff_t ar_size; /* File size. */ char *ar_rawname; /* Original name of archive member. */ } Elf_Arhdr; @@ -163,17 +198,17 @@ extern Elf_Cmd elf_next (Elf *__elf); extern int elf_end (Elf *__elf); /* Update ELF descriptor and write file to disk. */ -extern off_t elf_update (Elf *__elf, Elf_Cmd __cmd); +extern loff_t elf_update (Elf *__elf, Elf_Cmd __cmd); /* Determine what kind of file is associated with ELF. */ extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__)); /* Get the base offset for an object file. */ -extern off_t elf_getbase (Elf *__elf); +extern loff_t elf_getbase (Elf *__elf); /* Retrieve file identification data. */ -extern char *elf_getident (Elf *__elf, size_t *__ptr); +extern char *elf_getident (Elf *__elf, size_t *__nbytes); /* Retrieve class-dependent object file header. */ extern Elf32_Ehdr *elf32_getehdr (Elf *__elf); @@ -199,6 +234,11 @@ extern Elf64_Phdr *elf64_newphdr (Elf *__elf, size_t __cnt); /* Get section at INDEX. */ extern Elf_Scn *elf_getscn (Elf *__elf, size_t __index); +/* Get section at OFFSET. */ +extern Elf_Scn *elf32_offscn (Elf *__elf, Elf32_Off __offset); +/* Similar bug this time the binary calls is ELFCLASS64. */ +extern Elf_Scn *elf64_offscn (Elf *__elf, Elf64_Off __offset); + /* Get index of section. */ extern size_t elf_ndxscn (Elf_Scn *__scn); @@ -208,6 +248,10 @@ extern Elf_Scn *elf_nextscn (Elf *__elf, Elf_Scn *__scn); /* Create a new section and append it at the end of the table. */ extern Elf_Scn *elf_newscn (Elf *__elf); +/* Get the section index of the extended section index table for the + given symbol table. */ +extern int elf_scnshndx (Elf_Scn *__scn); + /* Get the number of sections in the ELF file. If the file uses more sections than can be represented in the e_shnum field of the ELF header the information from the sh_size field in the zeroth section @@ -258,6 +302,13 @@ extern Elf_Data *elf_rawdata (Elf_Scn *__scn, Elf_Data *__data); /* Create new data descriptor for section SCN. */ extern Elf_Data *elf_newdata (Elf_Scn *__scn); +/* Get data translated from a chunk of the file contents as section data + would be for TYPE. The resulting Elf_Data pointer is valid until + elf_end (ELF) is called. */ +extern Elf_Data *elf_getdata_rawchunk (Elf *__elf, + loff_t __offset, size_t __size, + Elf_Type __type); + /* Return pointer to string at OFFSET in section INDEX. */ extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset); @@ -266,18 +317,21 @@ extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset); /* Return header of archive. */ extern Elf_Arhdr *elf_getarhdr (Elf *__elf); +/* Return offset in archive for current file ELF. */ +extern loff_t elf_getaroff (Elf *__elf); + /* Select archive element at OFFSET. */ extern size_t elf_rand (Elf *__elf, size_t __offset); -/* Get symbol table of archhive. */ -extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__ptr); +/* Get symbol table of archive. */ +extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__narsyms); /* Control ELF descriptor. */ extern int elf_cntl (Elf *__elf, Elf_Cmd __cmd); /* Retrieve uninterpreted file contents. */ -extern char *elf_rawfile (Elf *__elf, size_t *__ptr); +extern char *elf_rawfile (Elf *__elf, size_t *__nbytes); /* Return size of array of COUNT elements of the type denoted by TYPE @@ -330,6 +384,10 @@ extern void elf_fill (int __fill); extern unsigned long int elf_hash (const char *__string) __attribute__ ((__pure__)); +/* Compute hash value using the GNU-specific hash function. */ +extern unsigned long int elf_gnu_hash (const char *__string) + __attribute__ ((__pure__)); + /* Compute simple checksum from permanent parts of the ELF file. */ extern long int elf32_checksum (Elf *__elf); diff --git a/libelf/libelf.map b/libelf/libelf.map index f416da7f..c2537774 100644 --- a/libelf/libelf.map +++ b/libelf/libelf.map @@ -55,7 +55,6 @@ ELFUTILS_1.0 { elf_update; elf_version; gelf_checksum; - gelf_freechunk; gelf_fsize; gelf_getclass; gelf_getdyn; @@ -75,7 +74,6 @@ ELFUTILS_1.0 { gelf_getversym; gelf_newehdr; gelf_newphdr; - gelf_rawchunk; gelf_update_dyn; gelf_update_ehdr; gelf_update_move; @@ -104,3 +102,29 @@ ELFUTILS_1.1 { gelf_getlib; gelf_update_lib; } ELFUTILS_1.0; + +ELFUTILS_1.1.1 { + global: + elf32_offscn; + elf64_offscn; + gelf_offscn; + elf_getaroff; +} ELFUTILS_1.1; + +ELFUTILS_1.2 { + global: + elf_gnu_hash; +} ELFUTILS_1.1.1; + +ELFUTILS_1.3 { + global: + elf_getdata_rawchunk; + gelf_getauxv; + gelf_update_auxv; + gelf_getnote; +} ELFUTILS_1.2; + +ELFUTILS_1.4 { + global: + elf_scnshndx; +} ELFUTILS_1.3; diff --git a/libelf/libelfP.h b/libelf/libelfP.h index fd39a38f..e8100397 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -1,26 +1,67 @@ /* Internal interfaces for libelf. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. + Copyright (C) 1998-2003, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _LIBELFP_H #define _LIBELFP_H 1 +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <ar.h> #include <gelf.h> + +#include <errno.h> #include <stdint.h> +#include <stdio.h> +#include <string.h> /* gettext helper macros. */ #define _(Str) dgettext ("libelf", Str) @@ -117,6 +158,7 @@ enum ELF_E_GROUP_NOT_REL, ELF_E_INVALID_PHDR, ELF_E_NO_PHDR, + ELF_E_INVALID_OFFSET, /* Keep this as the last entry. */ ELF_E_NUM }; @@ -190,6 +232,9 @@ struct Elf_Scn int data_read; /* Nonzero if the section was created by the user or if the data from the file/memory is read. */ + int shndx_index; /* Index of the extended section index + table for this symbol table (if this + section is a symbol table). */ size_t index; /* Index of this section. */ struct Elf *elf; /* The underlying ELF file. */ @@ -221,6 +266,18 @@ typedef struct Elf_ScnList } Elf_ScnList; +/* elf_getdata_rawchunk result. */ +typedef struct Elf_Data_Chunk +{ + Elf_Data_Scn data; + union + { + Elf_Scn dummy_scn; + struct Elf_Data_Chunk *next; + }; +} Elf_Data_Chunk; + + /* The ELF descriptor. */ struct Elf { @@ -279,6 +336,7 @@ struct Elf Elf_ScnList *scns_last; /* Last element in the section list. If NULL the data has not yet been read from the file. */ + Elf_Data_Chunk *rawchunks; /* List of elf_getdata_rawchunk results. */ unsigned int scnincr; /* Number of sections allocate the last time. */ off64_t sizestr_offset; /* Offset of the size string in the parent @@ -298,6 +356,7 @@ struct Elf Elf_ScnList *scns_last; /* Last element in the section list. If NULL the data has not yet been read from the file. */ + Elf_Data_Chunk *rawchunks; /* List of elf_getdata_rawchunk results. */ unsigned int scnincr; /* Number of sections allocate the last time. */ off64_t sizestr_offset; /* Offset of the size string in the parent @@ -323,6 +382,7 @@ struct Elf Elf_ScnList *scns_last; /* Last element in the section list. If NULL the data has not yet been read from the file. */ + Elf_Data_Chunk *rawchunks; /* List of elf_getdata_rawchunk results. */ unsigned int scnincr; /* Number of sections allocate the last time. */ off64_t sizestr_offset; /* Offset of the size string in the parent @@ -358,7 +418,6 @@ struct Elf /* There absolutely never must be anything following the union. */ }; - /* Type of the conversion functions. These functions will convert the byte order. */ typedef void (*xfct_t) (void *, const void *, size_t, int); @@ -389,6 +448,22 @@ extern int __libelf_fill_byte attribute_hidden; /* Nonzero if the version was set. */ extern int __libelf_version_initialized attribute_hidden; +/* Index for __libelf_type_sizes et al. */ +#if EV_NUM == 2 +# define LIBELF_EV_IDX 0 +#else +# define LIBELF_EV_IDX (__libelf_version - 1) +#endif + +#if !ALLOW_UNALIGNED +/* Array with alignment requirements of the internal types indexed by ELF + version, binary class, and type. */ +extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden; +# define __libelf_type_align(class, type) \ + (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1) +#else +# define __libelf_type_align(class, type) 1 +#endif /* The libelf API does not have such a function but it is still useful. Get the memory size for the given type. @@ -411,7 +486,7 @@ extern Elf *__libelf_read_mmaped_file (int fildes, void *map_address, extern void __libelf_seterrno (int value) internal_function; /* Get the next archive header. */ -extern int __libelf_next_arhdr (Elf *elf) internal_function; +extern int __libelf_next_arhdr_wrlock (Elf *elf) internal_function; /* Read all of the file associated with the descriptor. */ extern char *__libelf_readall (Elf *elf) internal_function; @@ -421,13 +496,14 @@ extern int __libelf_readsections (Elf *elf) internal_function; /* Store the information for the raw data in the `rawdata_list' element. */ extern int __libelf_set_rawdata (Elf_Scn *scn) internal_function; +extern int __libelf_set_rawdata_wrlock (Elf_Scn *scn) internal_function; /* Helper functions for elf_update. */ -extern off_t __elf32_updatenull (Elf *elf, int *change_bop, size_t shnum) - internal_function; -extern off_t __elf64_updatenull (Elf *elf, int *change_bop, size_t shnum) - internal_function; +extern off_t __elf32_updatenull_wrlock (Elf *elf, int *change_bop, + size_t shnum) internal_function; +extern off_t __elf64_updatenull_wrlock (Elf *elf, int *change_bop, + size_t shnum) internal_function; extern int __elf32_updatemmap (Elf *elf, int change_bo, size_t shnum) internal_function; @@ -439,31 +515,43 @@ extern int __elf64_updatefile (Elf *elf, int change_bo, size_t shnum) internal_function; -/* Alias for exported functions to avoid PLT entries. */ +/* Alias for exported functions to avoid PLT entries, and + rdlock/wrlock variants of these functions. */ +extern int __elf_end_internal (Elf *__elf) attribute_hidden; extern Elf *__elf_begin_internal (int __fildes, Elf_Cmd __cmd, Elf *__ref) attribute_hidden; -extern Elf32_Ehdr *__elf32_getehdr_internal (Elf *__elf) attribute_hidden; -extern Elf64_Ehdr *__elf64_getehdr_internal (Elf *__elf) attribute_hidden; +extern Elf32_Ehdr *__elf32_getehdr_wrlock (Elf *__elf) internal_function; +extern Elf64_Ehdr *__elf64_getehdr_wrlock (Elf *__elf) internal_function; extern Elf32_Ehdr *__elf32_newehdr_internal (Elf *__elf) attribute_hidden; extern Elf64_Ehdr *__elf64_newehdr_internal (Elf *__elf) attribute_hidden; extern Elf32_Phdr *__elf32_getphdr_internal (Elf *__elf) attribute_hidden; extern Elf64_Phdr *__elf64_getphdr_internal (Elf *__elf) attribute_hidden; +extern Elf32_Phdr *__elf32_getphdr_wrlock (Elf *__elf) attribute_hidden; +extern Elf64_Phdr *__elf64_getphdr_wrlock (Elf *__elf) attribute_hidden; extern Elf32_Phdr *__elf32_newphdr_internal (Elf *__elf, size_t __cnt) attribute_hidden; extern Elf64_Phdr *__elf64_newphdr_internal (Elf *__elf, size_t __cnt) attribute_hidden; -extern int __elf_getshnum_internal (Elf *__elf, size_t *__dst) - attribute_hidden; +extern Elf_Scn *__elf32_offscn_internal (Elf *__elf, Elf32_Off __offset) + attribute_hidden; +extern Elf_Scn *__elf64_offscn_internal (Elf *__elf, Elf64_Off __offset) + attribute_hidden; +extern int __elf_getshnum_rdlock (Elf *__elf, size_t *__dst) internal_function; extern int __elf_getshstrndx_internal (Elf *__elf, size_t *__dst) attribute_hidden; -extern Elf32_Shdr *__elf32_getshdr_internal (Elf_Scn *__scn) attribute_hidden; -extern Elf64_Shdr *__elf64_getshdr_internal (Elf_Scn *__scn) attribute_hidden; +extern Elf32_Shdr *__elf32_getshdr_rdlock (Elf_Scn *__scn) internal_function; +extern Elf64_Shdr *__elf64_getshdr_rdlock (Elf_Scn *__scn) internal_function; +extern Elf32_Shdr *__elf32_getshdr_wrlock (Elf_Scn *__scn) internal_function; +extern Elf64_Shdr *__elf64_getshdr_wrlock (Elf_Scn *__scn) internal_function; extern Elf_Scn *__elf_getscn_internal (Elf *__elf, size_t __index) attribute_hidden; extern Elf_Scn *__elf_nextscn_internal (Elf *__elf, Elf_Scn *__scn) attribute_hidden; +extern int __elf_scnshndx_internal (Elf_Scn *__scn) attribute_hidden; extern Elf_Data *__elf_getdata_internal (Elf_Scn *__scn, Elf_Data *__data) attribute_hidden; +extern Elf_Data *__elf_getdata_rdlock (Elf_Scn *__scn, Elf_Data *__data) + internal_function; extern Elf_Data *__elf_rawdata_internal (Elf_Scn *__scn, Elf_Data *__data) attribute_hidden; extern char *__elf_strptr_internal (Elf *__elf, size_t __index, @@ -492,6 +580,8 @@ extern long int __elf32_checksum_internal (Elf *__elf) attribute_hidden; extern long int __elf64_checksum_internal (Elf *__elf) attribute_hidden; +extern GElf_Ehdr *__gelf_getehdr_rdlock (Elf *__elf, GElf_Ehdr *__dest) + internal_function; extern size_t __gelf_fsize_internal (Elf *__elf, Elf_Type __type, size_t __count, unsigned int __version) attribute_hidden; @@ -506,9 +596,8 @@ extern uint32_t __libelf_crc32 (uint32_t crc, unsigned char *buf, size_t len) /* We often have to update a flag iff a value changed. Make this - convenient. None of the parameters must have a side effect. */ -#ifdef __GNUC__ -# define update_if_changed(var, exp, flag) \ + convenient. */ +#define update_if_changed(var, exp, flag) \ do { \ __typeof__ (var) *_var = &(var); \ __typeof__ (exp) _exp = (exp); \ @@ -518,15 +607,8 @@ extern uint32_t __libelf_crc32 (uint32_t crc, unsigned char *buf, size_t len) (flag) |= ELF_F_DIRTY; \ } \ } while (0) -#else -# define update_if_changed(var, exp, flag) \ - do { \ - if ((var) != (exp)) \ - { \ - (var) = (exp); \ - (flag) |= ELF_F_DIRTY; \ - } \ - } while (0) -#endif + +/* Align offset to 4 bytes as needed for note name and descriptor data. */ +#define NOTE_ALIGN(n) (((n) + 3) & -4U) #endif /* libelfP.h */ diff --git a/libelf/libelf_crc32.c b/libelf/libelf_crc32.c index 6971be07..10ce34c6 100644 --- a/libelf/libelf_crc32.c +++ b/libelf/libelf_crc32.c @@ -1,17 +1,50 @@ /* Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/libelf_next_prime.c b/libelf/libelf_next_prime.c index 4a71c477..1b96012c 100644 --- a/libelf/libelf_next_prime.c +++ b/libelf/libelf_next_prime.c @@ -1,17 +1,50 @@ /* Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/libelf/nlist.c b/libelf/nlist.c index cc42a31e..f1fe1763 100644 --- a/libelf/nlist.c +++ b/libelf/nlist.c @@ -1,19 +1,52 @@ /* Extract symbol list from binary. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -75,7 +108,7 @@ nlist (const char *filename, struct nlist *nl) /* Now get an ELF descriptor. */ elf = INTUSE(elf_begin) (fd, ELF_C_READ_MMAP, NULL); if (elf == NULL) - goto fail; + goto fail_fd; /* Find a symbol table. We prefer the real symbol table but if it does not exist use the dynamic symbol table. */ @@ -195,7 +228,10 @@ nlist (const char *filename, struct nlist *nl) nlist_fshash_fini (table); /* We do not need the ELF descriptor anymore. */ - (void) elf_end (elf); + (void) INTUSE(elf_end) (elf); + + /* Neither the file descriptor. */ + (void) close (fd); return 0; @@ -204,7 +240,11 @@ nlist (const char *filename, struct nlist *nl) fail_close: /* We do not need the ELF descriptor anymore. */ - (void) elf_end (elf); + (void) INTUSE(elf_end) (elf); + + fail_fd: + /* Neither the file descriptor. */ + (void) close (fd); fail: /* We have to set all entries to zero. */ diff --git a/libelf/nlist.h b/libelf/nlist.h index 298f9a24..ce6569ef 100644 --- a/libelf/nlist.h +++ b/libelf/nlist.h @@ -1,18 +1,51 @@ /* Interface for nlist. Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. - 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, version 2. + Red Hat elfutils 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; version 2 of the License. - 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. + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _NLIST_H #define _NLIST_H 1 diff --git a/libelf/note_xlate.h b/libelf/note_xlate.h new file mode 100644 index 00000000..6e8b78c6 --- /dev/null +++ b/libelf/note_xlate.h @@ -0,0 +1,80 @@ +/* Conversion functions for notes. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +static void +elf_cvt_note (void *dest, const void *src, size_t len, int encode) +{ + assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr)); + + while (len > 0) + { + (1 ? Elf32_cvt_Nhdr : Elf64_cvt_Nhdr) (dest, src, sizeof (Elf32_Nhdr), + encode); + const Elf32_Nhdr *n = encode ? src : dest; + Elf32_Word namesz = NOTE_ALIGN (n->n_namesz); + Elf32_Word descsz = NOTE_ALIGN (n->n_descsz); + + len -= sizeof *n; + src += sizeof *n; + dest += sizeof *n; + + if (namesz > len) + break; + len -= namesz; + if (descsz > len) + break; + len -= descsz; + + if (src != dest) + memcpy (dest, src, namesz + descsz); + + src += namesz + descsz; + dest += namesz + descsz; + } +} diff --git a/libelf/version_xlate.h b/libelf/version_xlate.h index 2366cbf2..b32cacdc 100644 --- a/libelf/version_xlate.h +++ b/libelf/version_xlate.h @@ -1,19 +1,52 @@ /* Conversion functions for versioning information. Copyright (C) 1998, 1999, 2000, 2002, 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - 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, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <assert.h> #include <gelf.h> diff --git a/m4/ChangeLog b/m4/ChangeLog index 53721633..e285a0e4 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,15 +1,28 @@ -2002-03-22 gettextize <bug-gnu-gettext@gnu.org> +2007-06-05 Ulrich Drepper <drepper@redhat.com> - * codeset.m4: Upgrade to gettext-0.11. - * gettext.m4: Upgrade to gettext-0.11. - * glibc21.m4: Upgrade to gettext-0.11. - * iconv.m4: Upgrade to gettext-0.11. - * isc-posix.m4: Upgrade to gettext-0.11. - * lcmessage.m4: Upgrade to gettext-0.11. - * lib-ld.m4: Upgrade to gettext-0.11. - * lib-link.m4: Upgrade to gettext-0.11. - * lib-prefix.m4: Upgrade to gettext-0.11. - * progtest.m4: Upgrade to gettext-0.11. + * gettext.m4: Update from gettext 0.16.1. + * iconv.m4: Likewise. + * progtest.m4: Likewise. + * nls.m4: New file. + * po.m4: New file. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Remove glibc21.m4, intdiv0.m4, + inttypes.m4, inttypes_h.m4, inttypes-pri.m4, isc-posix.m4, + lib-ld.m4, lib-link.m4, lib-prefix.m4, stdint_h.m4, uintmax_t.m4, + and ulonglong.m4. + * glibc21.m4: Removed. + * inttypes_h.m4: Removed. + * inttypes.m4: Removed. + * inttypes-pri.m4: Removed. + * isc-posix.m4: Removed. + * lib-ld.m4: Removed. + * lib-link.m4: Removed. + * lib-prefix.m4: Removed. + * stdint_h.m4: Removed. + * uintmax_t.m4: Removed. + * ulonglong.m4: Removed. 2002-03-22 gettextize <bug-gnu-gettext@gnu.org> @@ -24,4 +37,3 @@ * lib-prefix.m4: Upgrade to gettext-0.11. * progtest.m4: Upgrade to gettext-0.11. * Makefile.am (EXTRA_DIST): Add the new files. - diff --git a/m4/Makefile b/m4/Makefile deleted file mode 100644 index cf2c5ab6..00000000 --- a/m4/Makefile +++ /dev/null @@ -1,314 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# m4/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = m4 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -EXTRA_DIST = isc-posix.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 \ - lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \ - progtest.m4 iconv.m4 intdiv0.m4 inttypes-pri.m4 inttypes.m4 \ - uintmax_t.m4 inttypes_h.m4 stdint_h.m4 ulonglong.m4 - -all: all-am - -.SUFFIXES: -$(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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits m4/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# 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/m4/Makefile.am b/m4/Makefile.am index 9e20ae15..dd955e68 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,24 +1,29 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -## Configure input file for elfutils. ## -## Copyright (C) 2000, 2001, 2002, 2004 Red Hat, Inc. +## Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## 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, version 2. +## Red Hat elfutils 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; version 2 of the License. ## -## 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. +## Red Hat elfutils is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. ## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software Foundation, -## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## ##m4-files-begin -EXTRA_DIST = isc-posix.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 \ - lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \ - progtest.m4 iconv.m4 intdiv0.m4 inttypes-pri.m4 inttypes.m4 \ - uintmax_t.m4 inttypes_h.m4 stdint_h.m4 ulonglong.m4 +EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in index 1712984c..614c5cbe 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,21 +34,17 @@ host_triplet = @host@ subdir = m4 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -61,43 +53,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -106,7 +94,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -114,12 +101,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -132,37 +121,46 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -EXTRA_DIST = isc-posix.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 \ - lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \ - progtest.m4 iconv.m4 intdiv0.m4 inttypes-pri.m4 inttypes.m4 \ - uintmax_t.m4 inttypes_h.m4 stdint_h.m4 ulonglong.m4 - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -187,11 +185,10 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: tags: TAGS TAGS: @@ -200,22 +197,21 @@ CTAGS: distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -274,12 +270,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + 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 + installcheck-am: maintainer-clean: maintainer-clean-am @@ -298,16 +302,19 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + 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 \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am # 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. diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 0b758a67..91c345e9 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,10 +1,8 @@ -# gettext.m4 serial 16 (gettext-0.11.4) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. +# gettext.m4 serial 59 (gettext-0.16.1) +dnl Copyright (C) 1995-2006 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public @@ -17,7 +15,7 @@ dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. -dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. +dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006. dnl Macro to add for using GNU gettext. @@ -65,8 +63,13 @@ AC_DEFUN([AM_GNU_GETTEXT], ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) - define(gt_included_intl, ifelse([$1], [external], [no], [yes])) - define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + define([gt_included_intl], + ifelse([$1], [external], + ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), + [yes])) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ @@ -80,7 +83,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then - dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: @@ -92,13 +95,11 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no @@ -108,6 +109,15 @@ AC_DEFUN([AM_GNU_GETTEXT], LTLIBINTL= POSUB= + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no @@ -126,28 +136,35 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. - dnl Add a version number to the cache macros. - define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) - define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) - define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include <libintl.h> -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_TRY_LINK([#include <libintl.h> +$gt_revision_test_code +extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings;], [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) - if test "$gt_cv_func_gnugettext_libc" != "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK @@ -158,52 +175,40 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, + [$gt_func_gnugettext_libintl], [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include <libintl.h> -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; +$gt_revision_test_code +extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias ();], +const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv. - if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include <libintl.h> -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; +$gt_revision_test_code +extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias ();], +const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext_libintl=yes + eval "$gt_func_gnugettext_libintl=yes" ]) fi CPPFLAGS="$gt_save_CPPFLAGS" @@ -214,9 +219,10 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. @@ -235,14 +241,14 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi + CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. @@ -250,6 +256,15 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", fi ]) + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, @@ -260,10 +275,26 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", fi fi + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) @@ -283,7 +314,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. - if test "$PACKAGE" = gettext; then + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi @@ -291,7 +322,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) - AC_SUBST(INTLOBJS) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -309,6 +339,13 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", GENCAT=gencat AC_SUBST(GENCAT) + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) @@ -325,261 +362,56 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", ]) -dnl Checks for all prerequisites of the po subdirectory, -dnl except for USE_NLS. -AC_DEFUN([AM_PO_SUBDIRS], +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], [ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. - dnl The second test excludes FreeBSD msgfmt. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext 0.11 or newer in the PATH. - dnl The first test excludes Solaris xgettext and early GNU xgettext versions. - dnl The second test excludes FreeBSD xgettext. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - AC_MSG_RESULT( - [found $GMSGFMT program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi + dnl Check for API introduced in MacOS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + gt_cv_func_CFPreferencesCopyAppValue, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], + [CFPreferencesCopyAppValue(NULL, NULL)], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, + [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po + dnl Check for API introduced in MacOS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, + [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi - - AC_OUTPUT_COMMANDS([ - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done], - [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) ]) -dnl Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -AC_DEFUN([AM_INTL_SUBDIR], +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], [ - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl - AC_REQUIRE([gt_INTDIV0])dnl - AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl - AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl - AC_REQUIRE([gt_INTTYPES_PRI])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - if test $ac_cv_header_locale_h = yes; then - AM_LC_MESSAGES - fi - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) ]) -AC_DEFUN([AM_MKINSTALLDIRS], +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], [ - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) ]) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 deleted file mode 100644 index 9c9f3db3..00000000 --- a/m4/glibc21.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# Test for the GNU C Library, version 2.1 or newer. -# From Bruno Haible. - -AC_DEFUN([jm_GLIBC21], - [ - AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, - ac_cv_gnu_library_2_1, - [AC_EGREP_CPP([Lucky GNU user], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif - ], - ac_cv_gnu_library_2_1=yes, - ac_cv_gnu_library_2_1=no) - ] - ) - AC_SUBST(GLIBC21) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) diff --git a/m4/iconv.m4 b/m4/iconv.m4 index c5f35798..654c4158 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,10 +1,8 @@ # iconv.m4 serial AM4 (gettext-0.11.3) dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. +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. diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 deleted file mode 100644 index 55dddcf1..00000000 --- a/m4/intdiv0.m4 +++ /dev/null @@ -1,72 +0,0 @@ -# intdiv0.m4 serial 1 (gettext-0.11.3) -dnl Copyright (C) 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -AC_DEFUN([gt_INTDIV0], -[ - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - - AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], - gt_cv_int_divbyzero_sigfpe, - [ - AC_TRY_RUN([ -#include <stdlib.h> -#include <signal.h> - -static void -#ifdef __cplusplus -sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () -{ - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (1); -} -], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, - [ - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i[34567]86 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - ]) - ]) - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac - AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, - [Define if integer division by zero raises signal SIGFPE.]) -]) diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 deleted file mode 100644 index fd007c31..00000000 --- a/m4/inttypes-pri.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# inttypes-pri.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* -# macros to non-string values. This is the case on AIX 4.3.3. - -AC_DEFUN([gt_INTTYPES_PRI], -[ - AC_REQUIRE([gt_HEADER_INTTYPES_H]) - if test $gt_cv_header_inttypes_h = yes; then - AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], - gt_cv_inttypes_pri_broken, - [ - AC_TRY_COMPILE([#include <inttypes.h> -#ifdef PRId32 -char *p = PRId32; -#endif -], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) - ]) - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then - AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, - [Define if <inttypes.h> exists and defines unusable PRI* macros.]) - fi -]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 deleted file mode 100644 index ab370ffe..00000000 --- a/m4/inttypes.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# inttypes.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with -# <sys/types.h>. - -AC_DEFUN([gt_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, - [ - AC_TRY_COMPILE( - [#include <sys/types.h> -#include <inttypes.h>], - [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) - ]) - if test $gt_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, - [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.]) - fi -]) diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 deleted file mode 100644 index 400a1118..00000000 --- a/m4/inttypes_h.m4 +++ /dev/null @@ -1,28 +0,0 @@ -# inttypes_h.m4 serial 4 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, -# doesn't clash with <sys/types.h>, and declares uintmax_t. - -AC_DEFUN([jm_AC_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, - [AC_TRY_COMPILE( - [#include <sys/types.h> -#include <inttypes.h>], - [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_inttypes_h=yes, - jm_ac_cv_header_inttypes_h=no)]) - if test $jm_ac_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, -[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, - and declares uintmax_t. ]) - fi -]) diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 deleted file mode 100644 index 1319dd1c..00000000 --- a/m4/isc-posix.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 deleted file mode 100644 index ddb57323..00000000 --- a/m4/lib-ld.m4 +++ /dev/null @@ -1,97 +0,0 @@ -# lib-ld.m4 serial 1 (gettext-0.11) -dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - 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. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path 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 "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 deleted file mode 100644 index a16aa446..00000000 --- a/m4/lib-link.m4 +++ /dev/null @@ -1,521 +0,0 @@ -# lib-link.m4 serial 1 (gettext-0.11) -dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L, -dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. -AC_DEFUN([AC_LIB_RPATH], -[ - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" - sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 deleted file mode 100644 index b8b79ab9..00000000 --- a/m4/lib-prefix.m4 +++ /dev/null @@ -1,148 +0,0 @@ -# lib-prefix.m4 serial 1 (gettext-0.11) -dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 00000000..7967cc2f --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,31 @@ +# nls.m4 serial 3 (gettext-0.15) +dnl Copyright (C) 1995-2003, 2005-2006 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 +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. +dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. + +AC_PREREQ(2.50) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 00000000..00133ef3 --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,428 @@ +# po.m4 serial 13 (gettext-0.15) +dnl Copyright (C) 1995-2006 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 +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. +dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. + +AC_PREREQ(2.50) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AM_NLS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat <<EOT +$* +EOT + } + gt_echo='echo_func' + fi + fi + + # A sed script that extracts the value of VARIABLE from a Makefile. + sed_x_variable=' +# Test if the hold space is empty. +x +s/P/P/ +x +ta +# Yes it was empty. Look if we have the expected variable definition. +/^[ ]*VARIABLE[ ]*=/{ + # Seen the first line of the variable definition. + s/^[ ]*VARIABLE[ ]*=// + ba +} +bd +:a +# Here we are processing a line from the variable definition. +# Remove comment, more precisely replace it with a space. +s/#.*$/ / +# See if the line ends in a backslash. +tb +:b +s/\\$// +# Print the line, without the trailing backslash. +p +tc +# There was no trailing backslash. The end of the variable definition is +# reached. Clear the hold space. +s/^.*$// +x +bd +:c +# A trailing backslash means that the variable definition continues in the +# next line. Put a nonempty string into the hold space to indicate this. +s/^.*$/P/ +x +:d +' +changequote([,])dnl + + # Set POTFILES to the value of the Makefile variable POTFILES. + sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'` + POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"` + # Compute POTFILES_DEPS as + # $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) + POTFILES_DEPS= + for file in $POTFILES; do + POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file" + done + POMAKEFILEDEPS="" + + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. + sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` + ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` + fi + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + # Compute PROPERTIESFILES + # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) + # Compute CLASSFILES + # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) + # Compute QMFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) + # Compute MSGFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg) + # Compute RESOURCESDLLFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + PROPERTIESFILES= + CLASSFILES= + QMFILES= + MSGFILES= + RESOURCESDLLFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" + CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" + QMFILES="$QMFILES $srcdirpre$lang.qm" + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + JAVACATALOGS= + QTCATALOGS= + TCLCATALOGS= + CSHARPCATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties" + QTCATALOGS="$QTCATALOGS $lang.qm" + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg" + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll" + done + fi + + sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" <<EOF +$frobbedlang.msg: $lang.po + @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ + \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } +EOF + done + fi + if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <<EOF +$frobbedlang/\$(DOMAIN).resources.dll: $lang.po + @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ + \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } +EOF + done + fi + if test -n "$POMAKEFILEDEPS"; then + cat >> "$ac_file.tmp" <<EOF +Makefile: $POMAKEFILEDEPS +EOF + fi + mv "$ac_file.tmp" "$ac_file" +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 443c8e30..a56365cd 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 @@ -1,10 +1,8 @@ -# progtest.m4 serial 2 (gettext-0.10.40) -dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. +# progtest.m4 serial 4 (gettext-0.14.2) +dnl Copyright (C) 1996-2003, 2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public @@ -18,36 +16,71 @@ dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper <drepper@cygnus.com>, 1996. +AC_PREREQ(2.50) + # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], -[# Extract the first word of "$2", so it can be a program name with args. +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in - /*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in ifelse([$5], , $PATH, [$5]); do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl - ;; + ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 deleted file mode 100644 index 4b5a4ac6..00000000 --- a/m4/stdint_h.m4 +++ /dev/null @@ -1,28 +0,0 @@ -# stdint_h.m4 serial 2 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, -# doesn't clash with <sys/types.h>, and declares uintmax_t. - -AC_DEFUN([jm_AC_HEADER_STDINT_H], -[ - AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, - [AC_TRY_COMPILE( - [#include <sys/types.h> -#include <stdint.h>], - [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_stdint_h=yes, - jm_ac_cv_header_stdint_h=no)]) - if test $jm_ac_cv_header_stdint_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, -[Define if <stdint.h> exists, doesn't clash with <sys/types.h>, - and declares uintmax_t. ]) - fi -]) diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 deleted file mode 100644 index ec3a8b92..00000000 --- a/m4/uintmax_t.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# uintmax_t.m4 serial 6 (gettext-0.11) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -AC_PREREQ(2.13) - -# Define uintmax_t to `unsigned long' or `unsigned long long' -# if <inttypes.h> does not exist. - -AC_DEFUN([jm_AC_TYPE_UINTMAX_T], -[ - AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([jm_AC_HEADER_STDINT_H]) - if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then - AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, - [Define to unsigned long or unsigned long long - if <inttypes.h> and <stdint.h> don't define.]) - fi -]) diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 deleted file mode 100644 index c375e474..00000000 --- a/m4/ulonglong.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) -dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], -[ - AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, - [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], - [unsigned long long ullmax = (unsigned long long) -1; - return ull << i | ull >> i | ullmax / ull | ullmax % ull;], - ac_cv_type_unsigned_long_long=yes, - ac_cv_type_unsigned_long_long=no)]) - if test $ac_cv_type_unsigned_long_long = yes; then - AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, - [Define if you have the unsigned long long type.]) - fi -]) diff --git a/po/ChangeLog b/po/ChangeLog index 179bb950..bbb72fad 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,7 +1,51 @@ +2007-06-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in.in: Update from gettext 0.16.1. + * Rules-quot: Likewise. + * Makevars: Add more XGGETEXT_OPTIONS. + + * remove-potcdata.sin: New file. + + * POTFILES.in: Also include messages from libelf. + +2007-04-18 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in.in: Remove MKINSTALLDIRS. + Define mkinstalldirs to mkdir -p. + +2006-04-04 Roland McGrath <roland@redhat.com> + + * POTFILES.in: Comment out lib/xstrdup.c, not distributed any more. + +2005-08-27 Ulrich Drepper <drepper@redhat.com> + + * POTFILES.in: Add src/strings.c. + +2005-08-15 Ulrich Drepper <drepper@redhat.com> + + * POTFILES.in: Add src/ranlib.c. + +2005-08-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in.in (XGETTEXT_OPTIONS): Move adding of --flag options + after magic Makevars line. Also look for ERROR from elflint. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in.in: Add src/elfcmp. + +2005-05-07 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in.in (XGETTEXT_OPTIONS): Define. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * POTFILES.in: Remove unnecessary entries. + 2004-01-18 Ulrich Drepper <drepper@redhat.com> * POTFILES.in: Add files from libdw, libebl, and libasm. 2003-08-11 Ulrich Drepper <drepper@redhat.com> - * Moved to CVS archive. + * Moved to CVS archive. diff --git a/po/Makefile b/po/Makefile deleted file mode 100644 index ec9a6c05..00000000 --- a/po/Makefile +++ /dev/null @@ -1,400 +0,0 @@ -# Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper@gnu.ai.mit.edu> -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License but which still want to provide support for the GNU gettext -# functionality. -# Please note that the actual code of GNU gettext is covered by the GNU -# General Public License and is *not* in the public domain. - -PACKAGE = elfutils -VERSION = 0.97 - -SHELL = /bin/sh - - -srcdir = . -top_srcdir = .. - - -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -exec_prefix = ${prefix} -datadir = ${prefix}/share -localedir = $(datadir)/locale -gettextsrcdir = $(datadir)/gettext/po -top_builddir = .. - -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -MKINSTALLDIRS = config/mkinstalldirs -mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` - -GMSGFMT = /usr/bin/msgfmt -MSGFMT = /usr/bin/msgfmt -XGETTEXT = /usr/bin/xgettext -MSGMERGE = msgmerge -MSGMERGE_UPDATE = /usr/bin/msgmerge --update -MSGINIT = msginit -MSGCONV = msgconv -MSGFILTER = msgfilter - -POFILES = -GMOFILES = -UPDATEPOFILES = -DUMMYPOFILES = -DISTFILES.common = Makefile.in.in Makevars \ -$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) -DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \ -$(POFILES) $(GMOFILES) \ -$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) - -POTFILES = \ - ../lib/xmalloc.c \ - ../lib/xstrdup.c \ - ../lib/xstrndup.c \ - ../src/nm.c \ - ../src/readelf.c \ - ../src/size.c \ - ../src/strip.c \ - ../src/ld.c \ - ../src/ldgeneric.c \ - ../src/ldscript.y \ - ../src/elflint.c \ - ../libasm/asm_begin.c \ - ../libasm/asm_abort.c \ - ../libasm/asm_end.c \ - ../libasm/asm_error.c \ - ../libasm/asm_getelf.c \ - ../libdw/dwarf_error.c \ - ../libebl/eblclosebackend.c \ - ../libebl/eblopenbackend.c \ - ../libebl/eblstrtab.c \ - ../libebl/i386_destr.c \ - ../libebl/i386_init.c \ - ../libebl/i386_symbol.c \ - ../libebl/mips_destr.c \ - ../libebl/mips_init.c \ - ../libebl/mips_symbol.c \ - ../libebl/sh_destr.c \ - ../libebl/sh_init.c \ - ../libebl/sh_symbol.c \ - ../libebl/sparc_destr.c \ - ../libebl/sparc_init.c \ - ../libebl/sparc_symbol.c - -CATALOGS = - -# Makevars gets inserted here. (Don't remove this line!) -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Red Hat, Inc. - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = - -.SUFFIXES: -.SUFFIXES: .po .gmo .mo .nop .po-update - -.po.mo: - $(MSGFMT) -c -o $@ $< - -.po.gmo: - @lang=`echo $* | sed -e 's,.*/,,'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ - cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po - - -all: all-yes - -all-yes: $(CATALOGS) -all-no: - -# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', -# otherwise packages like GCC can not be built if only parts of the source -# have been downloaded. - -$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in - $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ - --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ - --files-from=$(srcdir)/POTFILES.in \ - --copyright-holder='$(COPYRIGHT_HOLDER)' \ - && test ! -f $(DOMAIN).po \ - || ( rm -f $(srcdir)/$(DOMAIN).pot \ - && mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot ) - -$(srcdir)/$(DOMAIN).pot: - $(MAKE) $(DOMAIN).pot-update - -$(POFILES): $(srcdir)/$(DOMAIN).pot - @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot - - -install: install-exec install-data -install-exec: -install-data: install-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - for file in $(DISTFILES.common); do \ - $(INSTALL_DATA) $(srcdir)/$$file \ - $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -install-data-no: all -install-data-yes: all - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ - $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ - echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ - fi; \ - done; \ - done - -install-strip: install - -installdirs: installdirs-exec installdirs-data -installdirs-exec: -installdirs-data: installdirs-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - else \ - : ; \ - fi -installdirs-data-no: -installdirs-data-yes: - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - fi; \ - done; \ - done - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: uninstall-exec uninstall-data -uninstall-exec: -uninstall-data: uninstall-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - for file in $(DISTFILES.common); do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -uninstall-data-no: -uninstall-data-yes: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - done; \ - done - -check: all - -dvi info tags TAGS ID: - -mostlyclean: - rm -f core core.* $(DOMAIN).po *.new.po - rm -fr *.o - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: - $(MAKE) update-po - @$(MAKE) dist2 -# This is a separate target because 'update-po' must be executed before. -dist2: $(DISTFILES) - dists="$(DISTFILES)"; \ - if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \ - if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ - for file in $$dists; do \ - if test -f $$file; then \ - cp -p $$file $(distdir); \ - else \ - cp -p $(srcdir)/$$file $(distdir); \ - fi; \ - done - -update-po: Makefile - $(MAKE) $(DOMAIN).pot-update - $(MAKE) $(UPDATEPOFILES) - $(MAKE) update-gmo - -# General rule for updating PO files. - -.nop.po-update: - @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ - tmpdir=`pwd`; \ - echo "$$lang:"; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ - cd $(srcdir); \ - if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "msgmerge for $$lang.po failed!" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi - -$(DUMMYPOFILES): - -update-gmo: Makefile $(GMOFILES) - @: - -Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ - $(SHELL) ./config.status - -force: - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: -# Special Makefile rules for English message catalogs with quotation marks. - -DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot - -.SUFFIXES: .insert-header .po-update-en - -en@quot.po-update: en@quot.po-update-en -en@boldquot.po-update: en@boldquot.po-update-en - -.insert-header.po-update-en: - @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ - tmpdir=`pwd`; \ - echo "$$lang:"; \ - ll=`echo $$lang | sed -e 's/@.*//'`; \ - LC_ALL=C; export LC_ALL; \ - cd $(srcdir); \ - if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "creation of $$lang.po failed!" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi - -en@quot.insert-header: insert-header.sin - sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header - -en@boldquot.insert-header: insert-header.sin - sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header - -mostlyclean: mostlyclean-quot -mostlyclean-quot: - rm -f *.insert-header diff --git a/po/Makefile.in b/po/Makefile.in deleted file mode 100644 index 64ca4882..00000000 --- a/po/Makefile.in +++ /dev/null @@ -1,301 +0,0 @@ -# Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper@gnu.ai.mit.edu> -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License but which still want to provide support for the GNU gettext -# functionality. -# Please note that the actual code of GNU gettext is covered by the GNU -# General Public License and is *not* in the public domain. - -PACKAGE = elfutils -VERSION = 0.97 - -SHELL = /bin/sh - - -srcdir = . -top_srcdir = .. - - -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -exec_prefix = ${prefix} -datadir = ${prefix}/share -localedir = $(datadir)/locale -gettextsrcdir = $(datadir)/gettext/po -top_builddir = .. - -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -MKINSTALLDIRS = config/mkinstalldirs -mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` - -GMSGFMT = /usr/bin/msgfmt -MSGFMT = /usr/bin/msgfmt -XGETTEXT = /usr/bin/xgettext -MSGMERGE = msgmerge -MSGMERGE_UPDATE = /usr/bin/msgmerge --update -MSGINIT = msginit -MSGCONV = msgconv -MSGFILTER = msgfilter - -POFILES = @POFILES@ -GMOFILES = @GMOFILES@ -UPDATEPOFILES = @UPDATEPOFILES@ -DUMMYPOFILES = @DUMMYPOFILES@ -DISTFILES.common = Makefile.in.in Makevars \ -$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) -DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \ -$(POFILES) $(GMOFILES) \ -$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) - -POTFILES = \ - -CATALOGS = @CATALOGS@ - -# Makevars gets inserted here. (Don't remove this line!) - -.SUFFIXES: -.SUFFIXES: .po .gmo .mo .nop .po-update - -.po.mo: - $(MSGFMT) -c -o $@ $< - -.po.gmo: - @lang=`echo $* | sed -e 's,.*/,,'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ - cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po - - -all: all-yes - -all-yes: $(CATALOGS) -all-no: - -# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', -# otherwise packages like GCC can not be built if only parts of the source -# have been downloaded. - -$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in - $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ - --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ - --files-from=$(srcdir)/POTFILES.in \ - --copyright-holder='$(COPYRIGHT_HOLDER)' \ - && test ! -f $(DOMAIN).po \ - || ( rm -f $(srcdir)/$(DOMAIN).pot \ - && mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot ) - -$(srcdir)/$(DOMAIN).pot: - $(MAKE) $(DOMAIN).pot-update - -$(POFILES): $(srcdir)/$(DOMAIN).pot - @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot - - -install: install-exec install-data -install-exec: -install-data: install-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - for file in $(DISTFILES.common); do \ - $(INSTALL_DATA) $(srcdir)/$$file \ - $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -install-data-no: all -install-data-yes: all - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ - $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ - echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ - fi; \ - done; \ - done - -install-strip: install - -installdirs: installdirs-exec installdirs-data -installdirs-exec: -installdirs-data: installdirs-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - else \ - : ; \ - fi -installdirs-data-no: -installdirs-data-yes: - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - fi; \ - done; \ - done - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: uninstall-exec uninstall-data -uninstall-exec: -uninstall-data: uninstall-data-yes - if test "$(PACKAGE)" = "gettext"; then \ - for file in $(DISTFILES.common); do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -uninstall-data-no: -uninstall-data-yes: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - done; \ - done - -check: all - -dvi info tags TAGS ID: - -mostlyclean: - rm -f core core.* $(DOMAIN).po *.new.po - rm -fr *.o - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: - $(MAKE) update-po - @$(MAKE) dist2 -# This is a separate target because 'update-po' must be executed before. -dist2: $(DISTFILES) - dists="$(DISTFILES)"; \ - if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \ - if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ - for file in $$dists; do \ - if test -f $$file; then \ - cp -p $$file $(distdir); \ - else \ - cp -p $(srcdir)/$$file $(distdir); \ - fi; \ - done - -update-po: Makefile - $(MAKE) $(DOMAIN).pot-update - $(MAKE) $(UPDATEPOFILES) - $(MAKE) update-gmo - -# General rule for updating PO files. - -.nop.po-update: - @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ - tmpdir=`pwd`; \ - echo "$$lang:"; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ - cd $(srcdir); \ - if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "msgmerge for $$lang.po failed!" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi - -$(DUMMYPOFILES): - -update-gmo: Makefile $(GMOFILES) - @: - -Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ - $(SHELL) ./config.status - -force: - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/po/Makefile.in.in b/po/Makefile.in.in index d1e93381..5022b8b1 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,5 +1,5 @@ # Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper@gnu.ai.mit.edu> +# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu> # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public @@ -7,9 +7,12 @@ # functionality. # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. +# +# Origin: gettext-0.16 PACKAGE = @PACKAGE@ VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SHELL = /bin/sh @SET_MAKE@ @@ -20,19 +23,38 @@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ datadir = @datadir@ -localedir = $(datadir)/locale +localedir = @localedir@ gettextsrcdir = $(datadir)/gettext/po -top_builddir = .. INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` -GMSGFMT = @GMSGFMT@ -MSGFMT = @MSGFMT@ -XGETTEXT = @XGETTEXT@ +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) MSGMERGE = msgmerge MSGMERGE_UPDATE = @MSGMERGE@ --update MSGINIT = msginit @@ -43,9 +65,9 @@ POFILES = @POFILES@ GMOFILES = @GMOFILES@ UPDATEPOFILES = @UPDATEPOFILES@ DUMMYPOFILES = @DUMMYPOFILES@ -DISTFILES.common = Makefile.in.in Makevars \ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) -DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \ +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ $(POFILES) $(GMOFILES) \ $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) @@ -56,67 +78,126 @@ CATALOGS = @CATALOGS@ # Makevars gets inserted here. (Don't remove this line!) .SUFFIXES: -.SUFFIXES: .po .gmo .mo .nop .po-update +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .po.mo: - $(MSGFMT) -c -o $@ $< + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ - cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ all: all-@USE_NLS@ -all-yes: $(CATALOGS) +all-yes: stamp-po all-no: +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. -$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ - && test ! -f $(DOMAIN).po \ - || ( rm -f $(srcdir)/$(DOMAIN).pot \ - && mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot ) + --msgid-bugs-address="$$msgid_bugs_address" + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. $(srcdir)/$(DOMAIN).pot: $(MAKE) $(DOMAIN).pot-update +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - for file in $(DISTFILES.common); do \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ else \ : ; \ fi install-data-no: all install-data-yes: all - $(mkinstalldirs) $(DESTDIR)$(datadir) + $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ + $(mkdir_p) $(DESTDIR)$$dir; \ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ @@ -155,20 +236,20 @@ install-strip: install installdirs: installdirs-exec installdirs-data installdirs-exec: installdirs-data: installdirs-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi installdirs-data-no: installdirs-data-yes: - $(mkinstalldirs) $(DESTDIR)$(datadir) + $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ + $(mkdir_p) $(DESTDIR)$$dir; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ @@ -200,8 +281,8 @@ installcheck: uninstall: uninstall-exec uninstall-data uninstall-exec: uninstall-data: uninstall-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext"; then \ - for file in $(DISTFILES.common); do \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ @@ -220,10 +301,12 @@ uninstall-data-yes: check: all -dvi info tags TAGS ID: +info dvi ps pdf html tags TAGS ctags CTAGS ID: mostlyclean: - rm -f core core.* $(DOMAIN).po *.new.po + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean @@ -234,35 +317,55 @@ distclean: clean maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) + rm -f stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(MAKE) update-po @$(MAKE) dist2 # This is a separate target because 'update-po' must be executed before. -dist2: $(DISTFILES) +dist2: stamp-po $(DISTFILES) dists="$(DISTFILES)"; \ - if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ if test -f $$file; then \ - cp -p $$file $(distdir); \ + cp -p $$file $(distdir) || exit 1; \ else \ - cp -p $(srcdir)/$$file $(distdir); \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ fi; \ done update-po: Makefile $(MAKE) $(DOMAIN).pot-update - $(MAKE) $(UPDATEPOFILES) + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + # General rule for updating PO files. .nop.po-update: @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ @@ -289,10 +392,9 @@ $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: -Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ - $(SHELL) ./config.status + && $(SHELL) ./config.status $(subdir)/$@.in po-directories force: diff --git a/po/Makevars b/po/Makevars index 0accb70a..b8ea7022 100644 --- a/po/Makevars +++ b/po/Makevars @@ -8,7 +8,8 @@ subdir = po top_builddir = .. # These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --flag=error:3:c-format \ + --flag=ERROR:1:c-format # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding @@ -20,6 +21,22 @@ XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # their copyright. COPYRIGHT_HOLDER = Red Hat, Inc. +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = http://bugzilla.redhat.com/ + # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES b/po/POTFILES deleted file mode 100644 index b363051e..00000000 --- a/po/POTFILES +++ /dev/null @@ -1,32 +0,0 @@ - ../lib/xmalloc.c \ - ../lib/xstrdup.c \ - ../lib/xstrndup.c \ - ../src/nm.c \ - ../src/readelf.c \ - ../src/size.c \ - ../src/strip.c \ - ../src/ld.c \ - ../src/ldgeneric.c \ - ../src/ldscript.y \ - ../src/elflint.c \ - ../libasm/asm_begin.c \ - ../libasm/asm_abort.c \ - ../libasm/asm_end.c \ - ../libasm/asm_error.c \ - ../libasm/asm_getelf.c \ - ../libdw/dwarf_error.c \ - ../libebl/eblclosebackend.c \ - ../libebl/eblopenbackend.c \ - ../libebl/eblstrtab.c \ - ../libebl/i386_destr.c \ - ../libebl/i386_init.c \ - ../libebl/i386_symbol.c \ - ../libebl/mips_destr.c \ - ../libebl/mips_init.c \ - ../libebl/mips_symbol.c \ - ../libebl/sh_destr.c \ - ../libebl/sh_init.c \ - ../libebl/sh_symbol.c \ - ../libebl/sparc_destr.c \ - ../libebl/sparc_init.c \ - ../libebl/sparc_symbol.c diff --git a/po/POTFILES.in b/po/POTFILES.in index aa813125..e3a192be 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,11 +1,16 @@ # List of files which containing translatable strings. -# Copyright (C) 2000 Red Hat, Inc. +# Copyright (C) 2000, 2005 Red Hat, Inc. # Files from the compatibility library lib/xmalloc.c -lib/xstrdup.c +#lib/xstrdup.c lib/xstrndup.c +# Library sources +libelf/elf_error.c +libasm/asm_error.c +libdw/dwarf_error.c + # Program sources src/nm.c src/readelf.c @@ -15,28 +20,8 @@ src/ld.c src/ldgeneric.c src/ldscript.y src/elflint.c -libasm/asm_begin.c -libasm/asm_abort.c -libasm/asm_end.c -libasm/asm_error.c -libasm/asm_getelf.c -libdw/dwarf_error.c -# List of files which containing translatable strings. -# Copyright (C) 2000 Red Hat, Inc. - -# Library sources -libebl/eblclosebackend.c -libebl/eblopenbackend.c -libebl/eblstrtab.c -libebl/i386_destr.c -libebl/i386_init.c -libebl/i386_symbol.c -libebl/mips_destr.c -libebl/mips_init.c -libebl/mips_symbol.c -libebl/sh_destr.c -libebl/sh_init.c -libebl/sh_symbol.c -libebl/sparc_destr.c -libebl/sparc_init.c -libebl/sparc_symbol.c +src/addr2line.c +src/findtextrel.c +src/elfcmp.c +src/ranlib.c +src/strings.c diff --git a/po/Rules-quot b/po/Rules-quot index 5f46d237..9c2a995e 100644 --- a/po/Rules-quot +++ b/po/Rules-quot @@ -4,6 +4,11 @@ DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.heade .SUFFIXES: .insert-header .po-update-en +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en diff --git a/po/elfutils.pot b/po/elfutils.pot index 4fe08eba..3929a52c 100644 --- a/po/elfutils.pot +++ b/po/elfutils.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-09-25 12:42-0700\n" +"Report-Msgid-Bugs-To: http://bugzilla.redhat.com/\n" +"POT-Creation-Date: 2008-12-17 16:48-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,107 +17,431 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: lib/xmalloc.c:38 lib/xmalloc.c:52 lib/xmalloc.c:66 +#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79 src/readelf.c:2683 +#: src/readelf.c:3018 +#, c-format msgid "memory exhausted" msgstr "" -#: src/nm.c:59 src/readelf.c:51 src/strip.c:57 +#: libelf/elf_error.c:113 libasm/asm_error.c:120 libdw/dwarf_error.c:111 +msgid "no error" +msgstr "" + +#: libelf/elf_error.c:116 libasm/asm_error.c:163 libdw/dwarf_error.c:112 +msgid "unknown error" +msgstr "" + +#: libelf/elf_error.c:120 +msgid "unknown version" +msgstr "" + +#: libelf/elf_error.c:124 +msgid "unknown type" +msgstr "" + +#: libelf/elf_error.c:128 +msgid "invalid `Elf' handle" +msgstr "" + +#: libelf/elf_error.c:132 +msgid "invalid size of source operand" +msgstr "" + +#: libelf/elf_error.c:136 +msgid "invalid size of destination operand" +msgstr "" + +#: libelf/elf_error.c:140 +msgid "invalid encoding" +msgstr "" + +#: libelf/elf_error.c:144 libasm/asm_error.c:121 libdw/dwarf_error.c:120 +msgid "out of memory" +msgstr "" + +#: libelf/elf_error.c:148 +msgid "invalid file descriptor" +msgstr "" + +#: libelf/elf_error.c:152 +msgid "invalid operation" +msgstr "" + +#: libelf/elf_error.c:156 +msgid "ELF version not set" +msgstr "" + +#: libelf/elf_error.c:160 libelf/elf_error.c:208 libdw/dwarf_error.c:122 +msgid "invalid command" +msgstr "" + +#: libelf/elf_error.c:164 libelf/elf_error.c:224 +msgid "offset out of range" +msgstr "" + +#: libelf/elf_error.c:168 +msgid "invalid fmag field in archive header" +msgstr "" + +#: libelf/elf_error.c:172 +msgid "invalid archive file" +msgstr "" + +#: libelf/elf_error.c:176 +msgid "descriptor is not for an archive" +msgstr "" + +#: libelf/elf_error.c:180 +msgid "no index available" +msgstr "" + +#: libelf/elf_error.c:184 +msgid "cannot read data from file" +msgstr "" + +#: libelf/elf_error.c:188 +msgid "cannot write data to file" +msgstr "" + +#: libelf/elf_error.c:192 +msgid "invalid binary class" +msgstr "" + +#: libelf/elf_error.c:196 +msgid "invalid section index" +msgstr "" + +#: libelf/elf_error.c:200 +msgid "invalid operand" +msgstr "" + +#: libelf/elf_error.c:204 +msgid "invalid section" +msgstr "" + +#: libelf/elf_error.c:212 +msgid "executable header not created first" +msgstr "" + +#: libelf/elf_error.c:216 +msgid "file descriptor disabled" +msgstr "" + +#: libelf/elf_error.c:220 +msgid "archive/member fildes mismatch" +msgstr "" + +#: libelf/elf_error.c:228 +msgid "cannot manipulate null section" +msgstr "" + +#: libelf/elf_error.c:232 +msgid "data/scn mismatch" +msgstr "" + +#: libelf/elf_error.c:236 +msgid "invalid section header" +msgstr "" + +#: libelf/elf_error.c:240 +msgid "invalid data" +msgstr "" + +#: libelf/elf_error.c:244 +msgid "unknown data encoding" +msgstr "" + +#: libelf/elf_error.c:248 +msgid "section `sh_size' too small for data" +msgstr "" + +#: libelf/elf_error.c:252 +msgid "invalid section alignment" +msgstr "" + +#: libelf/elf_error.c:256 +msgid "invalid section entry size" +msgstr "" + +#: libelf/elf_error.c:260 +msgid "update() for write on read-only file" +msgstr "" + +#: libelf/elf_error.c:264 +msgid "no such file" +msgstr "" + +#: libelf/elf_error.c:268 +msgid "only relocatable files can contain section groups" +msgstr "" + +#: libelf/elf_error.c:273 +msgid "" +"program header only allowed in executables, shared objects, and core files" +msgstr "" + +#: libelf/elf_error.c:280 +msgid "file has no program header" +msgstr "" + +#: libelf/elf_error.c:285 libdw/dwarf_error.c:144 +msgid "invalid offset" +msgstr "" + +#: libasm/asm_error.c:122 src/ldgeneric.c:2687 +#, c-format +msgid "cannot create output file" +msgstr "" + +#: libasm/asm_error.c:123 +msgid "invalid parameter" +msgstr "" + +#: libasm/asm_error.c:124 +msgid "cannot change mode of output file" +msgstr "" + +#: libasm/asm_error.c:125 src/ldgeneric.c:7001 +#, c-format +msgid "cannot rename output file" +msgstr "" + +#: libasm/asm_error.c:126 +msgid "duplicate symbol" +msgstr "" + +#: libasm/asm_error.c:127 +msgid "invalid section type for operation" +msgstr "" + +#: libasm/asm_error.c:128 +msgid "error during output of data" +msgstr "" + +#: libasm/asm_error.c:129 +msgid "no backend support available" +msgstr "" + +#: libdw/dwarf_error.c:113 +msgid "invalid access" +msgstr "" + +#: libdw/dwarf_error.c:114 +msgid "no regular file" +msgstr "" + +#: libdw/dwarf_error.c:115 +msgid "I/O error" +msgstr "" + +#: libdw/dwarf_error.c:116 +msgid "invalid ELF file" +msgstr "" + +#: libdw/dwarf_error.c:117 +msgid "no DWARF information" +msgstr "" + +#: libdw/dwarf_error.c:118 +msgid "no ELF file" +msgstr "" + +#: libdw/dwarf_error.c:119 +msgid "cannot get ELF header" +msgstr "" + +#: libdw/dwarf_error.c:121 +msgid "not implemented" +msgstr "" + +#: libdw/dwarf_error.c:123 +msgid "invalid version" +msgstr "" + +#: libdw/dwarf_error.c:124 +msgid "invalid file" +msgstr "" + +#: libdw/dwarf_error.c:125 +msgid "no entries found" +msgstr "" + +#: libdw/dwarf_error.c:126 +msgid "invalid DWARF" +msgstr "" + +#: libdw/dwarf_error.c:127 +msgid "no string data" +msgstr "" + +#: libdw/dwarf_error.c:128 +msgid "no address value" +msgstr "" + +#: libdw/dwarf_error.c:129 +msgid "no constant value" +msgstr "" + +#: libdw/dwarf_error.c:130 +msgid "no reference value" +msgstr "" + +#: libdw/dwarf_error.c:131 +msgid "invalid reference value" +msgstr "" + +#: libdw/dwarf_error.c:132 +msgid ".debug_line section missing" +msgstr "" + +#: libdw/dwarf_error.c:133 +msgid "invalid .debug_line section" +msgstr "" + +#: libdw/dwarf_error.c:134 +msgid "debug information too big" +msgstr "" + +#: libdw/dwarf_error.c:135 +msgid "invalid DWARF version" +msgstr "" + +#: libdw/dwarf_error.c:136 +msgid "invalid directory index" +msgstr "" + +#: libdw/dwarf_error.c:137 +msgid "address out of range" +msgstr "" + +#: libdw/dwarf_error.c:138 +msgid "no location list value" +msgstr "" + +#: libdw/dwarf_error.c:139 +msgid "no block data" +msgstr "" + +#: libdw/dwarf_error.c:140 +msgid "invalid line index" +msgstr "" + +#: libdw/dwarf_error.c:141 +msgid "invalid address range index" +msgstr "" + +#: libdw/dwarf_error.c:142 +msgid "no matching address range" +msgstr "" + +#: libdw/dwarf_error.c:143 +msgid "no flag value" +msgstr "" + +#: libdw/dwarf_error.c:145 +msgid ".debug_ranges section missing" +msgstr "" + +#: src/nm.c:74 src/readelf.c:72 src/strip.c:72 msgid "Output selection:" msgstr "" -#: src/nm.c:60 +#: src/nm.c:75 msgid "Display debugger-only symbols" msgstr "" -#: src/nm.c:61 +#: src/nm.c:76 msgid "Display only defined symbols" msgstr "" -#: src/nm.c:64 +#: src/nm.c:79 msgid "Display dynamic symbols instead of normal symbols" msgstr "" -#: src/nm.c:65 +#: src/nm.c:80 msgid "Display only external symbols" msgstr "" -#: src/nm.c:66 +#: src/nm.c:81 msgid "Display only undefined symbols" msgstr "" -#: src/nm.c:68 +#: src/nm.c:83 msgid "Include index for symbols from archive members" msgstr "" -#: src/nm.c:70 src/size.c:51 +#: src/nm.c:85 src/size.c:66 msgid "Output format:" msgstr "" -#: src/nm.c:72 +#: src/nm.c:87 msgid "Print name of the input file before every symbol" msgstr "" -#: src/nm.c:75 +#: src/nm.c:90 msgid "" "Use the output format FORMAT. FORMAT can be `bsd', `sysv' or `posix'. The " "default is `sysv'" msgstr "" -#: src/nm.c:77 +#: src/nm.c:92 msgid "Same as --format=bsd" msgstr "" -#: src/nm.c:78 +#: src/nm.c:93 msgid "Same as --format=posix" msgstr "" -#: src/nm.c:79 src/size.c:55 +#: src/nm.c:94 src/size.c:72 msgid "Use RADIX for printing symbol values" msgstr "" -#: src/nm.c:80 +#: src/nm.c:95 msgid "Mark weak symbols" msgstr "" -#: src/nm.c:81 +#: src/nm.c:96 msgid "Print size of defined symbols" msgstr "" -#: src/nm.c:83 src/size.c:61 src/strip.c:61 +#: src/nm.c:98 src/size.c:80 src/strip.c:77 msgid "Output options:" msgstr "" -#: src/nm.c:84 +#: src/nm.c:99 msgid "Sort symbols numerically by address" msgstr "" -#: src/nm.c:86 +#: src/nm.c:101 msgid "Do not sort the symbols" msgstr "" -#: src/nm.c:87 +#: src/nm.c:102 msgid "Reverse the sense of the sort" msgstr "" -#: src/nm.c:88 +#: src/nm.c:103 src/addr2line.c:71 src/findtextrel.c:73 src/elfcmp.c:74 +#: src/strings.c:83 msgid "Miscellaneous:" msgstr "" -#: src/nm.c:93 +#: src/nm.c:108 msgid "List symbols from FILEs (a.out by default)." msgstr "" -#: src/nm.c:96 src/size.c:72 src/strip.c:76 +#: src/nm.c:111 src/size.c:92 src/strip.c:96 src/findtextrel.c:82 +#: src/strings.c:92 msgid "[FILE...]" msgstr "" -#: src/nm.c:124 src/size.c:100 src/strip.c:103 +#: src/nm.c:136 src/size.c:117 src/strip.c:120 #, c-format msgid "%s: INTERNAL ERROR %d (%s-%s): %s" msgstr "" -#: src/nm.c:241 src/readelf.c:376 src/size.c:202 src/strip.c:182 src/ld.c:871 -#: src/elflint.c:241 +#: src/nm.c:253 src/readelf.c:416 src/size.c:219 src/strip.c:203 src/ld.c:957 +#: src/elflint.c:240 src/addr2line.c:178 src/findtextrel.c:168 +#: src/elfcmp.c:521 src/ranlib.c:136 src/strings.c:227 #, c-format msgid "" "Copyright (C) %s Red Hat, Inc.\n" @@ -125,66 +449,72 @@ msgid "" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" msgstr "" -#: src/nm.c:246 src/readelf.c:381 src/size.c:207 src/strip.c:187 src/ld.c:876 -#: src/elflint.c:246 +#: src/nm.c:258 src/readelf.c:421 src/size.c:224 src/strip.c:208 src/ld.c:962 +#: src/elflint.c:245 src/addr2line.c:183 src/findtextrel.c:173 +#: src/elfcmp.c:526 src/ranlib.c:141 src/strings.c:232 #, c-format msgid "Written by %s.\n" msgstr "" -#: src/nm.c:351 src/readelf.c:359 src/size.c:285 src/strip.c:237 src/ld.c:490 -#: src/elflint.c:224 +#: src/nm.c:363 src/size.c:301 src/strip.c:432 src/strip.c:467 +#: src/ldgeneric.c:1767 src/ldgeneric.c:4257 src/findtextrel.c:227 +#: src/elfcmp.c:573 src/ranlib.c:169 src/strings.c:183 #, c-format -msgid "Please report bugs to %s.\n" +msgid "cannot open '%s'" msgstr "" -#: src/nm.c:388 src/nm.c:400 src/size.c:324 +#: src/nm.c:380 src/nm.c:392 src/size.c:317 src/size.c:400 src/strip.c:1814 #, c-format -msgid "while close `%s'" +msgid "while closing '%s'" msgstr "" -#: src/nm.c:410 src/strip.c:322 +#: src/nm.c:402 src/strip.c:358 #, c-format msgid "%s: File format not recognized" msgstr "" -#: src/nm.c:450 +#: src/nm.c:442 msgid "" "\n" "Archive index:" msgstr "" -#: src/nm.c:459 +#: src/nm.c:451 #, c-format msgid "invalid offset %zu for symbol %s" msgstr "" -#: src/nm.c:464 +#: src/nm.c:456 #, c-format msgid "%s in %s\n" msgstr "" -#: src/nm.c:472 +#: src/nm.c:464 +#, c-format msgid "cannot reset archive offset to beginning" msgstr "" -#: src/nm.c:496 +#: src/nm.c:488 #, c-format msgid "%s%s%s: file format not recognized" msgstr "" -#: src/nm.c:714 +#: src/nm.c:700 +#, c-format msgid "cannot create search tree" msgstr "" -#: src/nm.c:742 src/nm.c:988 src/readelf.c:691 src/readelf.c:834 -#: src/readelf.c:947 src/readelf.c:1131 src/readelf.c:1350 src/readelf.c:1509 -#: src/readelf.c:1682 src/readelf.c:1941 src/readelf.c:2018 src/readelf.c:2106 -#: src/readelf.c:2387 src/readelf.c:2513 src/readelf.c:4392 src/size.c:429 -#: src/size.c:504 src/strip.c:468 +#: src/nm.c:740 src/nm.c:1002 src/readelf.c:834 src/readelf.c:973 +#: src/readelf.c:1114 src/readelf.c:1296 src/readelf.c:1494 src/readelf.c:1639 +#: src/readelf.c:1807 src/readelf.c:2061 src/readelf.c:2127 src/readelf.c:2205 +#: src/readelf.c:2702 src/readelf.c:2738 src/readelf.c:2800 src/readelf.c:5298 +#: src/readelf.c:6159 src/readelf.c:6304 src/readelf.c:6373 src/size.c:418 +#: src/size.c:492 src/strip.c:482 +#, c-format msgid "cannot get section header string table index" msgstr "" -#: src/nm.c:762 +#: src/nm.c:766 #, c-format msgid "" "\n" @@ -193,7 +523,7 @@ msgid "" "\n" msgstr "" -#: src/nm.c:764 +#: src/nm.c:768 #, c-format msgid "" "\n" @@ -202,373 +532,398 @@ msgid "" "\n" msgstr "" -#: src/nm.c:767 +#: src/nm.c:771 #, c-format msgid "" "%*s%-*s %-*s Class Type %-*s %*s Section\n" "\n" msgstr "" -#: src/nm.c:998 +#: src/nm.c:1012 #, c-format msgid "%s: entry size in section `%s' is not what we expect" msgstr "" -#: src/nm.c:1002 +#: src/nm.c:1016 #, c-format msgid "%s: size of section `%s' is not multiple of entry size" msgstr "" -#: src/nm.c:1235 +#: src/nm.c:1255 #, c-format msgid "%s%s%s%s: Invalid operation" msgstr "" -#: src/nm.c:1292 +#: src/nm.c:1312 #, c-format msgid "%s%s%s: no symbols" msgstr "" -#: src/readelf.c:52 +#: src/readelf.c:73 msgid "Equivalent to: -h -l" msgstr "" -#: src/readelf.c:53 +#: src/readelf.c:74 msgid "Display the dynamic segment" msgstr "" -#: src/readelf.c:54 +#: src/readelf.c:75 msgid "Display the ELF file header" msgstr "" -#: src/readelf.c:56 +#: src/readelf.c:77 msgid "Display histogram of bucket list lengths" msgstr "" -#: src/readelf.c:57 +#: src/readelf.c:78 msgid "Display the program headers" msgstr "" -#: src/readelf.c:58 +#: src/readelf.c:80 msgid "Display relocations" msgstr "" -#: src/readelf.c:59 +#: src/readelf.c:81 msgid "Display the sections' header" msgstr "" -#: src/readelf.c:60 +#: src/readelf.c:83 msgid "Display the symbol table" msgstr "" -#: src/readelf.c:61 +#: src/readelf.c:84 msgid "Display versioning information" msgstr "" -#: src/readelf.c:63 +#: src/readelf.c:86 msgid "" "Display DWARF section content. SECTION can be one of abbrev, aranges, " -"frame, info, loc, line, pubnames, str, or macinfo." +"frame, info, loc, line, ranges, pubnames, str, or macinfo." msgstr "" -#: src/readelf.c:65 +#: src/readelf.c:89 msgid "Display the core notes" msgstr "" -#: src/readelf.c:67 +#: src/readelf.c:91 msgid "Display architecture specific information (if any)" msgstr "" -#: src/readelf.c:69 +#: src/readelf.c:93 +msgid "Dump the uninterpreted contents of SECTION, by number or name" +msgstr "" + +#: src/readelf.c:95 +msgid "Print string contents of sections" +msgstr "" + +#: src/readelf.c:98 +msgid "Display the symbol index of an archive" +msgstr "" + +#: src/readelf.c:100 msgid "Output control:" msgstr "" -#: src/readelf.c:75 +#: src/readelf.c:106 msgid "Print information from ELF file in human-readable form." msgstr "" -#: src/readelf.c:79 src/elflint.c:66 +#: src/readelf.c:110 src/elflint.c:86 msgid "FILE..." msgstr "" -#: src/readelf.c:222 src/elflint.c:149 +#: src/readelf.c:256 src/elflint.c:159 +#, c-format msgid "cannot open input file" msgstr "" -#: src/readelf.c:229 src/elflint.c:156 +#: src/readelf.c:363 #, c-format -msgid "cannot generate Elf descriptor: %s\n" +msgid "Unknown DWARF debug section `%s'.\n" +msgstr "" + +#: src/readelf.c:392 src/elflint.c:223 +msgid "Missing file name.\n" msgstr "" -#: src/readelf.c:237 +#: src/readelf.c:397 +msgid "No operation specified.\n" +msgstr "" + +#: src/readelf.c:432 #, c-format -msgid "error while closing Elf descriptor: %s" +msgid "cannot generate Elf descriptor: %s" msgstr "" -#: src/readelf.c:336 +#: src/readelf.c:444 #, c-format -msgid "Unknown DWARF debug section `%s'.\n" +msgid "'%s' is not an archive, cannot print archive index" msgstr "" -#: src/readelf.c:436 src/elflint.c:304 +#: src/readelf.c:449 #, c-format -msgid " error while freeing sub-ELF descriptor: %s\n" +msgid "error while closing Elf descriptor: %s" msgstr "" -#: src/readelf.c:444 +#: src/readelf.c:541 +#, c-format msgid "cannot stat input file" msgstr "" -#: src/readelf.c:446 +#: src/readelf.c:543 +#, c-format msgid "input file is empty" msgstr "" -#: src/readelf.c:449 src/elflint.c:312 -msgid "Not an ELF file - it has the wrong magic bytes at the start" +#: src/readelf.c:545 +#, c-format +msgid "failed reading '%s': %s" msgstr "" -#: src/readelf.c:476 +#: src/readelf.c:580 #, c-format msgid "cannot read ELF header: %s" msgstr "" -#: src/readelf.c:483 +#: src/readelf.c:588 +#, c-format msgid "cannot create EBL handle" msgstr "" -#: src/readelf.c:490 src/strip.c:530 src/ldgeneric.c:592 src/ldgeneric.c:1026 +#: src/readelf.c:595 src/strip.c:542 src/ldgeneric.c:661 src/ldgeneric.c:1122 #, c-format msgid "cannot determine number of sections: %s" msgstr "" -#: src/readelf.c:532 +#: src/readelf.c:681 msgid "NONE (None)" msgstr "" -#: src/readelf.c:533 +#: src/readelf.c:682 msgid "REL (Relocatable file)" msgstr "" -#: src/readelf.c:534 +#: src/readelf.c:683 msgid "EXEC (Executable file)" msgstr "" -#: src/readelf.c:535 +#: src/readelf.c:684 msgid "DYN (Shared object file)" msgstr "" -#: src/readelf.c:536 +#: src/readelf.c:685 msgid "CORE (Core file)" msgstr "" -#: src/readelf.c:541 +#: src/readelf.c:690 #, c-format msgid "OS Specific: (%x)\n" msgstr "" -#: src/readelf.c:543 +#: src/readelf.c:692 #, c-format msgid "Processor Specific: (%x)\n" msgstr "" -#: src/readelf.c:556 +#: src/readelf.c:702 msgid "" "ELF Header:\n" " Magic: " msgstr "" -#: src/readelf.c:560 +#: src/readelf.c:706 #, c-format msgid "" "\n" " Class: %s\n" msgstr "" -#: src/readelf.c:565 +#: src/readelf.c:711 #, c-format msgid " Data: %s\n" msgstr "" -#: src/readelf.c:571 +#: src/readelf.c:717 #, c-format -msgid " Version: %hhd %s\n" +msgid " Ident Version: %hhd %s\n" msgstr "" -#: src/readelf.c:573 src/readelf.c:589 +#: src/readelf.c:719 src/readelf.c:736 msgid "(current)" msgstr "" -#: src/readelf.c:576 +#: src/readelf.c:723 #, c-format msgid " OS/ABI: %s\n" msgstr "" -#: src/readelf.c:579 +#: src/readelf.c:726 #, c-format msgid " ABI Version: %hhd\n" msgstr "" -#: src/readelf.c:582 +#: src/readelf.c:729 msgid " Type: " msgstr "" -#: src/readelf.c:585 +#: src/readelf.c:732 #, c-format msgid " Machine: %s\n" msgstr "" -#: src/readelf.c:587 +#: src/readelf.c:734 #, c-format msgid " Version: %d %s\n" msgstr "" -#: src/readelf.c:591 +#: src/readelf.c:738 #, c-format msgid " Entry point address: %#<PRIx64>\n" msgstr "" -#: src/readelf.c:594 +#: src/readelf.c:741 #, c-format msgid " Start of program headers: %<PRId64> %s\n" msgstr "" -#: src/readelf.c:595 src/readelf.c:598 +#: src/readelf.c:742 src/readelf.c:745 msgid "(bytes into file)" msgstr "" -#: src/readelf.c:597 +#: src/readelf.c:744 #, c-format msgid " Start of section headers: %<PRId64> %s\n" msgstr "" -#: src/readelf.c:600 +#: src/readelf.c:747 #, c-format msgid " Flags: %s\n" msgstr "" -#: src/readelf.c:603 +#: src/readelf.c:750 #, c-format msgid " Size of this header: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:604 src/readelf.c:607 src/readelf.c:613 +#: src/readelf.c:751 src/readelf.c:754 src/readelf.c:760 msgid "(bytes)" msgstr "" -#: src/readelf.c:606 +#: src/readelf.c:753 #, c-format msgid " Size of program header entries: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:609 +#: src/readelf.c:756 #, c-format msgid " Number of program headers entries: %<PRId16>\n" msgstr "" -#: src/readelf.c:612 +#: src/readelf.c:759 #, c-format msgid " Size of section header entries: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:615 +#: src/readelf.c:762 #, c-format msgid " Number of section headers entries: %<PRId16>" msgstr "" -#: src/readelf.c:624 +#: src/readelf.c:769 #, c-format msgid " (%<PRIu32> in [0].sh_size)" msgstr "" -#: src/readelf.c:627 src/readelf.c:643 +#: src/readelf.c:772 src/readelf.c:786 msgid " ([0] not available)" msgstr "" -#: src/readelf.c:639 +#: src/readelf.c:782 #, c-format msgid " (%<PRIu32> in [0].sh_link)" msgstr "" -#: src/readelf.c:647 +#: src/readelf.c:790 #, c-format msgid "" " Section header string table index: XINDEX%s\n" "\n" msgstr "" -#: src/readelf.c:651 +#: src/readelf.c:794 #, c-format msgid "" " Section header string table index: %<PRId16>\n" "\n" msgstr "" -#: src/readelf.c:683 +#: src/readelf.c:826 #, c-format msgid "" "There are %d section headers, starting at offset %#<PRIx64>:\n" "\n" msgstr "" -#: src/readelf.c:693 +#: src/readelf.c:836 msgid "Section Headers:" msgstr "" -#: src/readelf.c:696 +#: src/readelf.c:839 msgid "" "[Nr] Name Type Addr Off Size ES Flags Lk " "Inf Al" msgstr "" -#: src/readelf.c:698 +#: src/readelf.c:841 msgid "" "[Nr] Name Type Addr Off Size ES " "Flags Lk Inf Al" msgstr "" -#: src/readelf.c:710 src/readelf.c:862 +#: src/readelf.c:848 src/readelf.c:997 #, c-format msgid "cannot get section: %s" msgstr "" -#: src/readelf.c:716 src/readelf.c:869 +#: src/readelf.c:855 src/readelf.c:1005 src/readelf.c:6324 #, c-format msgid "cannot get section header: %s" msgstr "" -#: src/readelf.c:775 +#: src/readelf.c:913 msgid "Program Headers:" msgstr "" -#: src/readelf.c:777 +#: src/readelf.c:915 msgid "" " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align" msgstr "" -#: src/readelf.c:780 +#: src/readelf.c:918 msgid "" " Type Offset VirtAddr PhysAddr FileSiz " "MemSiz Flg Align" msgstr "" -#: src/readelf.c:820 +#: src/readelf.c:958 #, c-format msgid "\t[Requesting program interpreter: %s]\n" msgstr "" -#: src/readelf.c:836 +#: src/readelf.c:975 msgid "" "\n" " Section to Segment mapping:\n" " Segment Sections..." msgstr "" -#: src/readelf.c:849 +#: src/readelf.c:986 #, c-format msgid "cannot get program header: %s" msgstr "" -#: src/readelf.c:952 +#: src/readelf.c:1120 #, c-format msgid "" "\n" @@ -579,7 +934,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:957 +#: src/readelf.c:1125 #, c-format msgid "" "\n" @@ -590,20 +945,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:965 +#: src/readelf.c:1133 msgid "<INVALID SYMBOL>" msgstr "" -#: src/readelf.c:977 -#, c-format -msgid " [%2u] <INVALID SECTION>\n" -msgstr "" - -#: src/readelf.c:982 +#: src/readelf.c:1147 msgid "<INVALID SECTION>" msgstr "" -#: src/readelf.c:1133 +#: src/readelf.c:1298 #, c-format msgid "" "\n" @@ -616,43 +966,43 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1145 +#: src/readelf.c:1310 msgid " Type Value\n" msgstr "" -#: src/readelf.c:1171 +#: src/readelf.c:1334 #, c-format msgid "Shared library: [%s]\n" msgstr "" -#: src/readelf.c:1176 +#: src/readelf.c:1339 #, c-format msgid "Library soname: [%s]\n" msgstr "" -#: src/readelf.c:1181 +#: src/readelf.c:1344 #, c-format msgid "Library rpath: [%s]\n" msgstr "" -#: src/readelf.c:1186 +#: src/readelf.c:1349 #, c-format msgid "Library runpath: [%s]\n" msgstr "" -#: src/readelf.c:1206 +#: src/readelf.c:1369 #, c-format msgid "%<PRId64> (bytes)\n" msgstr "" -#: src/readelf.c:1325 src/readelf.c:1482 +#: src/readelf.c:1479 src/readelf.c:1624 #, c-format msgid "" "\n" "Invalid symbol table at offset %#0<PRIx64>\n" msgstr "" -#: src/readelf.c:1353 +#: src/readelf.c:1497 #, c-format msgid "" "\n" @@ -665,7 +1015,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1368 +#: src/readelf.c:1512 #, c-format msgid "" "\n" @@ -676,28 +1026,28 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1378 +#: src/readelf.c:1522 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1380 +#: src/readelf.c:1524 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1407 src/readelf.c:1418 src/readelf.c:1436 src/readelf.c:1448 -#: src/readelf.c:1551 src/readelf.c:1563 src/readelf.c:1582 src/readelf.c:1595 +#: src/readelf.c:1548 src/readelf.c:1560 src/readelf.c:1578 src/readelf.c:1590 +#: src/readelf.c:1680 src/readelf.c:1693 src/readelf.c:1712 src/readelf.c:1725 msgid "<INVALID RELOC>" msgstr "" -#: src/readelf.c:1408 src/readelf.c:1552 +#: src/readelf.c:1549 src/readelf.c:1681 msgid "INVALID SYMBOL" msgstr "" -#: src/readelf.c:1437 src/readelf.c:1583 +#: src/readelf.c:1579 src/readelf.c:1713 msgid "INVALID SECTION" msgstr "" -#: src/readelf.c:1511 +#: src/readelf.c:1641 #, c-format msgid "" "\n" @@ -710,15 +1060,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1523 +#: src/readelf.c:1653 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1525 +#: src/readelf.c:1655 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1688 +#: src/readelf.c:1814 #, c-format msgid "" "\n" @@ -729,39 +1079,40 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1693 +#: src/readelf.c:1820 #, c-format msgid " %lu local symbol String table: [%2u] '%s'\n" msgid_plural " %lu local symbols String table: [%2u] '%s'\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1703 +#: src/readelf.c:1830 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1705 +#: src/readelf.c:1832 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1725 +#: src/readelf.c:1852 #, c-format msgid "%5u: %0*<PRIx64> %6<PRId64> %-7s %-6s %-9s %6s %s" msgstr "" -#: src/readelf.c:1815 +#: src/readelf.c:1940 +#, c-format msgid "bad dynamic symbol" msgstr "" -#: src/readelf.c:1898 +#: src/readelf.c:2022 msgid "none" msgstr "" -#: src/readelf.c:1915 +#: src/readelf.c:2039 msgid "| <unknown>" msgstr "" -#: src/readelf.c:1943 +#: src/readelf.c:2064 #, c-format msgid "" "\n" @@ -774,17 +1125,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1970 +#: src/readelf.c:2087 #, c-format msgid " %#06x: Version: %hu File: %s Cnt: %hu\n" msgstr "" -#: src/readelf.c:1985 +#: src/readelf.c:2100 #, c-format msgid " %#06x: Name: %s Flags: %s Version: %hu\n" msgstr "" -#: src/readelf.c:2020 +#: src/readelf.c:2131 #, c-format msgid "" "\n" @@ -797,17 +1148,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2055 +#: src/readelf.c:2161 #, c-format msgid " %#06x: Version: %hd Flags: %s Index: %hd Cnt: %hd Name: %s\n" msgstr "" -#: src/readelf.c:2070 +#: src/readelf.c:2176 #, c-format msgid " %#06x: Parent %d: %s\n" msgstr "" -#: src/readelf.c:2319 +#: src/readelf.c:2408 #, c-format msgid "" "\n" @@ -820,20 +1171,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2351 +#: src/readelf.c:2438 msgid " 0 *local* " msgstr "" -#: src/readelf.c:2356 +#: src/readelf.c:2443 msgid " 1 *global* " msgstr "" -#: src/readelf.c:2412 -#, c-format -msgid "cannot get data for section %d: %s" -msgstr "" - -#: src/readelf.c:2422 +#: src/readelf.c:2474 #, c-format msgid "" "\n" @@ -848,29 +1194,41 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2467 +#: src/readelf.c:2497 #, c-format -msgid " Length Number % of total Coverage" +msgid " Length Number % of total Coverage\n" msgstr "" -#: src/readelf.c:2468 +#: src/readelf.c:2499 #, c-format msgid " 0 %6<PRIu32> %5.1f%%\n" msgstr "" -#: src/readelf.c:2474 +#: src/readelf.c:2506 #, c-format msgid "%7d %6<PRIu32> %5.1f%% %5.1f%%\n" msgstr "" -#: src/readelf.c:2488 +#: src/readelf.c:2519 #, c-format msgid "" " Average number of tests: successful lookup: %f\n" " unsuccessful lookup: %f\n" msgstr "" -#: src/readelf.c:2523 +#: src/readelf.c:2537 src/readelf.c:2579 src/readelf.c:2620 +#, c-format +msgid "cannot get data for section %d: %s" +msgstr "" + +#: src/readelf.c:2674 +#, c-format +msgid "" +" Symbol Bias: %u\n" +" Bitmask Size: %zu bytes %<PRIuFAST32>%% bits set 2nd hash shift: %u\n" +msgstr "" + +#: src/readelf.c:2748 #, c-format msgid "" "\n" @@ -881,38 +1239,140 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2537 +#: src/readelf.c:2762 msgid "" " Library Time Stamp Checksum Version " "Flags" msgstr "" -#: src/readelf.c:2648 +#: src/readelf.c:2810 +#, c-format +msgid "" +"\n" +"Object attributes section [%2zu] '%s' of %<PRIu64> bytes at offset %" +"#0<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:2826 +msgid " Owner Size\n" +msgstr "" + +#: src/readelf.c:2852 +#, c-format +msgid " %-13s %4<PRIu32>\n" +msgstr "" + +#: src/readelf.c:2883 +#, c-format +msgid " %-4u %12<PRIu32>\n" +msgstr "" + +#: src/readelf.c:2888 +#, c-format +msgid " File: %11<PRIu32>\n" +msgstr "" + +#: src/readelf.c:2923 +#, c-format +msgid " %s: %<PRId64>, %s\n" +msgstr "" + +#: src/readelf.c:2926 +#, c-format +msgid " %s: %<PRId64>\n" +msgstr "" + +#: src/readelf.c:2929 +#, c-format +msgid " %s: %s\n" +msgstr "" + +#: src/readelf.c:2936 +#, c-format +msgid " %u: %<PRId64>\n" +msgstr "" + +#: src/readelf.c:2939 +#, c-format +msgid " %u: %s\n" +msgstr "" + +#: src/readelf.c:2974 +#, c-format +msgid "%s+%#<PRIx64> <%s+%#<PRIx64>>" +msgstr "" + +#: src/readelf.c:2977 +#, c-format +msgid "%s+%#0*<PRIx64> <%s+%#<PRIx64>>" +msgstr "" + +#: src/readelf.c:2982 +#, c-format +msgid "%#<PRIx64> <%s+%#<PRIx64>>" +msgstr "" + +#: src/readelf.c:2985 +#, c-format +msgid "%#0*<PRIx64> <%s+%#<PRIx64>>" +msgstr "" + +#: src/readelf.c:2991 +#, c-format +msgid "%s+%#<PRIx64> <%s>" +msgstr "" + +#: src/readelf.c:2994 +#, c-format +msgid "%s+%#0*<PRIx64> <%s>" +msgstr "" + +#: src/readelf.c:2998 +#, c-format +msgid "%#<PRIx64> <%s>" +msgstr "" + +#: src/readelf.c:3001 +#, c-format +msgid "%#0*<PRIx64> <%s>" +msgstr "" + +#: src/readelf.c:3006 +#, c-format +msgid "%s+%#<PRIx64>" +msgstr "" + +#: src/readelf.c:3009 +#, c-format +msgid "%s+%#0*<PRIx64>" +msgstr "" + +#: src/readelf.c:3117 #, c-format msgid "unknown tag %hx" msgstr "" -#: src/readelf.c:2650 +#: src/readelf.c:3119 #, c-format msgid "unknown user tag %hx" msgstr "" -#: src/readelf.c:2833 +#: src/readelf.c:3329 #, c-format msgid "unknown attribute %hx" msgstr "" -#: src/readelf.c:2836 +#: src/readelf.c:3332 #, c-format msgid "unknown user attribute %hx" msgstr "" -#: src/readelf.c:2882 +#: src/readelf.c:3378 #, c-format msgid "unknown form %<PRIx64>" msgstr "" -#: src/readelf.c:3255 +#: src/readelf.c:3966 #, c-format msgid "" "\n" @@ -920,30 +1380,37 @@ msgid "" " [ Code]\n" msgstr "" -#: src/readelf.c:3267 +#: src/readelf.c:3973 +#, c-format +msgid "" +"\n" +"Abbreviation section at offset %<PRIu64>:\n" +msgstr "" + +#: src/readelf.c:3986 #, c-format msgid " *** error while reading abbreviation: %s\n" msgstr "" -#: src/readelf.c:3281 +#: src/readelf.c:4002 #, c-format msgid " [%5u] offset: %<PRId64>, children: %s, tag: %s\n" msgstr "" -#: src/readelf.c:3284 +#: src/readelf.c:4005 msgid "yes" msgstr "" -#: src/readelf.c:3284 +#: src/readelf.c:4005 msgid "no" msgstr "" -#: src/readelf.c:3316 +#: src/readelf.c:4042 #, c-format msgid "cannot get .debug_aranges content: %s" msgstr "" -#: src/readelf.c:3321 +#: src/readelf.c:4047 #, c-format msgid "" "\n" @@ -954,33 +1421,66 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:3351 +#: src/readelf.c:4077 #, c-format msgid " [%*zu] ???\n" msgstr "" -#: src/readelf.c:3353 +#: src/readelf.c:4079 #, c-format msgid "" " [%*zu] start: %0#*<PRIx64>, length: %5<PRIu64>, CU DIE offset: %6<PRId64>\n" msgstr "" -#: src/readelf.c:3387 +#: src/readelf.c:4098 +#, c-format +msgid "cannot get .debug_ranges content: %s" +msgstr "" + +#: src/readelf.c:4103 src/readelf.c:4516 src/readelf.c:4964 src/readelf.c:5059 +#: src/readelf.c:5232 +#, c-format +msgid "" +"\n" +"DWARF section '%s' at offset %#<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:4117 src/readelf.c:4978 +#, c-format +msgid " [%6tx] <INVALID DATA>\n" +msgstr "" + +#: src/readelf.c:4139 src/readelf.c:5000 +#, c-format +msgid " [%6tx] base address %s\n" +msgstr "" + +#: src/readelf.c:4150 +#, c-format +msgid " [%6tx] %s..%s\n" +msgstr "" + +#: src/readelf.c:4152 +#, c-format +msgid " %s..%s\n" +msgstr "" + +#: src/readelf.c:4192 #, c-format msgid "cannot get attribute code: %s" msgstr "" -#: src/readelf.c:3395 +#: src/readelf.c:4200 #, c-format msgid "cannot get attribute form: %s" msgstr "" -#: src/readelf.c:3407 +#: src/readelf.c:4213 #, c-format msgid "cannot get attribute value: %s" msgstr "" -#: src/readelf.c:3506 +#: src/readelf.c:4395 #, c-format msgid "" "\n" @@ -988,7 +1488,7 @@ msgid "" " [Offset]\n" msgstr "" -#: src/readelf.c:3531 +#: src/readelf.c:4420 #, c-format msgid "" " Compilation unit at offset %<PRIu64>:\n" @@ -996,49 +1496,49 @@ msgid "" "<PRIu8>, Offset size: %<PRIu8>\n" msgstr "" -#: src/readelf.c:3548 +#: src/readelf.c:4438 #, c-format msgid "cannot get DIE at offset %<PRIu64> in section '%s': %s" msgstr "" -#: src/readelf.c:3559 +#: src/readelf.c:4449 #, c-format msgid "cannot get DIE offset: %s" msgstr "" -#: src/readelf.c:3567 +#: src/readelf.c:4457 #, c-format msgid "cannot get tag of DIE at offset %<PRIu64> in section '%s': %s" msgstr "" -#: src/readelf.c:3680 +#: src/readelf.c:4486 #, c-format msgid "cannot get next DIE: %s\n" msgstr "" -#: src/readelf.c:3687 +#: src/readelf.c:4493 #, c-format msgid "cannot get next DIE: %s" msgstr "" -#: src/readelf.c:3709 src/readelf.c:4120 src/readelf.c:4155 src/readelf.c:4324 +#: src/readelf.c:4528 #, c-format -msgid "" -"\n" -"DWARF section '%s' at offset %#<PRIx64>:\n" +msgid "cannot get line data section data: %s" msgstr "" -#: src/readelf.c:3721 +#: src/readelf.c:4541 #, c-format -msgid "cannot get line data section data: %s" +msgid "" +"\n" +"Table at offset %Zu:\n" msgstr "" -#: src/readelf.c:3741 +#: src/readelf.c:4550 #, c-format msgid "invalid data in section [%zu] '%s'" msgstr "" -#: src/readelf.c:3784 +#: src/readelf.c:4593 #, c-format msgid "" "\n" @@ -1054,134 +1554,154 @@ msgid "" "Opcodes:\n" msgstr "" -#: src/readelf.c:3810 +#: src/readelf.c:4612 +#, c-format +msgid "invalid data at offset %tu in section [%zu] '%s'" +msgstr "" + +#: src/readelf.c:4627 #, c-format msgid " [%*<PRIuFAST8>] %hhu argument\n" msgid_plural " [%*<PRIuFAST8>] %hhu arguments\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:3818 +#: src/readelf.c:4635 msgid "" "\n" "Directory table:" msgstr "" -#: src/readelf.c:3834 +#: src/readelf.c:4651 msgid "" "\n" "File name table:\n" " Entry Dir Time Size Name" msgstr "" -#: src/readelf.c:3863 +#: src/readelf.c:4680 msgid "" "\n" "Line number statements:" msgstr "" -#: src/readelf.c:3923 +#: src/readelf.c:4741 #, c-format -msgid " special opcode %u: address+%u = %#<PRIx64>, line%+d = %zu\n" +msgid " special opcode %u: address+%u = %s, line%+d = %zu\n" msgstr "" -#: src/readelf.c:3943 +#: src/readelf.c:4761 #, c-format msgid " extended opcode %u: " msgstr "" -#: src/readelf.c:3948 +#: src/readelf.c:4766 msgid "end of sequence" msgstr "" -#: src/readelf.c:3961 +#: src/readelf.c:4781 #, c-format -msgid "set address to %#<PRIx64>\n" +msgid "set address to %s\n" msgstr "" -#: src/readelf.c:3981 +#: src/readelf.c:4802 #, c-format msgid "define new file: dir=%u, mtime=%<PRIu64>, length=%<PRIu64>, name=%s\n" msgstr "" -#: src/readelf.c:3990 +#: src/readelf.c:4811 msgid "unknown opcode" msgstr "" -#: src/readelf.c:4002 +#: src/readelf.c:4823 msgid " copy" msgstr "" -#: src/readelf.c:4010 +#: src/readelf.c:4833 #, c-format -msgid " advance address by %u to %#<PRIx64>\n" +msgid "advance address by %u to %s\n" msgstr "" -#: src/readelf.c:4020 +#: src/readelf.c:4844 #, c-format msgid " advance line by constant %d to %<PRId64>\n" msgstr "" -#: src/readelf.c:4028 +#: src/readelf.c:4852 #, c-format msgid " set file to %<PRIu64>\n" msgstr "" -#: src/readelf.c:4038 +#: src/readelf.c:4862 #, c-format msgid " set column to %<PRIu64>\n" msgstr "" -#: src/readelf.c:4045 +#: src/readelf.c:4869 #, c-format msgid " set '%s' to %<PRIuFAST8>\n" msgstr "" -#: src/readelf.c:4051 +#: src/readelf.c:4875 msgid " set basic block flag" msgstr "" -#: src/readelf.c:4059 +#: src/readelf.c:4885 #, c-format -msgid " advance address by constant %u to %#<PRIx64>\n" +msgid "advance address by constant %u to %s\n" msgstr "" -#: src/readelf.c:4072 +#: src/readelf.c:4901 #, c-format -msgid " advance address by fixed value %u to %#<PRIx64>\n" +msgid "advance address by fixed value %u to %s\n" msgstr "" -#: src/readelf.c:4079 +#: src/readelf.c:4910 msgid " set prologue end flag" msgstr "" -#: src/readelf.c:4084 +#: src/readelf.c:4915 msgid " set epilogue begin flag" msgstr "" -#: src/readelf.c:4093 +#: src/readelf.c:4924 #, c-format msgid " unknown opcode with %<PRIu8> parameter:" msgid_plural " unknown opcode with %<PRIu8> parameters:" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:4165 +#: src/readelf.c:4959 +#, c-format +msgid "cannot get .debug_loc content: %s" +msgstr "" + +#: src/readelf.c:5014 +#, c-format +msgid " [%6tx] %s..%s" +msgstr "" + +#: src/readelf.c:5016 +#, c-format +msgid " %s..%s" +msgstr "" + +#: src/readelf.c:5069 #, c-format msgid "cannot get macro information section data: %s" msgstr "" -#: src/readelf.c:4244 +#: src/readelf.c:5148 #, c-format msgid "%*s*** non-terminated string at end of section" msgstr "" -#: src/readelf.c:4311 +#: src/readelf.c:5216 #, c-format msgid " [%5d] DIE offset: %6<PRId64>, CU DIE offset: %6<PRId64>, name: %s\n" msgstr "" -#: src/readelf.c:4346 +#: src/readelf.c:5257 #, c-format msgid "" "\n" @@ -1189,1883 +1709,2923 @@ msgid "" " %*s String\n" msgstr "" -#: src/readelf.c:4359 +#: src/readelf.c:5270 #, c-format msgid " *** error while reading strings: %s\n" msgstr "" -#: src/readelf.c:4384 +#: src/readelf.c:5289 #, c-format msgid "cannot get debug context descriptor: %s" msgstr "" -#: src/readelf.c:4461 +#: src/readelf.c:5419 src/readelf.c:5997 +#, c-format +msgid "cannot convert core note data: %s" +msgstr "" + +#: src/readelf.c:5724 #, c-format msgid "" "\n" -"Note segment of %<PRId64> bytes at offset %#0<PRIx64>:\n" +"%*s... <repeats %u more times> ..." msgstr "" -#: src/readelf.c:4468 +#: src/readelf.c:5766 #, c-format -msgid "cannot get content of note section: %s" +msgid "unable to handle register number %d" msgstr "" -#: src/readelf.c:4471 +#: src/readelf.c:5913 src/readelf.c:5937 +#, c-format +msgid "cannot register info: %s" +msgstr "" + +#: src/readelf.c:6095 msgid " Owner Data size Type\n" msgstr "" -#: src/readelf.c:4510 +#: src/readelf.c:6113 #, c-format msgid " %-13.*s %9<PRId32> %s\n" msgstr "" -#: src/size.c:52 +#: src/readelf.c:6144 +#, c-format +msgid "cannot get content of note section: %s" +msgstr "" + +#: src/readelf.c:6171 +#, c-format +msgid "" +"\n" +"Note section [%2zu] '%s' of %<PRIu64> bytes at offset %#0<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:6194 +#, c-format +msgid "" +"\n" +"Note segment of %<PRIu64> bytes at offset %#0<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:6240 +#, c-format +msgid "" +"\n" +"Section [%Zu] '%s' has no data to dump.\n" +msgstr "" + +#: src/readelf.c:6246 src/readelf.c:6268 +#, c-format +msgid "cannot get data for section [%Zu] '%s': %s" +msgstr "" + +#: src/readelf.c:6250 +#, c-format +msgid "" +"\n" +"Hex dump of section [%Zu] '%s', %<PRIu64> bytes at offset %#0<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:6263 +#, c-format +msgid "" +"\n" +"Section [%Zu] '%s' is empty.\n" +msgstr "" + +#: src/readelf.c:6272 +#, c-format +msgid "" +"\n" +"String section [%Zu] '%s' contains %<PRIu64> bytes at offset %#0<PRIx64>:\n" +msgstr "" + +#: src/readelf.c:6319 +#, c-format +msgid "" +"\n" +"section [%lu] does not exist" +msgstr "" + +#: src/readelf.c:6345 +#, c-format +msgid "" +"\n" +"section '%s' does not exist" +msgstr "" + +#: src/readelf.c:6406 +#, c-format +msgid "cannot get symbol index of archive '%s': %s" +msgstr "" + +#: src/readelf.c:6409 +#, c-format +msgid "" +"\n" +"Archive '%s' has no symbol index\n" +msgstr "" + +#: src/readelf.c:6413 +#, c-format +msgid "" +"\n" +"Index of archive '%s' has %Zu entries:\n" +msgstr "" + +#: src/readelf.c:6431 +#, c-format +msgid "cannot extract member at offset %Zu in '%s': %s" +msgstr "" + +#: src/readelf.c:6436 +#, c-format +msgid "Archive member '%s' contains:\n" +msgstr "" + +#: src/size.c:68 msgid "" "Use the output format FORMAT. FORMAT can be `bsd' or `sysv'. The default " "is `bsd'" msgstr "" -#: src/size.c:53 +#: src/size.c:70 msgid "Same as `--format=sysv'" msgstr "" -#: src/size.c:54 +#: src/size.c:71 msgid "Same as `--format=bsd'" msgstr "" -#: src/size.c:56 +#: src/size.c:74 msgid "Same as `--radix=10'" msgstr "" -#: src/size.c:57 +#: src/size.c:75 msgid "Same as `--radix=8'" msgstr "" -#: src/size.c:58 +#: src/size.c:76 msgid "Same as `--radix=16'" msgstr "" -#: src/size.c:59 +#: src/size.c:78 msgid "Similar to `--format=sysv' output but in one line" msgstr "" -#: src/size.c:62 +#: src/size.c:82 msgid "Print size and permission flags for loadable segments" msgstr "" -#: src/size.c:63 +#: src/size.c:83 msgid "Display the total sizes (bsd only)" msgstr "" -#: src/size.c:68 +#: src/size.c:88 msgid "List section sizes of FILEs (a.out by default)." msgstr "" -#: src/size.c:251 +#: src/size.c:269 #, c-format msgid "Invalid format: %s" msgstr "" -#: src/size.c:262 +#: src/size.c:280 #, c-format msgid "Invalid radix: %s" msgstr "" -#: src/size.c:336 +#: src/size.c:329 #, c-format msgid "%s: file format not recognized" msgstr "" -#: src/size.c:407 src/strip.c:1766 -#, c-format -msgid "while closing `%s'" -msgstr "" - -#: src/size.c:447 src/size.c:589 +#: src/size.c:439 src/size.c:582 #, c-format msgid " (ex %s)" msgstr "" -#: src/size.c:614 +#: src/size.c:607 msgid "(TOTALS)\n" msgstr "" -#: src/strip.c:58 +#: src/strip.c:73 msgid "Place stripped output into FILE" msgstr "" -#: src/strip.c:59 +#: src/strip.c:74 msgid "Extract the removed sections into FILE" msgstr "" -#: src/strip.c:62 +#: src/strip.c:75 +msgid "Embed name FILE instead of -f argument" +msgstr "" + +#: src/strip.c:79 msgid "Remove all debugging symbols" msgstr "" -#: src/strip.c:64 +#: src/strip.c:83 msgid "Copy modified/access timestamps to the output" msgstr "" -#: src/strip.c:66 +#: src/strip.c:85 msgid "Remove .comment section" msgstr "" -#: src/strip.c:68 +#: src/strip.c:88 msgid "Relax a few rules to handle slightly broken ELF files" msgstr "" -#: src/strip.c:73 +#: src/strip.c:93 msgid "Discard symbols from object files." msgstr "" -#: src/strip.c:164 +#: src/strip.c:185 +#, c-format msgid "Only one input file allowed together with '-o' and '-f'" msgstr "" -#: src/strip.c:262 src/strip.c:286 +#: src/strip.c:221 #, c-format -msgid "cannot stat input file \"%s\"" +msgid "-f option specified twice" msgstr "" -#: src/strip.c:276 +#: src/strip.c:230 #, c-format -msgid "while opening \"%s\"" +msgid "-F option specified twice" msgstr "" -#: src/strip.c:313 +#: src/strip.c:239 #, c-format -msgid "%s: cannot use -o when stripping archive" +msgid "-o option specified twice" +msgstr "" + +#: src/strip.c:259 +msgid "-R option supports only .comment section" msgstr "" -#: src/strip.c:419 src/strip.c:454 +#: src/strip.c:297 src/strip.c:321 #, c-format -msgid "cannot open `%s'" +msgid "cannot stat input file '%s'" msgstr "" -#: src/strip.c:434 +#: src/strip.c:311 +#, c-format +msgid "while opening '%s'" +msgstr "" + +#: src/strip.c:349 +#, c-format +msgid "%s: cannot use -o or -f when stripping archive" +msgstr "" + +#: src/strip.c:447 +#, c-format msgid "cannot open EBL backend" msgstr "" -#: src/strip.c:482 src/strip.c:508 +#: src/strip.c:497 src/strip.c:521 #, c-format -msgid "cannot create new file `%s': %s" +msgid "cannot create new file '%s': %s" msgstr "" -#: src/strip.c:569 +#: src/strip.c:581 #, c-format -msgid "illformed file `%s'" +msgid "illformed file '%s'" msgstr "" -#: src/strip.c:835 src/strip.c:944 +#: src/strip.c:867 src/strip.c:954 #, c-format msgid "while generating output file: %s" msgstr "" -#: src/strip.c:884 src/strip.c:1622 +#: src/strip.c:927 src/strip.c:1666 #, c-format msgid "%s: error while creating ELF header: %s" msgstr "" -#: src/strip.c:893 src/strip.c:1644 +#: src/strip.c:941 #, c-format -msgid "while writing `%s': %s" +msgid "while preparing output for '%s'" msgstr "" -#: src/strip.c:904 +#: src/strip.c:992 src/strip.c:1048 #, c-format -msgid "while creating '%s'" +msgid "while create section header section: %s" msgstr "" -#: src/strip.c:916 -msgid "while computing checksum for debug information" +#: src/strip.c:998 +#, c-format +msgid "cannot allocate section data: %s" msgstr "" -#: src/strip.c:931 +#: src/strip.c:1057 #, c-format -msgid "while preparing output for `%s'" +msgid "while create section header string table: %s" msgstr "" -#: src/strip.c:985 src/strip.c:1042 +#: src/strip.c:1591 src/strip.c:1688 #, c-format -msgid "while create section header section: %s" +msgid "while writing '%s': %s" msgstr "" -#: src/strip.c:991 +#: src/strip.c:1602 #, c-format -msgid "cannot allocate section data: %s" +msgid "while creating '%s'" msgstr "" -#: src/strip.c:1051 +#: src/strip.c:1614 #, c-format -msgid "while create section header string table: %s" +msgid "while computing checksum for debug information" msgstr "" -#: src/strip.c:1630 +#: src/strip.c:1674 #, c-format msgid "%s: error while reading the file: %s" msgstr "" -#: src/strip.c:1672 src/strip.c:1679 +#: src/strip.c:1720 src/strip.c:1727 #, c-format -msgid "error while finishing `%s': %s" +msgid "error while finishing '%s': %s" msgstr "" -#: src/strip.c:1702 src/strip.c:1759 +#: src/strip.c:1750 src/strip.c:1807 #, c-format -msgid "cannot set access and modification date of \"%s\"" +msgid "cannot set access and modification date of '%s'" +msgstr "" + +#: src/ld.c:87 +msgid "Input File Control:" msgstr "" -#: src/ld.c:71 +#: src/ld.c:89 msgid "Include whole archives in the output from now on." msgstr "" -#: src/ld.c:73 +#: src/ld.c:91 msgid "Stop including the whole arhives in the output." msgstr "" -#: src/ld.c:75 src/ld.c:116 src/ld.c:124 +#: src/ld.c:92 src/ld.c:106 src/ld.c:184 msgid "FILE" msgstr "" -#: src/ld.c:75 -msgid "Place output in FILE." +#: src/ld.c:93 +msgid "Start a group." msgstr "" -#: src/ld.c:77 -msgid "LEVEL" +#: src/ld.c:94 +msgid "End a group." msgstr "" -#: src/ld.c:78 -msgid "Set optimization level to LEVEL." +#: src/ld.c:95 +msgid "PATH" msgstr "" -#: src/ld.c:80 -msgid "Verbose messages." +#: src/ld.c:96 +msgid "Add PATH to list of directories files are searched in." msgstr "" -#: src/ld.c:81 -msgid "Trace file opens." +#: src/ld.c:98 +msgid "Only set DT_NEEDED for following dynamic libs if actually used" msgstr "" -#: src/ld.c:83 -msgid "Trade speed for less memory usage" +#: src/ld.c:100 +msgid "Always set DT_NEEDED for following dynamic libs" msgstr "" -#: src/ld.c:87 +#: src/ld.c:102 +msgid "Ignore LD_LIBRARY_PATH environment variable." +msgstr "" + +#: src/ld.c:105 +msgid "Output File Control:" +msgstr "" + +#: src/ld.c:106 +msgid "Place output in FILE." +msgstr "" + +#: src/ld.c:109 msgid "Object is marked to not use default search path at runtime." msgstr "" -#: src/ld.c:89 +#: src/ld.c:111 msgid "Same as --whole-archive." msgstr "" -#: src/ld.c:90 +#: src/ld.c:112 msgid "" "Default rules of extracting from archive; weak references are not enough." msgstr "" -#: src/ld.c:93 +#: src/ld.c:116 msgid "Weak references cause extraction from archive." msgstr "" -#: src/ld.c:95 +#: src/ld.c:118 msgid "Allow multiple definitions; first is used." msgstr "" -#: src/ld.c:97 +#: src/ld.c:120 msgid "Disallow/allow undefined symbols in DSOs." msgstr "" -#: src/ld.c:100 +#: src/ld.c:123 msgid "Object requires immediate handling of $ORIGIN." msgstr "" -#: src/ld.c:102 +#: src/ld.c:125 msgid "Relocation will not be processed lazily." msgstr "" -#: src/ld.c:104 +#: src/ld.c:127 msgid "Object cannot be unloaded at runtime." msgstr "" -#: src/ld.c:106 +#: src/ld.c:129 msgid "Mark object to be initialized first." msgstr "" -#: src/ld.c:108 +#: src/ld.c:131 msgid "Enable/disable lazy-loading flag for following dependencies." msgstr "" -#: src/ld.c:110 +#: src/ld.c:133 msgid "Mark object as not loadable with 'dlopen'." msgstr "" -#: src/ld.c:112 +#: src/ld.c:135 msgid "Ignore/record dependencies on unused DSOs." msgstr "" -#: src/ld.c:114 +#: src/ld.c:137 msgid "Generated DSO will be a system library." msgstr "" -#: src/ld.c:118 -msgid "Start a group." -msgstr "" - -#: src/ld.c:119 -msgid "End a group." -msgstr "" - -#: src/ld.c:121 -msgid "PATH" -msgstr "" - -#: src/ld.c:122 -msgid "Add PATH to list of directories files are searched in." -msgstr "" - -#: src/ld.c:124 -msgid "Use linker script in FILE." -msgstr "" - -#: src/ld.c:126 +#: src/ld.c:138 msgid "ADDRESS" msgstr "" -#: src/ld.c:126 +#: src/ld.c:138 msgid "Set entry point address." msgstr "" -#: src/ld.c:130 +#: src/ld.c:141 msgid "Do not link against shared libraries." msgstr "" -#: src/ld.c:133 +#: src/ld.c:144 msgid "Prefer linking against shared libraries." msgstr "" -#: src/ld.c:135 +#: src/ld.c:145 msgid "Export all dynamic symbols." msgstr "" -#: src/ld.c:137 +#: src/ld.c:146 msgid "Strip all symbols." msgstr "" -#: src/ld.c:138 +#: src/ld.c:147 msgid "Strip debugging symbols." msgstr "" -#: src/ld.c:141 +#: src/ld.c:149 msgid "Assume pagesize for the target system to be SIZE." msgstr "" -#: src/ld.c:146 +#: src/ld.c:151 msgid "Set runtime DSO search path." msgstr "" -#: src/ld.c:148 +#: src/ld.c:154 msgid "Set link time DSO search path." msgstr "" -#: src/ld.c:150 -msgid "Ignore LD_LIBRARY_PATH environment variable." -msgstr "" - -#: src/ld.c:153 -msgid "Read version information from FILE." -msgstr "" - #: src/ld.c:155 -msgid "Set emulation to NAME." -msgstr "" - -#: src/ld.c:157 msgid "Generate dynamic shared object." msgstr "" -#: src/ld.c:158 +#: src/ld.c:156 msgid "Generate relocatable object." msgstr "" -#: src/ld.c:162 +#: src/ld.c:159 msgid "Causes symbol not assigned to a version be reduced to local." msgstr "" -#: src/ld.c:164 +#: src/ld.c:160 msgid "Remove unused sections." msgstr "" -#: src/ld.c:166 +#: src/ld.c:163 msgid "Don't remove unused sections." msgstr "" -#: src/ld.c:168 +#: src/ld.c:164 msgid "Set soname of shared object." msgstr "" -#: src/ld.c:169 +#: src/ld.c:165 msgid "Set the dynamic linker name." msgstr "" +#: src/ld.c:168 +msgid "Add/suppress addition indentifying link-editor to .comment section." +msgstr "" + +#: src/ld.c:171 +msgid "Create .eh_frame_hdr section" +msgstr "" + #: src/ld.c:173 -msgid "Add/suppress addition indentifying link-editor to .comment section" +msgid "Set hash style to sysv, gnu or both." +msgstr "" + +#: src/ld.c:175 +msgid "Generate build ID note (md5, sha1 (default), uuid)." msgstr "" #: src/ld.c:177 -msgid "Select to get parser debug information" +msgid "Linker Operation Control:" +msgstr "" + +#: src/ld.c:178 +msgid "Verbose messages." +msgstr "" + +#: src/ld.c:179 +msgid "Trace file opens." +msgstr "" + +#: src/ld.c:181 +msgid "Trade speed for less memory usage" +msgstr "" + +#: src/ld.c:182 +msgid "LEVEL" +msgstr "" + +#: src/ld.c:183 +msgid "Set optimization level to LEVEL." msgstr "" #: src/ld.c:184 -msgid "Combine object and archive files." +msgid "Use linker script in FILE." msgstr "" #: src/ld.c:187 +msgid "Select to get parser debug information" +msgstr "" + +#: src/ld.c:190 +msgid "Read version information from FILE." +msgstr "" + +#: src/ld.c:191 +msgid "Set emulation to NAME." +msgstr "" + +#: src/ld.c:197 +msgid "Combine object and archive files." +msgstr "" + +#: src/ld.c:200 msgid "[FILE]..." msgstr "" -#: src/ld.c:319 +#: src/ld.c:333 +#, c-format msgid "At least one input file needed" msgstr "" -#: src/ld.c:330 +#: src/ld.c:349 +#, c-format msgid "error while preparing linking" msgstr "" -#: src/ld.c:337 +#: src/ld.c:356 #, c-format -msgid "cannot open linker script \"%s\"" +msgid "cannot open linker script '%s'" msgstr "" -#: src/ld.c:378 +#: src/ld.c:397 +#, c-format msgid "-( without matching -)" msgstr "" -#: src/ld.c:523 src/ld.c:561 +#: src/ld.c:572 src/ld.c:610 +#, c-format msgid "only one option of -G and -r is allowed" msgstr "" -#: src/ld.c:545 +#: src/ld.c:594 +#, c-format msgid "more than one '-m' parameter" msgstr "" -#: src/ld.c:555 src/ld.c:925 +#: src/ld.c:604 src/ld.c:1013 #, c-format msgid "unknown option `-%c %s'" msgstr "" -#: src/ld.c:597 +#: src/ld.c:646 +#, c-format +msgid "invalid page size value '%s': ignored" +msgstr "" + +#: src/ld.c:687 #, c-format -msgid "invalid page size value \"%s\": ignored" +msgid "invalid hash style '%s'" msgstr "" -#: src/ld.c:706 +#: src/ld.c:697 +#, c-format +msgid "invalid build-ID style '%s'" +msgstr "" + +#: src/ld.c:785 +#, c-format msgid "More than one output file name given." msgstr "" -#: src/ld.c:723 +#: src/ld.c:802 #, c-format msgid "Invalid optimization level `%s'" msgstr "" -#: src/ld.c:764 +#: src/ld.c:850 +#, c-format msgid "nested -( -) groups are not allowed" msgstr "" -#: src/ld.c:783 +#: src/ld.c:869 +#, c-format msgid "-) without matching -(" msgstr "" -#: src/ld.c:954 +#: src/ld.c:1046 #, c-format msgid "unknown option '-%c %s'" msgstr "" -#: src/ld.c:1058 +#: src/ld.c:1150 +#, c-format msgid "could not find input file to determine output file format" msgstr "" -#: src/ld.c:1060 +#: src/ld.c:1152 +#, c-format msgid "try again with an appropriate '-m' parameter" msgstr "" -#: src/ld.c:1352 +#: src/ld.c:1445 #, c-format -msgid "cannot read version script \"%s\"" +msgid "cannot read version script '%s'" msgstr "" -#: src/ld.c:1418 src/ld.c:1457 +#: src/ld.c:1511 src/ld.c:1550 #, c-format msgid "duplicate definition of '%s' in linker script" msgstr "" -#: src/ldgeneric.c:179 src/ldgeneric.c:4464 +#: src/ldgeneric.c:209 src/ldgeneric.c:5151 +#, c-format msgid "cannot create string table" msgstr "" -#: src/ldgeneric.c:224 +#: src/ldgeneric.c:255 #, c-format msgid "cannot load ld backend library '%s': %s" msgstr "" -#: src/ldgeneric.c:234 +#: src/ldgeneric.c:265 #, c-format msgid "cannot find init function in ld backend library '%s': %s" msgstr "" -#: src/ldgeneric.c:279 +#: src/ldgeneric.c:310 #, c-format msgid "%s listed more than once as input" msgstr "" -#: src/ldgeneric.c:393 +#: src/ldgeneric.c:424 #, c-format msgid "%s (for -l%s)\n" msgstr "" -#: src/ldgeneric.c:394 +#: src/ldgeneric.c:425 #, c-format msgid "%s (for DT_NEEDED %s)\n" msgstr "" -#: src/ldgeneric.c:488 +#: src/ldgeneric.c:519 #, c-format msgid "cannot open %s" msgstr "" -#: src/ldgeneric.c:510 +#: src/ldgeneric.c:573 #, c-format msgid "Warning: type of `%s' changed from %s in %s to %s in %s" msgstr "" -#: src/ldgeneric.c:523 +#: src/ldgeneric.c:586 #, c-format msgid "Warning: size of `%s' changed from %<PRIu64> in %s to %<PRIu64> in %s" msgstr "" -#: src/ldgeneric.c:609 +#: src/ldgeneric.c:677 #, c-format msgid "(%s+%#<PRIx64>): multiple definition of %s `%s'\n" msgstr "" -#: src/ldgeneric.c:639 +#: src/ldgeneric.c:700 #, c-format msgid "(%s+%#<PRIx64>): first defined here\n" msgstr "" -#: src/ldgeneric.c:758 +#: src/ldgeneric.c:819 #, c-format msgid "%s: cannot get section group data: %s" msgstr "" -#: src/ldgeneric.c:779 +#: src/ldgeneric.c:840 #, c-format msgid "%s: section '%s' with group flag set does not belong to any group" msgstr "" -#: src/ldgeneric.c:824 +#: src/ldgeneric.c:885 #, c-format -msgid "%s: section [%2d] '%s' is in more than one section group" +msgid "%s: section [%2d] '%s' is not in the correct section group" msgstr "" -#: src/ldgeneric.c:1060 src/ldgeneric.c:1252 src/ldgeneric.c:1261 -#: src/ldgeneric.c:1318 src/ldgeneric.c:1327 src/ldgeneric.c:1579 -#: src/ldgeneric.c:1831 +#: src/ldgeneric.c:1156 src/ldgeneric.c:1413 src/ldgeneric.c:1422 +#: src/ldgeneric.c:1481 src/ldgeneric.c:1490 src/ldgeneric.c:1753 +#: src/ldgeneric.c:2005 #, c-format msgid "%s: invalid ELF file (%s:%d)\n" msgstr "" -#: src/ldgeneric.c:1153 +#: src/ldgeneric.c:1250 #, c-format msgid "%s: only files of type ET_REL might contain section groups" msgstr "" -#: src/ldgeneric.c:1187 +#: src/ldgeneric.c:1302 #, c-format msgid "%s: cannot determine signature of section group [%2zd] '%s': %s" msgstr "" -#: src/ldgeneric.c:1206 +#: src/ldgeneric.c:1314 #, c-format -msgid "%s: section '%s' has unknown type: %d" +msgid "%s: cannot get content of section group [%2zd] '%s': %s'" msgstr "" -#: src/ldgeneric.c:1555 +#: src/ldgeneric.c:1328 #, c-format -msgid "cannot get descriptor for ELF file (%s:%d): %s\n" +msgid "" +"%s: group member %zu of section group [%2zd] '%s' has too high index: %" +"<PRIu32>" +msgstr "" + +#: src/ldgeneric.c:1350 +#, c-format +msgid "%s: section '%s' has unknown type: %d" msgstr "" -#: src/ldgeneric.c:1593 +#: src/ldgeneric.c:1729 #, c-format -msgid "cannot open \"%s\"" +msgid "cannot get descriptor for ELF file (%s:%d): %s\n" msgstr "" -#: src/ldgeneric.c:1724 +#: src/ldgeneric.c:1899 #, c-format msgid "cannot read archive `%s': %s" msgstr "" -#: src/ldgeneric.c:1846 +#: src/ldgeneric.c:2020 #, c-format msgid "file of type %s cannot be linked in\n" msgstr "" -#: src/ldgeneric.c:1858 +#: src/ldgeneric.c:2032 +#, c-format +msgid "%s: input file incompatible with ELF machine type %s\n" +msgstr "" + +#: src/ldgeneric.c:2044 #, c-format msgid "%s: cannot get section header string table index: %s\n" msgstr "" -#: src/ldgeneric.c:1887 +#: src/ldgeneric.c:2073 #, c-format msgid "cannot use DSO '%s' when generating relocatable object file" msgstr "" -#: src/ldgeneric.c:1972 +#: src/ldgeneric.c:2158 #, c-format msgid "input file '%s' ignored" msgstr "" -#: src/ldgeneric.c:2167 +#: src/ldgeneric.c:2372 #, c-format msgid "undefined symbol `%s' in %s" msgstr "" -#: src/ldgeneric.c:2474 libasm/asm_error.c:110 -msgid "cannot create output file" -msgstr "" - -#: src/ldgeneric.c:2489 +#: src/ldgeneric.c:2702 #, c-format msgid "cannot create ELF descriptor for output file: %s" msgstr "" -#: src/ldgeneric.c:2496 +#: src/ldgeneric.c:2709 #, c-format msgid "could not create ELF header for output file: %s" msgstr "" -#: src/ldgeneric.c:3006 src/ldgeneric.c:3076 src/ldgeneric.c:3112 -#: src/ldgeneric.c:3799 src/ldgeneric.c:3837 src/ldgeneric.c:3869 -#: src/ldgeneric.c:4086 src/ldgeneric.c:4141 src/ldgeneric.c:4388 -#: src/ldgeneric.c:4444 src/ldgeneric.c:4886 src/ldgeneric.c:4898 -#: libasm/asm_end.c:97 libasm/asm_end.c:135 libasm/asm_end.c:151 -#: libasm/asm_end.c:279 +#: src/ldgeneric.c:3224 src/ldgeneric.c:3294 src/ldgeneric.c:3330 +#: src/ldgeneric.c:4457 src/ldgeneric.c:4506 src/ldgeneric.c:4538 +#: src/ldgeneric.c:4773 src/ldgeneric.c:4828 src/ldgeneric.c:5075 +#: src/ldgeneric.c:5131 src/ldgeneric.c:5600 src/ldgeneric.c:5612 #, c-format msgid "cannot create section for output file: %s" msgstr "" -#: src/ldgeneric.c:3226 +#: src/ldgeneric.c:3444 #, c-format msgid "address computation expression contains variable '%s'" msgstr "" -#: src/ldgeneric.c:3271 +#: src/ldgeneric.c:3489 #, c-format msgid "" "argument '%<PRIuMAX>' of ALIGN in address computation expression is no power " "of two" msgstr "" -#: src/ldgeneric.c:3454 +#: src/ldgeneric.c:3684 #, c-format -msgid "cannot find entry symbol \"%s\": defaulting to %#0*<PRIx64>" +msgid "cannot find entry symbol '%s': defaulting to %#0*<PRIx64>" msgstr "" -#: src/ldgeneric.c:3460 +#: src/ldgeneric.c:3690 #, c-format msgid "no entry symbol specified: defaulting to %#0*<PRIx64>" msgstr "" -#: src/ldgeneric.c:3700 src/ldgeneric.c:3721 src/ldgeneric.c:3750 -#: src/ldgeneric.c:5396 +#: src/ldgeneric.c:3920 +#, c-format +msgid "cannot create GNU hash table section for output file: %s" +msgstr "" + +#: src/ldgeneric.c:4071 +#, c-format +msgid "cannot create hash table section for output file: %s" +msgstr "" + +#: src/ldgeneric.c:4114 +#, c-format +msgid "cannot create build ID section: %s" +msgstr "" + +#: src/ldgeneric.c:4191 +#, c-format +msgid "cannot convert section data to file format: %s" +msgstr "" + +#: src/ldgeneric.c:4200 +#, c-format +msgid "cannot convert section data to memory format: %s" +msgstr "" + +#: src/ldgeneric.c:4261 +#, c-format +msgid "cannot read enough data for UUID" +msgstr "" + +#: src/ldgeneric.c:4358 src/ldgeneric.c:4379 src/ldgeneric.c:4408 +#: src/ldgeneric.c:6062 #, c-format msgid "cannot create symbol table for output file: %s" msgstr "" -#: src/ldgeneric.c:4611 src/ldgeneric.c:5138 +#: src/ldgeneric.c:5300 src/ldgeneric.c:5852 +#, c-format msgid "section index too large in dynamic symbol table" msgstr "" -#: src/ldgeneric.c:5031 +#: src/ldgeneric.c:5745 #, c-format msgid "cannot create versioning section: %s" msgstr "" -#: src/ldgeneric.c:5104 +#: src/ldgeneric.c:5818 #, c-format msgid "cannot create dynamic symbol table for output file: %s" msgstr "" -#: src/ldgeneric.c:5245 -#, c-format -msgid "cannot create hash table section for output file: %s" -msgstr "" - -#: src/ldgeneric.c:5324 +#: src/ldgeneric.c:5994 #, c-format msgid "cannot create versioning data: %s" msgstr "" -#: src/ldgeneric.c:5428 src/ldgeneric.c:5441 src/ldgeneric.c:5505 -#: src/ldgeneric.c:5513 +#: src/ldgeneric.c:6094 src/ldgeneric.c:6107 src/ldgeneric.c:6171 +#: src/ldgeneric.c:6179 #, c-format msgid "cannot create section header string section: %s" msgstr "" -#: src/ldgeneric.c:5435 +#: src/ldgeneric.c:6101 +#, c-format msgid "cannot create section header string section" msgstr "" -#: src/ldgeneric.c:5588 +#: src/ldgeneric.c:6259 #, c-format msgid "cannot create program header: %s" msgstr "" -#: src/ldgeneric.c:5596 +#: src/ldgeneric.c:6267 #, c-format msgid "while determining file layout: %s" msgstr "" -#: src/ldgeneric.c:5684 -msgid "internal error: nobits section follows nobits section" +#: src/ldgeneric.c:6388 +#, c-format +msgid "internal error: non-nobits section follows nobits section" msgstr "" -#: src/ldgeneric.c:6180 +#: src/ldgeneric.c:6925 #, c-format msgid "cannot get header of 0th section: %s" msgstr "" -#: src/ldgeneric.c:6196 +#: src/ldgeneric.c:6941 #, c-format msgid "cannot update ELF header: %s" msgstr "" -#: src/ldgeneric.c:6217 +#: src/ldgeneric.c:6972 +#, c-format msgid "linker backend didn't specify function to relocate section" msgstr "" -#: src/ldgeneric.c:6229 +#: src/ldgeneric.c:6984 #, c-format msgid "while writing output file: %s" msgstr "" -#: src/ldgeneric.c:6234 +#: src/ldgeneric.c:6989 #, c-format msgid "while finishing output file: %s" msgstr "" -#: src/ldgeneric.c:6240 +#: src/ldgeneric.c:6995 +#, c-format msgid "cannot stat output file" msgstr "" -#: src/ldgeneric.c:6246 libasm/asm_error.c:113 -msgid "cannot rename output file" -msgstr "" - -#: src/ldgeneric.c:6256 +#: src/ldgeneric.c:7011 +#, c-format msgid "WARNING: temporary output file overwritten before linking finished" msgstr "" -#: src/ldgeneric.c:6309 src/ldgeneric.c:6320 src/ldgeneric.c:6331 -#: src/ldgeneric.c:6349 src/ldgeneric.c:6362 src/ldgeneric.c:6374 +#: src/ldgeneric.c:7064 src/ldgeneric.c:7075 src/ldgeneric.c:7086 +#: src/ldgeneric.c:7097 src/ldgeneric.c:7116 src/ldgeneric.c:7129 +#: src/ldgeneric.c:7141 #, c-format msgid "no machine specific '%s' implementation" msgstr "" -#: src/ldscript.y:162 +#: src/ldscript.y:178 msgid "mode for segment invalid\n" msgstr "" -#: src/ldscript.y:430 +#: src/ldscript.y:465 #, c-format msgid "while reading version script '%s': %s at line %d" msgstr "" -#: src/ldscript.y:431 +#: src/ldscript.y:466 #, c-format msgid "while reading linker script '%s': %s at line %d" msgstr "" -#: src/ldscript.y:695 +#: src/ldscript.y:745 #, c-format msgid "symbol '%s' in declared both local and global for unnamed version" msgstr "" -#: src/ldscript.y:697 +#: src/ldscript.y:747 #, c-format msgid "symbol '%s' in declared both local and global for version '%s'" msgstr "" -#: src/ldscript.y:717 src/ldscript.y:724 +#: src/ldscript.y:767 src/ldscript.y:774 +#, c-format msgid "default visibility set as local and global" msgstr "" -#: src/elflint.c:53 +#: src/elflint.c:72 msgid "Be extremely strict, flag level 2 features." msgstr "" -#: src/elflint.c:54 +#: src/elflint.c:73 msgid "Do not print anything if successful" msgstr "" -#: src/elflint.c:56 +#: src/elflint.c:74 +msgid "Binary is a separate debuginfo file" +msgstr "" + +#: src/elflint.c:76 msgid "" "Binary has been created with GNU ld and is therefore known to be broken in " "certain ways" msgstr "" -#: src/elflint.c:62 +#: src/elflint.c:82 msgid "Pedantic checking of ELF files compliance with gABI/psABI spec." msgstr "" -#: src/elflint.c:175 +#: src/elflint.c:166 +#, c-format +msgid "cannot generate Elf descriptor: %s\n" +msgstr "" + +#: src/elflint.c:185 #, c-format msgid "error while closing Elf descriptor: %s\n" msgstr "" -#: src/elflint.c:179 +#: src/elflint.c:189 msgid "No errors" msgstr "" -#: src/elflint.c:371 +#: src/elflint.c:303 +#, c-format +msgid " error while freeing sub-ELF descriptor: %s\n" +msgstr "" + +#: src/elflint.c:311 +#, c-format +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "" + +#: src/elflint.c:370 #, c-format msgid "e_ident[%d] == %d is no known class\n" msgstr "" -#: src/elflint.c:376 +#: src/elflint.c:375 #, c-format msgid "e_ident[%d] == %d is no known data encoding\n" msgstr "" -#: src/elflint.c:380 +#: src/elflint.c:379 #, c-format msgid "unknown ELF header version number e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:385 +#: src/elflint.c:384 #, c-format -msgid "unsupported OS ABI e_ident[%d] == \"%s\"\n" +msgid "unsupported OS ABI e_ident[%d] == '%s'\n" msgstr "" -#: src/elflint.c:391 +#: src/elflint.c:390 #, c-format msgid "unsupport ABI version e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:396 +#: src/elflint.c:395 #, c-format msgid "e_ident[%zu] is not zero\n" msgstr "" -#: src/elflint.c:401 +#: src/elflint.c:400 #, c-format msgid "unknown object file type %d\n" msgstr "" -#: src/elflint.c:408 +#: src/elflint.c:407 #, c-format msgid "unknown machine type %d\n" msgstr "" -#: src/elflint.c:412 +#: src/elflint.c:411 +#, c-format msgid "unknown object file version\n" msgstr "" -#: src/elflint.c:418 +#: src/elflint.c:417 +#, c-format msgid "invalid program header offset\n" msgstr "" -#: src/elflint.c:420 +#: src/elflint.c:419 +#, c-format msgid "executables and DSOs cannot have zero program header offset\n" msgstr "" -#: src/elflint.c:424 +#: src/elflint.c:423 +#, c-format msgid "invalid number of program header entries\n" msgstr "" -#: src/elflint.c:432 +#: src/elflint.c:431 +#, c-format msgid "invalid section header table offset\n" msgstr "" -#: src/elflint.c:435 +#: src/elflint.c:434 +#, c-format msgid "section header table must be present\n" msgstr "" -#: src/elflint.c:451 +#: src/elflint.c:448 +#, c-format msgid "invalid number of section header table entries\n" msgstr "" -#: src/elflint.c:470 src/elflint.c:476 +#: src/elflint.c:465 +#, c-format msgid "invalid section header index\n" msgstr "" -#: src/elflint.c:481 +#: src/elflint.c:470 #, c-format msgid "invalid machine flags: %s\n" msgstr "" -#: src/elflint.c:488 src/elflint.c:505 +#: src/elflint.c:477 src/elflint.c:494 #, c-format msgid "invalid ELF header size: %hd\n" msgstr "" -#: src/elflint.c:491 src/elflint.c:508 +#: src/elflint.c:480 src/elflint.c:497 #, c-format msgid "invalid program header size: %hd\n" msgstr "" -#: src/elflint.c:494 src/elflint.c:511 +#: src/elflint.c:483 src/elflint.c:500 +#, c-format msgid "invalid program header position or size\n" msgstr "" -#: src/elflint.c:497 src/elflint.c:514 +#: src/elflint.c:486 src/elflint.c:503 #, c-format msgid "invalid section header size: %hd\n" msgstr "" -#: src/elflint.c:500 src/elflint.c:517 +#: src/elflint.c:489 src/elflint.c:506 +#, c-format msgid "invalid section header position or size\n" msgstr "" -#: src/elflint.c:566 +#: src/elflint.c:550 #, c-format msgid "" "section [%2d] '%s': section with SHF_GROUP flag set not part of a section " "group\n" msgstr "" -#: src/elflint.c:570 +#: src/elflint.c:554 #, c-format msgid "" "section [%2d] '%s': section group [%2zu] '%s' does not preceed group member\n" msgstr "" -#: src/elflint.c:595 src/elflint.c:1015 src/elflint.c:1150 src/elflint.c:1337 -#: src/elflint.c:1584 +#: src/elflint.c:570 src/elflint.c:1395 src/elflint.c:1445 src/elflint.c:1554 +#: src/elflint.c:2148 src/elflint.c:2662 src/elflint.c:2823 src/elflint.c:2953 +#: src/elflint.c:3125 src/elflint.c:4005 #, c-format msgid "section [%2d] '%s': cannot get section data\n" msgstr "" -#: src/elflint.c:601 src/elflint.c:1344 +#: src/elflint.c:583 src/elflint.c:1561 #, c-format msgid "" "section [%2d] '%s': referenced as string table for section [%2d] '%s' but " "type is not SHT_STRTAB\n" msgstr "" -#: src/elflint.c:633 +#: src/elflint.c:606 #, c-format -msgid "section [%2zu] '%s': entry size is does not match ElfXX_Sym\n" +msgid "" +"section [%2d] '%s': symbol table cannot have more than one extended index " +"section\n" msgstr "" -#: src/elflint.c:642 +#: src/elflint.c:617 +#, c-format +msgid "section [%2u] '%s': entry size is does not match ElfXX_Sym\n" +msgstr "" + +#: src/elflint.c:626 #, c-format msgid "section [%2d] '%s': cannot get symbol %d: %s\n" msgstr "" -#: src/elflint.c:647 src/elflint.c:650 src/elflint.c:653 src/elflint.c:656 -#: src/elflint.c:659 src/elflint.c:662 +#: src/elflint.c:631 src/elflint.c:634 src/elflint.c:637 src/elflint.c:640 +#: src/elflint.c:643 src/elflint.c:646 #, c-format msgid "section [%2d] '%s': '%s' in zeroth entry not zero\n" msgstr "" -#: src/elflint.c:665 +#: src/elflint.c:649 #, c-format msgid "section [%2d] '%s': XINDEX for zeroth entry not zero\n" msgstr "" -#: src/elflint.c:675 +#: src/elflint.c:659 #, c-format msgid "section [%2d] '%s': cannot get symbol %zu: %s\n" msgstr "" -#: src/elflint.c:682 +#: src/elflint.c:668 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid name value\n" msgstr "" -#: src/elflint.c:695 +#: src/elflint.c:681 #, c-format msgid "" "section [%2d] '%s': symbol %zu: too large section index but no extended " "section index section\n" msgstr "" -#: src/elflint.c:701 +#: src/elflint.c:687 #, c-format msgid "" "section [%2d] '%s': symbol %zu: XINDEX used for index which would fit in " "st_shndx (%<PRIu32>)\n" msgstr "" -#: src/elflint.c:713 +#: src/elflint.c:699 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid section index\n" msgstr "" -#: src/elflint.c:720 +#: src/elflint.c:707 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown type\n" msgstr "" -#: src/elflint.c:724 +#: src/elflint.c:711 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown symbol binding\n" msgstr "" -#: src/elflint.c:732 +#: src/elflint.c:719 #, c-format msgid "" "section [%2d] '%s': symbol %zu: COMMON only allowed in relocatable files\n" msgstr "" -#: src/elflint.c:736 +#: src/elflint.c:723 #, c-format msgid "section [%2d] '%s': symbol %zu: local COMMON symbols are nonsense\n" msgstr "" -#: src/elflint.c:740 +#: src/elflint.c:727 #, c-format msgid "" "section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n" msgstr "" -#: src/elflint.c:755 +#: src/elflint.c:759 #, c-format msgid "section [%2d] '%s': symbol %zu: st_value out of bounds\n" msgstr "" -#: src/elflint.c:760 src/elflint.c:784 src/elflint.c:827 +#: src/elflint.c:765 src/elflint.c:790 src/elflint.c:833 #, c-format msgid "" "section [%2d] '%s': symbol %zu does not fit completely in referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:768 +#: src/elflint.c:774 #, c-format msgid "" "section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have " "SHF_TLS flag set\n" msgstr "" -#: src/elflint.c:778 src/elflint.c:820 +#: src/elflint.c:784 src/elflint.c:826 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:805 +#: src/elflint.c:811 #, c-format msgid "" "section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n" msgstr "" -#: src/elflint.c:813 +#: src/elflint.c:819 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value short of referenced section [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:840 +#: src/elflint.c:846 #, c-format msgid "" "section [%2d] '%s': symbol %zu: local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:847 +#: src/elflint.c:853 #, c-format msgid "" "section [%2d] '%s': symbol %zu: non-local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:854 +#: src/elflint.c:860 #, c-format msgid "section [%2d] '%s': symbol %zu: non-local section symbol\n" msgstr "" -#: src/elflint.c:883 +#: src/elflint.c:910 +#, c-format +msgid "" +"section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to bad section [%" +"2d]\n" +msgstr "" + +#: src/elflint.c:917 +#, c-format +msgid "" +"section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to section [%2d] '%" +"s'\n" +msgstr "" + +#: src/elflint.c:933 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#<PRIx64> does not " -"match .got section address %#<PRIx64>\n" +"match %s section address %#<PRIx64>\n" msgstr "" -#: src/elflint.c:890 +#: src/elflint.c:940 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol size %<PRIu64> does not " -"match .got section size %<PRIu64>\n" +"match %s section size %<PRIu64>\n" msgstr "" -#: src/elflint.c:901 +#: src/elflint.c:948 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol present, but no .got " "section\n" msgstr "" -#: src/elflint.c:920 +#: src/elflint.c:964 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC_ symbol value %#<PRIx64> does not match dynamic " "segment address %#<PRIx64>\n" msgstr "" -#: src/elflint.c:927 +#: src/elflint.c:971 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC symbol size %<PRIu64> does not match dynamic " "segment size %<PRIu64>\n" msgstr "" -#: src/elflint.c:980 +#: src/elflint.c:1022 +#, c-format +msgid "section [%2d] '%s': DT_RELCOUNT used for this RELA section\n" +msgstr "" + +#: src/elflint.c:1031 src/elflint.c:1083 #, c-format msgid "section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n" msgstr "" -#: src/elflint.c:1022 src/elflint.c:1157 +#: src/elflint.c:1056 src/elflint.c:1108 +#, c-format +msgid "" +"section [%2d] '%s': relative relocations after index %d as specified by " +"DT_RELCOUNT\n" +msgstr "" + +#: src/elflint.c:1062 src/elflint.c:1114 +#, c-format +msgid "" +"section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT " +"specified %d relative relocations\n" +msgstr "" + +#: src/elflint.c:1074 +#, c-format +msgid "section [%2d] '%s': DT_RELACOUNT used for this REL section\n" +msgstr "" + +#: src/elflint.c:1156 #, c-format msgid "section [%2d] '%s': invalid destination section index\n" msgstr "" -#: src/elflint.c:1035 src/elflint.c:1170 +#: src/elflint.c:1169 #, c-format msgid "section [%2d] '%s': invalid destination section type\n" msgstr "" -#: src/elflint.c:1043 src/elflint.c:1178 +#: src/elflint.c:1177 #, c-format msgid "section [%2d] '%s': sh_info should be zero\n" msgstr "" -#: src/elflint.c:1050 src/elflint.c:1185 +#: src/elflint.c:1184 #, c-format msgid "section [%2d] '%s': no relocations for merge-able sections possible\n" msgstr "" -#: src/elflint.c:1057 +#: src/elflint.c:1191 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Rela\n" msgstr "" -#: src/elflint.c:1074 src/elflint.c:1209 +#: src/elflint.c:1251 #, c-format -msgid "section [%2d] '%s': cannot get relocation %zu: %s\n" +msgid "text relocation flag set but there is no read-only segment\n" msgstr "" -#: src/elflint.c:1081 src/elflint.c:1216 +#: src/elflint.c:1278 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid type\n" msgstr "" -#: src/elflint.c:1084 src/elflint.c:1219 +#: src/elflint.c:1286 #, c-format msgid "" "section [%2d] '%s': relocation %zu: relocation type invalid for the file " "type\n" msgstr "" -#: src/elflint.c:1092 src/elflint.c:1227 +#: src/elflint.c:1294 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid symbol index\n" msgstr "" -#: src/elflint.c:1107 src/elflint.c:1242 +#: src/elflint.c:1312 #, c-format msgid "" "section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can " "be used with %s\n" msgstr "" -#: src/elflint.c:1122 src/elflint.c:1258 +#: src/elflint.c:1329 #, c-format msgid "section [%2d] '%s': relocation %zu: offset out of bounds\n" msgstr "" -#: src/elflint.c:1192 +#: src/elflint.c:1344 #, c-format -msgid "section [%2d] '%s': section entry size does not match ElfXX_Rel\n" +msgid "" +"section [%2d] '%s': relocation %zu: copy relocation against symbol of type %" +"s\n" msgstr "" -#: src/elflint.c:1328 +#: src/elflint.c:1365 +#, c-format +msgid "" +"section [%2d] '%s': relocation %zu: read-only section modified but text " +"relocation flag not set\n" +msgstr "" + +#: src/elflint.c:1380 +#, c-format +msgid "section [%2d] '%s': relocations are against loaded and unloaded data\n" +msgstr "" + +#: src/elflint.c:1419 src/elflint.c:1469 +#, c-format +msgid "section [%2d] '%s': cannot get relocation %zu: %s\n" +msgstr "" + +#: src/elflint.c:1549 +#, c-format msgid "more than one dynamic section present\n" msgstr "" -#: src/elflint.c:1350 +#: src/elflint.c:1567 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Dyn\n" msgstr "" -#: src/elflint.c:1355 src/elflint.c:1517 +#: src/elflint.c:1572 src/elflint.c:1864 #, c-format msgid "section [%2d] '%s': sh_info not zero\n" msgstr "" -#: src/elflint.c:1367 +#: src/elflint.c:1582 #, c-format msgid "section [%2d] '%s': cannot get dynamic section entry %zu: %s\n" msgstr "" -#: src/elflint.c:1375 +#: src/elflint.c:1590 #, c-format msgid "section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n" msgstr "" -#: src/elflint.c:1382 +#: src/elflint.c:1597 #, c-format msgid "section [%2d] '%s': entry %zu: unknown tag\n" msgstr "" -#: src/elflint.c:1393 +#: src/elflint.c:1608 #, c-format msgid "section [%2d] '%s': entry %zu: more than one entry with tag %s\n" msgstr "" -#: src/elflint.c:1403 +#: src/elflint.c:1618 #, c-format msgid "section [%2d] '%s': entry %zu: level 2 tag %s used\n" msgstr "" -#: src/elflint.c:1415 +#: src/elflint.c:1636 #, c-format msgid "" "section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n" msgstr "" -#: src/elflint.c:1440 +#: src/elflint.c:1658 +#, c-format +msgid "" +"section [%2d] '%s': entry %zu: pointer does not match address of section [%" +"2d] '%s' referenced by sh_link\n" +msgstr "" + +#: src/elflint.c:1701 +#, c-format +msgid "" +"section [%2d] '%s': entry %zu: %s value must point into loaded segment\n" +msgstr "" + +#: src/elflint.c:1716 +#, c-format +msgid "" +"section [%2d] '%s': entry %zu: %s value must be valid offset in section [%" +"2d] '%s'\n" +msgstr "" + +#: src/elflint.c:1736 src/elflint.c:1764 #, c-format msgid "section [%2d] '%s': contains %s entry but not %s\n" msgstr "" -#: src/elflint.c:1452 +#: src/elflint.c:1748 #, c-format msgid "section [%2d] '%s': mandatory tag %s not present\n" msgstr "" -#: src/elflint.c:1462 src/elflint.c:1469 +#: src/elflint.c:1757 +#, c-format +msgid "section [%2d] '%s': no hash section present\n" +msgstr "" + +#: src/elflint.c:1772 src/elflint.c:1779 #, c-format msgid "section [%2d] '%s': not all of %s, %s, and %s are present\n" msgstr "" -#: src/elflint.c:1497 +#: src/elflint.c:1789 src/elflint.c:1793 +#, c-format +msgid "section [%2d] '%s': %s tag missing in DSO marked during prelinking\n" +msgstr "" + +#: src/elflint.c:1799 +#, c-format +msgid "section [%2d] '%s': non-DSO file marked as dependency during prelink\n" +msgstr "" + +#: src/elflint.c:1810 src/elflint.c:1814 src/elflint.c:1818 src/elflint.c:1822 +#, c-format +msgid "section [%2d] '%s': %s tag missing in prelinked executable\n" +msgstr "" + +#: src/elflint.c:1834 +#, c-format +msgid "" +"section [%2d] '%s': only relocatable files can have extended section index\n" +msgstr "" + +#: src/elflint.c:1844 #, c-format msgid "" "section [%2d] '%s': extended section index section not for symbol table\n" msgstr "" -#: src/elflint.c:1502 +#: src/elflint.c:1849 +#, c-format msgid "cannot get data for symbol section\n" msgstr "" -#: src/elflint.c:1505 src/elflint.c:1596 +#: src/elflint.c:1852 #, c-format msgid "section [%2d] '%s': entry size does not match Elf32_Word\n" msgstr "" -#: src/elflint.c:1512 +#: src/elflint.c:1859 #, c-format msgid "section [%2d] '%s': extended index table too small for symbol table\n" msgstr "" -#: src/elflint.c:1529 +#: src/elflint.c:1874 #, c-format msgid "" "section [%2d] '%s': extended section index in section [%2zu] '%s' refers to " "same symbol table\n" msgstr "" -#: src/elflint.c:1540 +#: src/elflint.c:1885 +#, c-format msgid "symbol 0 should have zero extended section index\n" msgstr "" -#: src/elflint.c:1552 +#: src/elflint.c:1897 #, c-format msgid "cannot get data for symbol %zu\n" msgstr "" -#: src/elflint.c:1557 +#: src/elflint.c:1902 #, c-format msgid "extended section index is %<PRIu32> but symbol index is not XINDEX\n" msgstr "" -#: src/elflint.c:1591 +#: src/elflint.c:1918 src/elflint.c:1959 +#, c-format +msgid "" +"section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n" +msgstr "" + +#: src/elflint.c:1930 src/elflint.c:1971 +#, c-format +msgid "section [%2d] '%s': chain array too large\n" +msgstr "" + +#: src/elflint.c:1939 src/elflint.c:1980 +#, c-format +msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n" +msgstr "" + +#: src/elflint.c:1945 +#, c-format +msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n" +msgstr "" + +#: src/elflint.c:1986 +#, c-format +msgid "section [%2d] '%s': hash chain reference %<PRIu64> out of bounds\n" +msgstr "" + +#: src/elflint.c:2001 +#, c-format +msgid "section [%2d] '%s': bitmask size not power of 2: %u\n" +msgstr "" + +#: src/elflint.c:2012 +#, c-format +msgid "" +"section [%2d] '%s': hash table section is too small (is %ld, expected at " +"least%ld)\n" +msgstr "" + +#: src/elflint.c:2020 +#, c-format +msgid "section [%2d] '%s': 2nd hash function shift too big: %u\n" +msgstr "" + +#: src/elflint.c:2052 +#, c-format +msgid "" +"section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n" +msgstr "" + +#: src/elflint.c:2073 +#, c-format +msgid "" +"section [%2d] '%s': symbol %u referenced in chain for bucket %zu is " +"undefined\n" +msgstr "" + +#: src/elflint.c:2084 +#, c-format +msgid "" +"section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n" +msgstr "" + +#: src/elflint.c:2115 +#, c-format +msgid "section [%2d] '%s': hash chain for bucket %zu out of bounds\n" +msgstr "" + +#: src/elflint.c:2120 +#, c-format +msgid "" +"section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n" +msgstr "" + +#: src/elflint.c:2126 +#, c-format +msgid "section [%2d] '%s': bitmask does not match names in the hash table\n" +msgstr "" + +#: src/elflint.c:2139 +#, c-format +msgid "section [%2d] '%s': relocatable files cannot have hash tables\n" +msgstr "" + +#: src/elflint.c:2157 #, c-format msgid "section [%2d] '%s': hash table not for dynamic symbol table\n" msgstr "" -#: src/elflint.c:1601 +#: src/elflint.c:2165 +#, c-format +msgid "section [%2d] '%s': hash table entry size incorrect\n" +msgstr "" + +#: src/elflint.c:2170 #, c-format msgid "section [%2d] '%s': not marked to be allocated\n" msgstr "" -#: src/elflint.c:1606 +#: src/elflint.c:2175 #, c-format msgid "" -"section [%2d] '%s': hash table has not even room for nbucket and nchain\n" +"section [%2d] '%s': hash table has not even room for initial administrative " +"entries\n" msgstr "" -#: src/elflint.c:1616 +#: src/elflint.c:2223 #, c-format -msgid "" -"section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n" +msgid "sh_link in hash sections [%2zu] '%s' and [%2zu] '%s' not identical\n" msgstr "" -#: src/elflint.c:1627 +#: src/elflint.c:2301 src/elflint.c:2305 #, c-format -msgid "section [%2d] '%s': chain array not large enough\n" +msgid "section [%2zu] '%s': reference to symbol index 0\n" msgstr "" -#: src/elflint.c:1632 +#: src/elflint.c:2312 #, c-format -msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n" +msgid "" +"symbol %d referenced in new hash table in [%2zu] '%s' but not in old hash " +"table in [%2zu] '%s'\n" msgstr "" -#: src/elflint.c:1638 +#: src/elflint.c:2324 #, c-format -msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n" +msgid "" +"symbol %d referenced in old hash table in [%2zu] '%s' but not in new hash " +"table in [%2zu] '%s'\n" msgstr "" -#: src/elflint.c:1650 +#: src/elflint.c:2340 #, c-format msgid "section [%2d] '%s': nonzero sh_%s for NULL section\n" msgstr "" -#: src/elflint.c:1670 +#: src/elflint.c:2360 #, c-format msgid "" "section [%2d] '%s': section groups only allowed in relocatable object files\n" msgstr "" -#: src/elflint.c:1681 +#: src/elflint.c:2371 #, c-format msgid "section [%2d] '%s': cannot get symbol table: %s\n" msgstr "" -#: src/elflint.c:1686 +#: src/elflint.c:2376 #, c-format msgid "section [%2d] '%s': section reference in sh_link is no symbol table\n" msgstr "" -#: src/elflint.c:1692 +#: src/elflint.c:2382 #, c-format msgid "section [%2d] '%s': invalid symbol index in sh_info\n" msgstr "" -#: src/elflint.c:1697 +#: src/elflint.c:2387 #, c-format msgid "section [%2d] '%s': sh_flags not zero\n" msgstr "" -#: src/elflint.c:1702 +#: src/elflint.c:2394 +#, c-format +msgid "section [%2d] '%s': cannot get symbol for signature\n" +msgstr "" + +#: src/elflint.c:2399 +#, c-format +msgid "section [%2d] '%s': signature symbol canot be empty string\n" +msgstr "" + +#: src/elflint.c:2405 #, c-format msgid "section [%2d] '%s': sh_flags not set correctly\n" msgstr "" -#: src/elflint.c:1708 +#: src/elflint.c:2411 #, c-format msgid "section [%2d] '%s': cannot get data: %s\n" msgstr "" -#: src/elflint.c:1717 +#: src/elflint.c:2420 #, c-format msgid "section [%2d] '%s': section size not multiple of sizeof(Elf32_Word)\n" msgstr "" -#: src/elflint.c:1722 +#: src/elflint.c:2425 #, c-format msgid "section [%2d] '%s': section group without flags word\n" msgstr "" -#: src/elflint.c:1728 +#: src/elflint.c:2431 #, c-format msgid "section [%2d] '%s': section group without member\n" msgstr "" -#: src/elflint.c:1732 +#: src/elflint.c:2435 #, c-format msgid "section [%2d] '%s': section group with only one member\n" msgstr "" -#: src/elflint.c:1743 +#: src/elflint.c:2446 #, c-format msgid "section [%2d] '%s': unknown section group flags\n" msgstr "" -#: src/elflint.c:1755 +#: src/elflint.c:2458 #, c-format msgid "section [%2d] '%s': section index %Zu out of range\n" msgstr "" -#: src/elflint.c:1766 +#: src/elflint.c:2467 #, c-format msgid "section [%2d] '%s': cannot get section header for element %zu: %s\n" msgstr "" -#: src/elflint.c:1773 +#: src/elflint.c:2474 #, c-format msgid "section [%2d] '%s': section group contains another group [%2d] '%s'\n" msgstr "" -#: src/elflint.c:1779 +#: src/elflint.c:2480 #, c-format msgid "" "section [%2d] '%s': element %Zu references section [%2d] '%s' without " "SHF_GROUP flag set\n" msgstr "" -#: src/elflint.c:1786 +#: src/elflint.c:2487 #, c-format msgid "section [%2d] '%s' is contained in more than one section group\n" msgstr "" -#: src/elflint.c:1911 +#: src/elflint.c:2676 #, c-format msgid "" "section [%2d] '%s' refers in sh_link to section [%2d] '%s' which is no " "dynamic symbol table\n" msgstr "" -#: src/elflint.c:1920 +#: src/elflint.c:2687 #, c-format msgid "" "section [%2d] '%s' has different number of entries than symbol table [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:1952 +#: src/elflint.c:2703 +#, c-format +msgid "section [%2d] '%s': symbol %d: cannot read version data\n" +msgstr "" + +#: src/elflint.c:2719 +#, c-format +msgid "section [%2d] '%s': symbol %d: local symbol with global scope\n" +msgstr "" + +#: src/elflint.c:2727 +#, c-format +msgid "section [%2d] '%s': symbol %d: local symbol with version\n" +msgstr "" + +#: src/elflint.c:2741 +#, c-format +msgid "section [%2d] '%s': symbol %d: invalid version index %d\n" +msgstr "" + +#: src/elflint.c:2746 +#, c-format +msgid "" +"section [%2d] '%s': symbol %d: version index %d is for defined version\n" +msgstr "" + +#: src/elflint.c:2756 +#, c-format +msgid "" +"section [%2d] '%s': symbol %d: version index %d is for requested version\n" +msgstr "" + +#: src/elflint.c:2808 +#, c-format +msgid "more than one version reference section present\n" +msgstr "" + +#: src/elflint.c:2816 src/elflint.c:2945 +#, c-format +msgid "section [%2d] '%s': sh_link does not link to string table\n" +msgstr "" + +#: src/elflint.c:2839 src/elflint.c:2997 +#, c-format +msgid "section [%2d] '%s': entry %d has wrong version %d\n" +msgstr "" + +#: src/elflint.c:2845 src/elflint.c:3003 +#, c-format +msgid "section [%2d] '%s': entry %d has wrong offset of auxiliary data\n" +msgstr "" + +#: src/elflint.c:2853 +#, c-format +msgid "section [%2d] '%s': entry %d has invalid file reference\n" +msgstr "" + +#: src/elflint.c:2861 +#, c-format +msgid "section [%2d] '%s': entry %d references unknown dependency\n" +msgstr "" + +#: src/elflint.c:2873 +#, c-format +msgid "section [%2d] '%s': auxiliary entry %d of entry %d has unknown flag\n" +msgstr "" + +#: src/elflint.c:2880 +#, c-format +msgid "" +"section [%2d] '%s': auxiliary entry %d of entry %d has invalid name " +"reference\n" +msgstr "" + +#: src/elflint.c:2887 +#, c-format +msgid "" +"section [%2d] '%s': auxiliary entry %d of entry %d has wrong hash value: %" +"#x, expected %#x\n" +msgstr "" + +#: src/elflint.c:2897 +#, c-format +msgid "" +"section [%2d] '%s': auxiliary entry %d of entry %d has duplicate version " +"name '%s'\n" +msgstr "" + +#: src/elflint.c:2908 +#, c-format +msgid "" +"section [%2d] '%s': auxiliary entry %d of entry %d has wrong next field\n" +msgstr "" + +#: src/elflint.c:2924 src/elflint.c:3082 +#, c-format +msgid "section [%2d] '%s': entry %d has invalid offset to next entry\n" +msgstr "" + +#: src/elflint.c:2937 +#, c-format +msgid "more than one version definition section present\n" +msgstr "" + +#: src/elflint.c:2982 +#, c-format +msgid "section [%2d] '%s': more than one BASE definition\n" +msgstr "" + +#: src/elflint.c:2986 +#, c-format +msgid "section [%2d] '%s': BASE definition must have index VER_NDX_GLOBAL\n" +msgstr "" + +#: src/elflint.c:2992 +#, c-format +msgid "section [%2d] '%s': entry %d has unknown flag\n" +msgstr "" + +#: src/elflint.c:3016 +#, c-format +msgid "section [%2d] '%s': entry %d has invalid name reference\n" +msgstr "" + +#: src/elflint.c:3023 +#, c-format +msgid "section [%2d] '%s': entry %d has wrong hash value: %#x, expected %#x\n" +msgstr "" + +#: src/elflint.c:3032 +#, c-format +msgid "section [%2d] '%s': entry %d has duplicate version name '%s'\n" +msgstr "" + +#: src/elflint.c:3051 +#, c-format +msgid "" +"section [%2d] '%s': entry %d has invalid name reference in auxiliary data\n" +msgstr "" + +#: src/elflint.c:3066 +#, c-format +msgid "section [%2d] '%s': entry %d has wrong next field in auxiliary data\n" +msgstr "" + +#: src/elflint.c:3088 +#, c-format +msgid "section [%2d] '%s': no BASE definition\n" +msgstr "" + +#: src/elflint.c:3104 +#, c-format +msgid "section [%2d] '%s': unknown parent version '%s'\n" +msgstr "" + +#: src/elflint.c:3117 +#, c-format +msgid "section [%2d] '%s': empty object attributes section\n" +msgstr "" + +#: src/elflint.c:3138 +#, c-format +msgid "section [%2d] '%s': unrecognized attribute format\n" +msgstr "" + +#: src/elflint.c:3154 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: zero length field in attribute section\n" +msgstr "" + +#: src/elflint.c:3163 +#, c-format +msgid "section [%2d] '%s': offset %zu: invalid length in attribute section\n" +msgstr "" + +#: src/elflint.c:3175 +#, c-format +msgid "section [%2d] '%s': offset %zu: unterminated vendor name string\n" +msgstr "" + +#: src/elflint.c:3192 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: endless ULEB128 in attribute subsection tag\n" +msgstr "" + +#: src/elflint.c:3201 +#, c-format +msgid "section [%2d] '%s': offset %zu: truncated attribute section\n" +msgstr "" + +#: src/elflint.c:3210 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: zero length field in attribute subsection\n" +msgstr "" + +#: src/elflint.c:3223 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: invalid length in attribute subsection\n" +msgstr "" + +#: src/elflint.c:3234 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: attribute subsection has unexpected tag %u\n" +msgstr "" + +#: src/elflint.c:3252 +#, c-format +msgid "section [%2d] '%s': offset %zu: endless ULEB128 in attribute tag\n" +msgstr "" + +#: src/elflint.c:3263 +#, c-format +msgid "section [%2d] '%s': offset %zu: unterminated string in attribute\n" +msgstr "" + +#: src/elflint.c:3276 +#, c-format +msgid "section [%2d] '%s': offset %zu: unrecognized attribute tag %u\n" +msgstr "" + +#: src/elflint.c:3280 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: unrecognized %s attribute value %<PRIu64>\n" +msgstr "" + +#: src/elflint.c:3290 +#, c-format +msgid "section [%2d] '%s': offset %zu: vendor '%s' unknown\n" +msgstr "" + +#: src/elflint.c:3296 +#, c-format +msgid "" +"section [%2d] '%s': offset %zu: extra bytes after last attribute section\n" +msgstr "" + +#: src/elflint.c:3378 +#, c-format msgid "cannot get section header of zeroth section\n" msgstr "" -#: src/elflint.c:1956 +#: src/elflint.c:3382 +#, c-format msgid "zeroth section has nonzero name\n" msgstr "" -#: src/elflint.c:1958 +#: src/elflint.c:3384 +#, c-format msgid "zeroth section has nonzero type\n" msgstr "" -#: src/elflint.c:1960 +#: src/elflint.c:3386 +#, c-format msgid "zeroth section has nonzero flags\n" msgstr "" -#: src/elflint.c:1962 +#: src/elflint.c:3388 +#, c-format msgid "zeroth section has nonzero address\n" msgstr "" -#: src/elflint.c:1964 +#: src/elflint.c:3390 +#, c-format msgid "zeroth section has nonzero offset\n" msgstr "" -#: src/elflint.c:1966 +#: src/elflint.c:3392 +#, c-format msgid "zeroth section has nonzero info field\n" msgstr "" -#: src/elflint.c:1968 +#: src/elflint.c:3394 +#, c-format msgid "zeroth section has nonzero align value\n" msgstr "" -#: src/elflint.c:1970 +#: src/elflint.c:3396 +#, c-format msgid "zeroth section has nonzero entry size value\n" msgstr "" -#: src/elflint.c:1973 +#: src/elflint.c:3399 +#, c-format msgid "" "zeroth section has nonzero size value while ELF header has nonzero shnum " "value\n" msgstr "" -#: src/elflint.c:1977 +#: src/elflint.c:3403 +#, c-format msgid "" "zeroth section has nonzero link value while ELF header does not signal " "overflow in shstrndx\n" msgstr "" -#: src/elflint.c:1989 +#: src/elflint.c:3420 #, c-format msgid "cannot get section header for section [%2zu] '%s': %s\n" msgstr "" -#: src/elflint.c:1998 +#: src/elflint.c:3429 #, c-format msgid "section [%2zu]: invalid name\n" msgstr "" -#: src/elflint.c:2013 +#: src/elflint.c:3456 #, c-format msgid "section [%2d] '%s' has wrong type: expected %s, is %s\n" msgstr "" -#: src/elflint.c:2027 +#: src/elflint.c:3472 #, c-format msgid "section [%2zu] '%s' has wrong flags: expected %s, is %s\n" msgstr "" -#: src/elflint.c:2044 +#: src/elflint.c:3489 #, c-format msgid "" "section [%2zu] '%s' has wrong flags: expected %s and possibly %s, is %s\n" msgstr "" -#: src/elflint.c:2062 +#: src/elflint.c:3507 #, c-format msgid "section [%2zu] '%s' present in object file\n" msgstr "" -#: src/elflint.c:2068 src/elflint.c:2100 +#: src/elflint.c:3513 src/elflint.c:3545 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag set but there is no loadable segment\n" msgstr "" -#: src/elflint.c:2073 src/elflint.c:2105 +#: src/elflint.c:3518 src/elflint.c:3550 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable " "segments\n" msgstr "" -#: src/elflint.c:2081 +#: src/elflint.c:3526 #, c-format msgid "" "section [%2zu] '%s' is extension section index table in non-object file\n" msgstr "" -#: src/elflint.c:2116 +#: src/elflint.c:3561 #, c-format msgid "section [%2zu] '%s': size not multiple of entry size\n" msgstr "" -#: src/elflint.c:2121 +#: src/elflint.c:3566 +#, c-format msgid "cannot get section header\n" msgstr "" -#: src/elflint.c:2129 +#: src/elflint.c:3576 #, c-format -msgid "unsupported section type %d\n" +msgid "section [%2zu] '%s' has unsupported type %d\n" +msgstr "" + +#: src/elflint.c:3590 +#, c-format +msgid "" +"section [%2zu] '%s' contains invalid processor-specific flag(s) %#<PRIx64>\n" msgstr "" -#: src/elflint.c:2135 +#: src/elflint.c:3597 #, c-format -msgid "section [%2zu] '%s' contain unknown flag(s) %d\n" +msgid "section [%2zu] '%s' contains unknown flag(s) %#<PRIx64>\n" msgstr "" -#: src/elflint.c:2142 +#: src/elflint.c:3605 #, c-format msgid "section [%2zu] '%s': thread-local data sections address not zero\n" msgstr "" -#: src/elflint.c:2150 +#: src/elflint.c:3613 #, c-format msgid "section [%2zu] '%s': invalid section reference in link value\n" msgstr "" -#: src/elflint.c:2155 +#: src/elflint.c:3618 #, c-format msgid "section [%2zu] '%s': invalid section reference in info value\n" msgstr "" -#: src/elflint.c:2162 +#: src/elflint.c:3625 #, c-format msgid "section [%2zu] '%s': strings flag set without merge flag\n" msgstr "" -#: src/elflint.c:2167 +#: src/elflint.c:3630 #, c-format msgid "section [%2zu] '%s': merge flag set but entry size is zero\n" msgstr "" -#: src/elflint.c:2194 +#: src/elflint.c:3648 +#, c-format +msgid "section [%2zu] '%s' has unexpected type %d for an executable section\n" +msgstr "" + +#: src/elflint.c:3657 +#, c-format +msgid "section [%2zu] '%s' is both executable and writable\n" +msgstr "" + +#: src/elflint.c:3684 #, c-format msgid "" "section [%2zu] '%s' not fully contained in segment of program header entry %" "d\n" msgstr "" -#: src/elflint.c:2201 +#: src/elflint.c:3692 #, c-format msgid "" "section [%2zu] '%s' has type NOBITS but is read from the file in segment of " "program header entry %d\n" msgstr "" -#: src/elflint.c:2208 +#: src/elflint.c:3701 #, c-format msgid "" "section [%2zu] '%s' has not type NOBITS but is not read from the file in " "segment of program header entry %d\n" msgstr "" -#: src/elflint.c:2217 +#: src/elflint.c:3712 +#, c-format +msgid "section [%2zu] '%s' is executable in nonexecutable segment %d\n" +msgstr "" + +#: src/elflint.c:3722 +#, c-format +msgid "section [%2zu] '%s' is writable in unwritable segment %d\n" +msgstr "" + +#: src/elflint.c:3732 #, c-format msgid "" "section [%2zu] '%s': alloc flag set but section not in any loaded segment\n" msgstr "" -#: src/elflint.c:2223 +#: src/elflint.c:3738 #, c-format msgid "" "section [%2zu] '%s': ELF header says this is the section header string table " "but type is not SHT_TYPE\n" msgstr "" -#: src/elflint.c:2273 +#: src/elflint.c:3746 +#, c-format +msgid "" +"section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n" +msgstr "" + +#: src/elflint.c:3797 +#, c-format +msgid "more than one version symbol table present\n" +msgstr "" + +#: src/elflint.c:3820 +#, c-format msgid "INTERP program header entry but no .interp section\n" msgstr "" -#: src/elflint.c:2284 +#: src/elflint.c:3831 +#, c-format +msgid "" +"loadable segment [%u] is executable but contains no executable sections\n" +msgstr "" + +#: src/elflint.c:3837 +#, c-format +msgid "loadable segment [%u] is writable but contains no writable sections\n" +msgstr "" + +#: src/elflint.c:3848 +#, c-format +msgid "" +"no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section " +"exist\n" +msgstr "" + +#: src/elflint.c:3861 +#, c-format +msgid "duplicate version index %d\n" +msgstr "" + +#: src/elflint.c:3875 +#, c-format +msgid ".gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n" +msgstr "" + +#: src/elflint.c:3924 +#, c-format +msgid "phdr[%d]: unknown core file note type %<PRIu32> at offset %<PRIu64>\n" +msgstr "" + +#: src/elflint.c:3928 +#, c-format +msgid "" +"section [%2d] '%s': unknown core file note type %<PRIu32> at offset %Zu\n" +msgstr "" + +#: src/elflint.c:3950 +#, c-format +msgid "phdr[%d]: unknown object file note type %<PRIu32> at offset %Zu\n" +msgstr "" + +#: src/elflint.c:3954 +#, c-format +msgid "" +"section [%2d] '%s': unknown object file note type %<PRIu32> at offset %Zu\n" +msgstr "" + +#: src/elflint.c:3970 #, c-format msgid "phdr[%d]: no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:2367 +#: src/elflint.c:3989 #, c-format -msgid "phdr[%d]: note entries probably in form of a 32-bit ELF file\n" +msgid "phdr[%d]: cannot get content of note section: %s\n" msgstr "" -#: src/elflint.c:2370 +#: src/elflint.c:3992 #, c-format -msgid "phdr[%d]: extra %zu bytes after last note\n" +msgid "phdr[%d]: extra %<PRIu64> bytes after last note\n" msgstr "" -#: src/elflint.c:2399 +#: src/elflint.c:4012 #, c-format -msgid "phdr[%d]: unknown core file note type %<PRIu64> at offset %<PRIu64>\n" +msgid "section [%2d] '%s': no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:2407 +#: src/elflint.c:4019 #, c-format -msgid "phdr[%d]: unknown object file note type %<PRIu64> at offset %<PRIu64>\n" +msgid "section [%2d] '%s': cannot get content of note section\n" msgstr "" -#: src/elflint.c:2429 +#: src/elflint.c:4022 +#, c-format +msgid "section [%2d] '%s': extra %<PRIu64> bytes after last note\n" +msgstr "" + +#: src/elflint.c:4035 +#, c-format msgid "" "only executables, shared objects, and core files can have program headers\n" msgstr "" -#: src/elflint.c:2444 +#: src/elflint.c:4050 #, c-format msgid "cannot get program header entry %d: %s\n" msgstr "" -#: src/elflint.c:2451 +#: src/elflint.c:4059 #, c-format -msgid "program header entry %d: unknown program header entry type\n" +msgid "program header entry %d: unknown program header entry type %#<PRIx64>\n" msgstr "" -#: src/elflint.c:2462 +#: src/elflint.c:4070 +#, c-format msgid "more than one INTERP entry in program header\n" msgstr "" -#: src/elflint.c:2470 +#: src/elflint.c:4078 +#, c-format msgid "more than one TLS entry in program header\n" msgstr "" -#: src/elflint.c:2476 +#: src/elflint.c:4085 +#, c-format msgid "static executable cannot have dynamic sections\n" msgstr "" -#: src/elflint.c:2480 +#: src/elflint.c:4099 +#, c-format +msgid "dynamic section reference in program header has wrong offset\n" +msgstr "" + +#: src/elflint.c:4102 +#, c-format +msgid "dynamic section size mismatch in program and section header\n" +msgstr "" + +#: src/elflint.c:4112 +#, c-format msgid "more than one GNU_RELRO entry in program header\n" msgstr "" -#: src/elflint.c:2501 +#: src/elflint.c:4133 +#, c-format msgid "loadable segment GNU_RELRO applies to is not writable\n" msgstr "" -#: src/elflint.c:2504 -msgid "loadable segment GNU_RELRO applies to is executable\n" +#: src/elflint.c:4136 +#, c-format +msgid "loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n" +msgstr "" + +#: src/elflint.c:4144 src/elflint.c:4167 +#, c-format +msgid "%s segment not contained in a loaded segment\n" msgstr "" -#: src/elflint.c:2511 -msgid "GNU_RELRO segment not contained in a loaded segment\n" +#: src/elflint.c:4173 +#, c-format +msgid "program header offset in ELF header and PHDR entry do not match" msgstr "" -#: src/elflint.c:2517 +#: src/elflint.c:4179 #, c-format msgid "program header entry %d: file size greater than memory size\n" msgstr "" -#: src/elflint.c:2524 +#: src/elflint.c:4186 #, c-format msgid "program header entry %d: alignment not a power of 2\n" msgstr "" -#: src/elflint.c:2527 +#: src/elflint.c:4189 #, c-format msgid "" "program header entry %d: file offset and virtual address not module of " "alignment\n" msgstr "" -#: src/elflint.c:2557 +#: src/elflint.c:4225 #, c-format msgid "cannot read ELF header: %s\n" msgstr "" -#: libasm/asm_end.c:215 +#: src/elflint.c:4246 #, c-format -msgid "cannot create extended section index table: %s" +msgid "text relocation flag set but not needed\n" +msgstr "" + +#: src/addr2line.c:64 +msgid "Output selection options:" +msgstr "" + +#: src/addr2line.c:65 +msgid "Show only base names of source files" +msgstr "" + +#: src/addr2line.c:67 +msgid "Show absolute file names using compilation directory" +msgstr "" + +#: src/addr2line.c:68 +msgid "Also show function names" msgstr "" -#: libasm/asm_end.c:316 +#: src/addr2line.c:69 +msgid "Also show symbol or section names" +msgstr "" + +#: src/addr2line.c:80 +msgid "" +"Locate source files and line information for ADDRs (in a.out by default)." +msgstr "" + +#: src/addr2line.c:84 +msgid "[ADDR...]" +msgstr "" + +#: src/addr2line.c:385 #, c-format -msgid "cannot create section group for output file: %s" +msgid "Section syntax requires exactly one module" msgstr "" -#: libasm/asm_error.c:108 libdw/dwarf_error.c:74 -msgid "no error" +#: src/addr2line.c:408 +#, c-format +msgid "offset %#<PRIxMAX> lies outside section '%s'" msgstr "" -#: libasm/asm_error.c:109 libdw/dwarf_error.c:83 -msgid "out of memory" +#: src/addr2line.c:426 +#, c-format +msgid "cannot find symbol '%s'" msgstr "" -#: libasm/asm_error.c:111 -msgid "invalid parameter" +#: src/addr2line.c:431 +#, c-format +msgid "offset %#<PRIxMAX> lies outside contents of '%s'" msgstr "" -#: libasm/asm_error.c:112 -msgid "cannot change mode of output file" +#: src/findtextrel.c:68 +msgid "Input Selection:" msgstr "" -#: libasm/asm_error.c:114 -msgid "duplicate symbol" +#: src/findtextrel.c:69 +msgid "Prepend PATH to all file names" msgstr "" -#: libasm/asm_error.c:115 -msgid "invalid section type for operation" +#: src/findtextrel.c:71 +msgid "Use PATH as root of debuginfo hierarchy" msgstr "" -#: libasm/asm_error.c:149 -msgid "Unknown error" +#: src/findtextrel.c:78 +msgid "Locate source of text relocations in FILEs (a.out by default)." msgstr "" -#: libdw/dwarf_error.c:75 -msgid "unknown error" +#: src/findtextrel.c:234 src/elfcmp.c:577 src/ranlib.c:186 +#, c-format +msgid "cannot create ELF descriptor for '%s': %s" msgstr "" -#: libdw/dwarf_error.c:76 -msgid "invalid access" +#: src/findtextrel.c:244 +#, c-format +msgid "cannot get ELF header '%s': %s" msgstr "" -#: libdw/dwarf_error.c:77 -msgid "no regular file" +#: src/findtextrel.c:255 +#, c-format +msgid "'%s' is not a DSO or PIE" msgstr "" -#: libdw/dwarf_error.c:78 -msgid "I/O error" +#: src/findtextrel.c:272 +#, c-format +msgid "getting get section header of section %zu: %s" msgstr "" -#: libdw/dwarf_error.c:79 -msgid "invalid ELF file" +#: src/findtextrel.c:290 +#, c-format +msgid "cannot read dynamic section: %s" msgstr "" -#: libdw/dwarf_error.c:80 -msgid "no DWARF information" +#: src/findtextrel.c:305 +#, c-format +msgid "no text relocations reported in '%s'" msgstr "" -#: libdw/dwarf_error.c:81 -msgid "no ELF file" +#: src/findtextrel.c:317 +#, c-format +msgid "while reading ELF file" msgstr "" -#: libdw/dwarf_error.c:82 -msgid "cannot get ELF header" +#: src/findtextrel.c:326 src/findtextrel.c:343 +#, c-format +msgid "cannot get program header index at offset %d: %s" msgstr "" -#: libdw/dwarf_error.c:84 -msgid "not implemented" +#: src/findtextrel.c:395 +#, c-format +msgid "cannot get section header of section %Zu: %s" msgstr "" -#: libdw/dwarf_error.c:85 -msgid "invalid command" +#: src/findtextrel.c:407 +#, c-format +msgid "cannot get symbol table section %zu in '%s': %s" msgstr "" -#: libdw/dwarf_error.c:86 -msgid "invalid version" +#: src/findtextrel.c:427 src/findtextrel.c:450 +#, c-format +msgid "cannot get relocation at index %d in section %zu in '%s': %s" msgstr "" -#: libdw/dwarf_error.c:87 -msgid "invalid file" +#: src/findtextrel.c:515 +#, c-format +msgid "%s not compiled with -fpic/-fPIC\n" msgstr "" -#: libdw/dwarf_error.c:88 -msgid "no entries found" +#: src/findtextrel.c:568 +#, c-format +msgid "" +"the file containing the function '%s' is not compiled with -fpic/-fPIC\n" msgstr "" -#: libdw/dwarf_error.c:89 -msgid "invalid DWARF" +#: src/findtextrel.c:575 src/findtextrel.c:595 +#, c-format +msgid "" +"the file containing the function '%s' might not be compiled with -fpic/-" +"fPIC\n" msgstr "" -#: libdw/dwarf_error.c:90 -msgid "no string data" +#: src/findtextrel.c:583 +#, c-format +msgid "" +"either the file containing the function '%s' or the file containing the " +"function '%s' is not compiled with -fpic/-fPIC\n" msgstr "" -#: libdw/dwarf_error.c:91 -msgid "no address value" +#: src/findtextrel.c:603 +#, c-format +msgid "" +"a relocation modifies memory at offset %llu in a write-protected segment\n" msgstr "" -#: libdw/dwarf_error.c:92 -msgid "no constant value" +#: src/elfcmp.c:68 +msgid "Control options:" msgstr "" -#: libdw/dwarf_error.c:93 -msgid "no reference value" +#: src/elfcmp.c:69 +msgid "" +"Control treatment of gaps in loadable segments [ignore|match] (default: " +"ignore)" msgstr "" -#: libdw/dwarf_error.c:94 -msgid "invalid reference value" +#: src/elfcmp.c:71 +msgid "Ignore permutation of buckets in SHT_HASH section" msgstr "" -#: libdw/dwarf_error.c:95 -msgid ".debug_line section missing" +#: src/elfcmp.c:72 +msgid "Output nothing; yield exit status only" msgstr "" -#: libdw/dwarf_error.c:96 -msgid "invalid .debug_line section" +#: src/elfcmp.c:79 +msgid "Compare relevant parts of two ELF files for equality." msgstr "" -#: libdw/dwarf_error.c:97 -msgid "debug information too big" +#: src/elfcmp.c:83 +msgid "FILE1 FILE2" msgstr "" -#: libdw/dwarf_error.c:98 -msgid "invalid DWARF version" +#: src/elfcmp.c:139 +msgid "Invalid number of parameters.\n" msgstr "" -#: libdw/dwarf_error.c:99 -msgid "invalid directory index" +#: src/elfcmp.c:167 src/elfcmp.c:172 +#, c-format +msgid "cannot get ELF header of '%s': %s" msgstr "" -#: libdw/dwarf_error.c:100 -msgid "address out of range" +#: src/elfcmp.c:189 +#, c-format +msgid "%s %s diff: ELF header" msgstr "" -#: libdw/dwarf_error.c:101 -msgid "no location list value" +#: src/elfcmp.c:247 +#, c-format +msgid "%s %s differ: section header" msgstr "" -#: libdw/dwarf_error.c:102 -msgid "no block data" +#: src/elfcmp.c:275 src/elfcmp.c:281 +#, c-format +msgid "cannot get content of section %zu in '%s': %s" msgstr "" -#: libdw/dwarf_error.c:103 -msgid "invalid line index" +#: src/elfcmp.c:297 src/elfcmp.c:303 +#, c-format +msgid "cannot get symbol in '%s': %s" msgstr "" -#: libdw/dwarf_error.c:104 -msgid "invalid address range index" +#: src/elfcmp.c:324 +#, c-format +msgid "%s %s differ: symbol table [%zu]" msgstr "" -#: libdw/dwarf_error.c:105 -msgid "no matching address range" +#: src/elfcmp.c:327 +#, c-format +msgid "%s %s differ: symbol table [%zu,%zu]" msgstr "" -#: libdw/dwarf_error.c:106 -msgid "no flag value" +#: src/elfcmp.c:375 +#, c-format +msgid "%s %s differ: section [%zu] '%s' content" +msgstr "" + +#: src/elfcmp.c:379 +#, c-format +msgid "%s %s differ: section [%zu,%zu] '%s' content" +msgstr "" + +#: src/elfcmp.c:395 +#, c-format +msgid "%s %s differ: unequal amount of important sections" +msgstr "" + +#: src/elfcmp.c:429 src/elfcmp.c:434 +#, c-format +msgid "cannot load data of '%s': %s" +msgstr "" + +#: src/elfcmp.c:453 src/elfcmp.c:459 +#, c-format +msgid "cannot get program header entry %d of '%s': %s" +msgstr "" + +#: src/elfcmp.c:465 +#, c-format +msgid "%s %s differ: program header %d" +msgstr "" + +#: src/elfcmp.c:490 +#, c-format +msgid "%s %s differ: gap" +msgstr "" + +#: src/elfcmp.c:549 +#, c-format +msgid "Invalid value '%s' for --gaps parameter." +msgstr "" + +#: src/elfcmp.c:582 +#, c-format +msgid "cannot create EBL descriptor for '%s'" +msgstr "" + +#: src/elfcmp.c:600 +#, c-format +msgid "cannot get section header of section %zu: %s" +msgstr "" + +#: src/elfcmp.c:610 +#, c-format +msgid "cannot get content of section %zu: %s" +msgstr "" + +#: src/elfcmp.c:620 src/elfcmp.c:634 +#, c-format +msgid "cannot get relocation: %s" +msgstr "" + +#: src/ranlib.c:74 +msgid "Generate an index to speed access to archives." +msgstr "" + +#: src/ranlib.c:77 +msgid "ARCHIVE" +msgstr "" + +#: src/ranlib.c:116 +#, c-format +msgid "Archive name required" +msgstr "" + +#: src/ranlib.c:176 +#, c-format +msgid "cannot stat '%s'" +msgstr "" + +#: src/ranlib.c:194 +#, c-format +msgid "'%s' is no archive" +msgstr "" + +#: src/ranlib.c:229 +#, c-format +msgid "error while freeing sub-ELF descriptor: %s" +msgstr "" + +#: src/ranlib.c:250 +#, c-format +msgid "cannot create new file" +msgstr "" + +#: src/strings.c:70 +msgid "Output Selection:" +msgstr "" + +#: src/strings.c:71 +msgid "Scan entire file, not only loaded sections" +msgstr "" + +#: src/strings.c:73 +msgid "Only NUL-terminated sequences of MIN-LEN characters or more are printed" +msgstr "" + +#: src/strings.c:74 +msgid "" +"Select character size and endianess: s = 7-bit, S = 8-bit, {b,l} = 16-bit, " +"{B,L} = 32-bit" +msgstr "" + +#: src/strings.c:78 +msgid "Print name of the file before each string." +msgstr "" + +#: src/strings.c:80 +msgid "Print location of the string in base 8, 10, or 16 respectively." +msgstr "" + +#: src/strings.c:81 +msgid "Alias for --radix=o" +msgstr "" + +#: src/strings.c:88 +msgid "Print the strings of printable characters in files." +msgstr "" + +#: src/strings.c:268 src/strings.c:303 +#, c-format +msgid "invalid value '%s' for %s parameter" +msgstr "" + +#: src/strings.c:314 +#, c-format +msgid "invalid minimum length of matched string size" +msgstr "" + +#: src/strings.c:601 +#, c-format +msgid "lseek64 failed" +msgstr "" + +#: src/strings.c:616 +#, c-format +msgid "re-mmap failed" +msgstr "" + +#: src/strings.c:653 +#, c-format +msgid "mprotect failed" +msgstr "" + +#: src/strings.c:680 +#, c-format +msgid "re=mmap failed" msgstr "" diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 00000000..fedb6a06 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 00000000..a9647fc3 --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 00000000..2436c49e --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 00000000..9788f702 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/splint.rc b/splint.rc deleted file mode 100644 index e0461c41..00000000 --- a/splint.rc +++ /dev/null @@ -1 +0,0 @@ -+posixlib diff --git a/src/ChangeLog b/src/ChangeLog index e5b44049..b14d58bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,1374 @@ +2008-12-11 Roland McGrath <roland@redhat.com> + + * nm.c (sym_name): New function. + (show_symbols_sysv): Use it in place of elf_strptr. + (show_symbols_bsd, show_symbols_posix): Likewise. + Fixes RHBZ#476136. + + * nm.c (show_symbols_sysv): Use an alloca'd backup section name when + elf_strptr fails. + +2008-12-02 Roland McGrath <roland@redhat.com> + + * readelf.c (count_dwflmod, process_file): Don't presume encoding of + nonzero OFFSET argument to dwfl_getmodules. + +2008-08-07 Roland McGrath <roland@redhat.com> + + * addr2line.c (main): Pass string to handle_address. + (see_one_module): New function, subroutine of handle_address. + (find_symbol): Likewise. + (handle_address): Take string argument rather than address. + Convert plain number, or handle strings like "(section)+offset" + or "symbol+offset". + +2008-08-01 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_core_item): Handle 'B' type for 1-origin bitset. + For 'b' and 'B', print <x-y,z> or ~<x,y-z> rather than 1/0 string. + + * readelf.c (convert): Take new argument SIZE. + (handle_core_register, handle_core_item): Update callers. + (handle_core_item): Take new arg REPEATED_SIZE. + (handle_core_items): Special case for a singleton item, + let handle_core_item handle repeats if it wants to. + + * readelf.c (handle_core_items): Give abridged output + for identical groups repeated more than twice. + +2008-07-04 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_core_items): Handle ELF_T_ADDR. + +2008-04-10 Roland McGrath <roland@redhat.com> + + * strip.c (handle_elf): Don't keep sections that kept symbol tables + refer to. Instead, just be sure to preserve the original symbol + table in the debug file so those symbols go with their sections and + can be elided from the stripped version of the symbol table. + + * strip.c (handle_elf): When a discarded section kept in the debug + file refers to a nondiscard section via sh_link/sh_info, preserve + that nondiscarded section unmodified in the debug file as well. + Skip adjustment of discarded sections symbol table references when + that symbol table is copied in this way. + + * elflint.c (check_symtab): Don't crash from missing symbol names + after diagnosing bogus strtab. + + * strip.c (handle_elf): Cosmetic cleanup in special section contents + adjustment for symtab changes. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * elflint.c (check_sections): Add checks on SHF_EXECINSTR sections: + must be SHT_PROGBITS, must not be SHF_WRITE. Let backend hook + excuse a special section. + +2008-03-27 Roland McGrath <roland@redhat.com> + + * elflint.c (check_sections): Check that executability and writability + of sections is reflected in segment p_flags. + +2008-03-26 Roland McGrath <roland@redhat.com> + + * elflint.c (check_program_header): Accept PT_GNU_RELRO p_flags + that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really + is valid in RELRO. + +2008-02-29 Roland McGrath <roland@redhat.com> + + * readelf.c (print_attributes): Add a cast. + * elflint.c (check_attributes): Likewise. + + * unaligned.h (add_8ubyte_unaligned): Cast PTR argument for parity + with [UNALIGNED_ACCESS_CLASS == BYTE_ORDER] definition. + (add_4ubyte_unaligned, add_2ubyte_unaligned): Likewise. + +2008-02-03 Ulrich Drepper <drepper@redhat.com> + + * i386_ld.c (elf_i386_count_relocations): Implement R_386_TLS_GD + when linked into executable. + (elf_i386_create_relocations): Likewise. + +2008-02-20 Roland McGrath <roland@redhat.com> + + * readelf.c (print_attributes): New function. + (process_elf_file): Call it under -A. + + * elflint.c (check_attributes): Implement it for real. + +2008-02-19 Roland McGrath <roland@redhat.com> + + * elflint.c (special_sections): Handle .gnu.attributes section. + (check_sections): Likewise. + (check_attributes): New function. + +2008-02-10 Roland McGrath <roland@redhat.com> + + * elfcmp.c (main): Ignore sh_offset differences in non-SHF_ALLOC + sections and ET_REL files. + +2008-02-02 Ulrich Drepper <drepper@redhat.com> + + * elf32-i386.script: Add .eh_frame_hdr, .tdata, and .tbss sections. + * i386_ld.c (elf_i386_count_relocations): Handle R_386_TLS_LDO_32 + and R_386_TLS_LE. + (elf_i386_create_relocations): Likewise. + * ld.h (struct ld_state): Add need_tls, tls_start, and tls_tcb + elements. + * ldgeneric.c (add_section): If TLS section is used, set need_tls flag. + (ld_generic_create_outfile): Add PT_TLS entry to program header. + Fix generation of PT_GNU_STACK entry. + +2008-02-01 Ulrich Drepper <drepper@redhat.com> + + * ld.c (replace_args): Prevent loop over replacements if the parameter + is only two characters long. + + * ld.c: Recognize sha1 argument for --build-id parameter. + * ldgeneric.c (create_build_id_section): Handle sha1. + (compute_hash_sum): New function. Broken out of compute_build_id. + Take hash function and context as parameters. + (compute_build_id): Use compute_hash_sum for md5 and the new sha1 + implementation. + +2008-01-31 Ulrich Drepper <drepper@redhat.com> + + * elf32-i386.script: Add .note.ABI-tag and .note.gnu.build-id sections. + * ld.c: Recognize --build-id command line parameter. + * ld.h: Define scn_dot_note_gnu_build_id. + (struct ld_state): Add build_id and buildidscnidx elements. + * ldgeneric.c: Implement --build-id command line parameter. + * ldlex.l (ID): Recognize - as valid character after the first one. + +2008-01-29 Ulrich Drepper <drepper@redhat.com> + + * ld.c (replace_args): New function. + (main): Use it to rewrite old-style parameters. + + * elf32-i386.script: Add .gnu.hash section. + * ldgeneric.c (optimal_bucket_size): A tiny bit more efficient. + (fillin_special_symbol): Initialize st_size. + (sortfct_hashval): New function. + (create_gnu_hash): New function. + (create_hash): New function. + (ld_generic_create_outfile): Use the new functions to create the + hash tables. + + * elflint.c (check_gnu_hash): Fix index value printed in error message. + +2008-01-24 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_group): Check that signature symbol for section + group is not an empty string. + * ldgeneric.c: Remove magic assignment of indeces in the dynsym + section. Start implementation of --hash-style. + * i386_ld.c: Likewise. + * ld.c: Recognize --hash-style. + * ld.h (struct scninfo): Add comdat_group. + Add additional parameter to finalize_plt callback. + +2008-01-22 Ulrich Drepper <drepper@redhat.com> + + * ld.h (struct callbacks): Add initialize_gotplt. + (struct scnhead): Add scn_dot_gotplt. + (struct ld_state): Add gotpltscnidx. + * i386_ld.c (elf_i386_initialize_plt): Minor optimization. + (elf_i386_initialize_pltrel): Likewise. + (elf_i386_initialize_got): There is now a separate .got.plt, so + don't do the PLT-related work here. Initialize d_type. + (elf_i386_initialize_gotplt): New function. + (elf_i386_plt0): Use ud2a after indirect jump. + (elf_i386_pic_plt0_entry): Likewise. + (elf_i386_finalize_plt): Reference now .got.plt. + (elf_i386_count_relocations): For GOT entries which need no relocation + don't bump nrel_got. + (elf_i386_create_relocations): Also get .got.plt. Rewrite R-386_GOT32 + handling for split .got/.got.plt. + (elf_i386_ld_init): Initialize callbacks.initialize_gotplt. + * elf32-i386.script: Sort sections for security. There are no .got + input sections. Add .got.plt. + * ldgeneric.c (ld_generic_generate_sections): Add .got.plt section. + (ld_generic_create_outfile): Initialize .got.plt section. + Use .got.plt address for _GLOBAL_OFFSET_TABLE_ symbol and DT_PLTGOT. + +2008-01-19 Ulrich Drepper <drepper@redhat.com> + + * i386_ld.c (elf_i386_count_relocations): PLT relocations for undefined + symbols are not carried over into statically linked output files. + Add dummy entries for more TLS relocations. + + * ld.c (options): Add long names for -( and -). + + * ldgeneric.c (check_definition): For newly found definitions don't + mark section as used if symbol is absolute. + (extract_from_archive): Only assign archive sequence number the first + time the archive is handled. Update ld_state.last_archive_used + if any symbol was used. Remove nround variable. + (file_process2): When using symbol from an archive, update + ld_state.group_start_archive, ld_state.archives, and + ld_state.tailarchives. + (ld_generic_file_process): If group is not handled anymore, after + freeing ELF handles for the archives, clear ld_state.archives and + *nextp. Fix wrong logic in recognizing first iteration of group + loop. When clearing flags, also clear ld_state.group_start_archive. + +2008-01-11 Ulrich Drepper <drepper@redhat.com> + + * objdump.c (show_disasm): Adjust disassembler format string for + removal of %e. + +2008-01-04 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_core_items): Take new arg DESCSZ; if nonzero, + a size greater than the items cover means multiple sets of items. + (handle_core_note): Update caller. + +2008-01-04 Roland McGrath <roland@redhat.com> + + * strip.c (handle_elf): Move SHDRIDX defn to silence gcc warning. + +2008-01-03 Roland McGrath <roland@redhat.com> + + * ld.h (linked_from_dso_p): Use __attribute__ ((__gnu_inline__)). + + * elflint.c (check_dynamic): Remove duplicate initializer. + +2008-01-02 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: Update copyright year. + * ar.c: Likewise. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + +2007-12-30 Ulrich Drepper <drepper@redhat.com> + + * objdump (show_disasm): Use %e after third parameter. + +2007-12-21 Ulrich Drepper <drepper@redhat.com> + + * strip.c: Fix wrong parenthesis in a few branch predictions. + * strings.c: Likewise. + +2007-12-20 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (DEFS): Add DEBUGPRED. + * addr2line.c: Include debugpred.h. + * ar.c: Likewise. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + * debugpred.h: New file. + + * readelf.c (handle_relocs_rel): Use elf_scnshndx. + (handle_relocs_rela): Likewise. + + * readelf.c: Add lots of likely/unlikely. + + * elflint.c: Minor cleanups. + +2007-11-19 Roland McGrath <roland@redhat.com> + + * readelf.c (print_ops): Handle all bad op codes gracefully. + Print their numbers instead of just ???. + +2007-11-09 Roland McGrath <roland@redhat.com> + + * readelf.c (attr_callback): Handle DW_AT_data_location. + Handle block forms to mean a DWARF expression for DW_AT_allocated, + DW_AT_associated, DW_AT_bit_size, DW_AT_bit_offset, DW_AT_bit_stride, + DW_AT_byte_size, DW_AT_byte_stride, DW_AT_count, DW_AT_lower_bound, + DW_AT_upper_bound. + +2007-10-20 Roland McGrath <roland@redhat.com> + + * unstrip.c (options): Update -R description. + (struct symbol): Put symbol details a union with a size_t pointer + `duplicate'. + (compare_symbols_output): Use null ->name as marker for discard + symbols, not zero *->map. + (copy_elided_sections): Record forwarding pointers for discarded + duplicates and fill SYMNDX_MAP elements through them. + + * readelf.c (process_file): Set offline_next_address to 0 at start. + (struct process_dwflmod_args): New type. + (process_dwflmod): Take args in it, pass fd to process_elf_file. + (process_file): Update caller; dup FD for passing to libdwfl. + (process_elf_file): Take new arg FD. For ET_REL file when + displaying data affected by libdwfl relocation, open a new Elf handle. + +2007-10-17 Roland McGrath <roland@redhat.com> + + * readelf.c (print_debug_line_section): For invalid data inside a + unit with plausible length, keep printing at the next unit boundary. + + * readelf.c (attr_callback): Use dwarf_formref_die, not dwarf_formref. + +2007-10-16 Roland McGrath <roland@redhat.com> + + * readelf.c (hex_dump): Fix rounding error in whitespace calculation. + +2007-10-15 Roland McGrath <roland@redhat.com> + + * make-debug-archive.in: New file. + * Makefile.am (EXTRA_DIST): Add it. + (make-debug-archive): New target. + (bin_SCRIPTS, CLEANFILES): Add it. + +2007-10-10 Roland McGrath <roland@redhat.com> + + * elflint.c (special_sections): Add new attrflag value exact_or_gnuld. + Use it to check MERGE|STRINGS for .debug_str. + (check_sections): Handle exact_or_gnuld. + +2007-10-08 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_core_item): Handle 'T'|0x80 to indicate + 64-bit struct timeval with 32-bit tv_usec. + +2007-10-07 Roland McGrath <roland@redhat.com> + + * readelf.c (check_archive_index): New function. + (process_file): Call it. Change signature to take only fd and name. + Use libdwfl to open the file, then iterate on its modules (multiple + for an archive) to print file name and call process_elf_file. + (main): Update caller. Let process_file do elf_begin. + (count_dwflmod, process_dwflmod, find_no_debuginfo): New functions. + (process_elf_file): Take only Dwfl_Module * argument. + Don't print the file name here. + (print_debug_*_section): Take Dwfl_Module * argument. + (print_debug): Likewise. Update caller. + (format_dwarf_addr): New function. + (print_debug_ranges_section): Use it. + (attr_callback): Likewise. + (print_debug_line_section, print_debug_loc_section): Likewise. + + * readelf.c (print_debug_ranges_section): Translate all strings. + (print_debug_loc_section): Likewise. + + * unstrip.c (copy_elided_sections): Initialize SEC. + + * ar.c (do_oper_insert): Put trailing / on short names. + + * arlib.h (MAX_AR_NAME_LEN): Decrease by one. + + * arlib2.c (arlib_add_long_name): Adjust for header size. + + * arlib.c (arlib_finalize): Pad long name table to keep size even. + + * ar.c (do_oper_insert): Use write_retry for padding write. + + * ar.c (do_oper_insert): Initialize CUR_OFF in no_old case. + Unconditionally set FOUND[CNT]->elf when setting ->mem. + (remember_long_name): New function. + (do_oper_insert): Call it. Correctly use length of basename, + not original name. Don't store long name twice for new member. + +2007-10-06 Roland McGrath <roland@redhat.com> + + * elflint.c (check_note): Skip empty segment. + (check_note_section): Skip empty section. + + * unstrip.c (options, parse_opt, struct arg_info): Grok -R/--relocate. + (handle_output_dir_module, handle_implicit_modules): Pass it down. + (handle_dwfl_module): When set, use ET_REL already loaded by Dwfl. + (compare_alloc_sections): Take new arg REL, ignore address if true. + (compare_sections): Likewise, pass it down. + (compare_sections_rel, compare_sections_nonrel): New functions. + (find_alloc_sections_prelink, copy_elided_sections): Use them + instead of compare_sections. + (sections_match): New function, broken out of ... + (find_alloc_section): ... here. + (copy_elided_sections): Reorganize section match-up logic. + Use sections_match for SHF_ALLOC in ET_REL. + For ET_REL, let the nonzero sh_addr from the debug file dominate. + + * unstrip.c (add_new_section_symbols): Take new arg REL. + When true, do not update section symbol values. + (collect_symbols): Likewise. Update section symbols with address + of chosen output section, not original section. + (check_symtab_section_symbols, copy_elided_sections): Update callers. + + * unstrip.c (compare_alloc_sections): At the same address, preserve + original section order. + + * elflint.c (special_sections): Don't require MERGE|STRINGS for + .debug_str, it didn't always have them with older tools. + + * elflint.c (check_symtab, check_one_reloc): Ignore sh_addr in ET_REL. + +2007-10-05 Roland McGrath <roland@redhat.com> + + * elflint.c (check_symtab): Allow SHN_UNDEF _GLOBAL_OFFSET_TABLE_ in + ET_REL file. + + * elflint.c (check_symtab): For _GLOBAL_OFFSET_TABLE_, diagnose + SHN_UNDEF as "bad section". Use shndx value in messages. + + * elflint.c (special_sections): Add ".debug_str". Decrement namelen + for ".debug" so it matches as a prefix. + (IS_KNOWN_SPECIAL): New macro. + (check_sections): Use it for ".plt" match. Cite wrong SHT_NOBITS + type even under -d, for a .debug* or .shstrtab section. + + * readelf.c (print_ops): Use hex for address operand. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * unstrip.c (copy_elided_sections): Initialize NDX_SECTION element for + .gnu_debuglink section to SHN_UNDEF. Drop STT_SECTION symbols for + sections mapped to SHN_UNDEF. + +2007-10-04 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (dump_archive_index): Avoid warning about uninitialized + variable with older glibc versions. + Add some branch prediction. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * readelf.c (print_archive_index): New variable. + (options, parse_opt): Accept -c/--archive-index to set it. + (dump_archive_index): New function. + (process_file): Take new arg WILL_PRINT_ARCHIVE_INDEX. + Call dump_archive_index on archives if set. + (main): Update caller. + (any_control_option): Give it file scope, moved out of ... + (parse_opt): ... here. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * unstrip.c (struct arg_info): Add `list' flag. + (options, parse_opt): Grok -n/--list to set it. + (list_module): New function. + (handle_implicit_modules): Call it under -n. + + * elflint.c (check_note_section): New function. + (check_sections): Call it for SHT_NOTE. + + * readelf.c (handle_notes): Use sections when available. + + * elflint.c (check_note_data): New function, broken out of ... + (check_note): ... here. Call it and elf_getdata_rawchunk. + + * readelf.c (handle_auxv_note): Take offset as argument, not buffer. + Use elf_getdata_rawchunk and gelf_getauxv. + (handle_notes_data): New function, broken out of ... + (handle_notes): ... here. Call it and elf_getdata_rawchunk. + +2007-10-01 Roland McGrath <roland@redhat.com> + + * readelf.c (hex_dump): Fix transposed subtraction generating spaces. + + * readelf.c (hex_dump): Fix line header to be hex instead of decimal. + +2007-09-10 Roland McGrath <roland@redhat.com> + + * readelf.c (options): Give -p optional argument, alias --string-dump. + (string_sections, string_sections_tail): New static variables. + (parse_opt): Set them when -p has an argument. + (print_string_section): New function, broken out of ... + (print_strings): ... here. Call it. + (dump_data_section): New function, broken out of ... + (dump_data): ... here. Call it. + (for_each_section_argument): New function, broken out of ... + (dump_data): ... here. Call it. + (dump_strings): New function. + +2007-08-31 Roland McGrath <roland@redhat.com> + + * readelf.c (print_strings): Typo fix. + +2007-08-23 Roland McGrath <roland@redhat.com> + + * readelf.c (printf_with_wrap): Function removed. + (REGISTER_WRAP_COLUMN): New macro. + (handle_core_register): Use print_core_item instead. + (struct register_info): New type. + (compare_registers, compare_register_sets): New functions. + (register_bitpos, compare_sets_by_info): New functions. + (handle_core_registers): Use those to segregate and sort registers + for display. + + * readelf.c (ITEM_WRAP_COLUMN): New macro. + (print_core_item): New function. + (handle_core_item): Use it instead of printf_with_wrap. + (compare_core_items, compare_core_item_groups): New functions. + (handle_core_items): Use them. Sort by group and force line breaks + between groups. + + * readelf.c (handle_core_registers, handle_core_items): New functions, + broken out of ... + (handle_core_note): ... here. Call them. + +2007-08-22 Roland McGrath <roland@redhat.com> + + * unstrip.c (new_shstrtab): New function, broken out of ... + (copy_elided_sections): ... here. + +2007-08-20 Roland McGrath <roland@redhat.com> + + Avoid local function trampolines in nm binary. + * nm.c (sort_by_address): Move to a static function instead of local + inside show_symbols. + (sort_by_name_strtab): New static variable. + (sort_by_name): Use it. Move to a static function instead of local + inside show_symbols. + (show_symbols): Set sort_by_name_strtab. + +2007-08-19 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_auxv_note): New function. + (handle_notes): Call it. + + * readelf.c (printf_with_wrap, convert): New functions. + (handle_core_item, (handle_core_register): New functions. + (handle_notes): Call those with details from ebl_core_note. + +2007-08-12 Roland McGrath <roland@redhat.com> + + * elflint.c (check_note): Accept type 0 with name "Linux". + + * elflint.c (special_sections): Accept SHF_ALLOC for ".note". + + * elflint.c (section_flags_string): Return "none" for 0, not "". + +2007-08-11 Roland McGrath <roland@redhat.com> + + * elflint.c (check_note): Accept NT_GNU_HWCAP, NT_GNU_BUILD_ID. + +2007-08-04 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (hex_dump): Use isprint to determine whether to print + character itself or full stop character. + (dump_data): No need to check endp for NULL after strtol call. + +2007-08-03 Roland McGrath <roland@redhat.com> + + * readelf.c (print_string_sections): New variable. + (options, parse_opt): Handle --strings/-p to set it. + (print_strings): New function. + (process_elf_file): Call it under -p. + + * readelf.c (options): Add hidden aliases --segments, --sections, + as taken by binutils readelf. + +2007-08-01 Roland McGrath <roland@redhat.com> + + * readelf.c (dump_data_sections, dump_data_sections_tail): + New variables. + (options, parse_opt): Handle --hex-dump/-x, set them. + (hex_dump): New function. + (dump_data): New function, call it. + (process_elf_file): Call it. + +2007-07-25 Roland McGrath <roland@redhat.com> + + * addr2line.c (show_symbols): New variable. + (print_addrsym): New function. + (handle_address): Call it. + (options, parse_opt): Handle -S/--symbols. + +2007-06-05 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: Update for latest autoconf header. + * ar.c: Likewise. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * ldgeneric.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + +2007-05-18 Roland McGrath <roland@redhat.com> + + * unstrip.c (copy_elided_sections): Match up non-NOBITS sections with + stripped file, so as not to duplicate a section copied in both. + + * strip.c (handle_elf): Keep SHT_NOTE section copies in the debug file. + +2007-05-17 Roland McGrath <roland@redhat.com> + + * unstrip.c (copy_elided_sections): Don't call gelf_newphdr for 0. + + * unstrip.c (handle_file): Tweak BIAS != 0 warning. + + * unstrip.c (handle_file): Take new arg CREATE_DIRS. If set, + call make_directories here. + (handle_explicit_files): Take new arg CREATE_DIRS, pass it down. + (handle_dwfl_module): Likewise. + (handle_implicit_modules): Update callers. + (handle_output_dir_module): Likewise. Don't do make_directories here. + + * unstrip.c (get_section_name): New function, broken out of ... + (copy_elided_sections): here. Update callers. + (find_alloc_section): Broken out of ... + (copy_elided_sections): ... here. Update caller. + (symtab_count_leading_section_symbols): Take new arg NEWSYMDATA, + update STT_SECTION symbols' st_value fields as a side effect. + (check_symtab_section_symbols): Update caller. + (add_new_section_symbols): Set st_value in symbols added. + (collect_symbols): Reset S->value for STT_SECTION symbols recorded. + Take new arg SPLIT_BSS. Adjust S->shndx recorded for symbols moved + from .bss to .dynbss. + (find_alloc_sections_prelink): New function. Associate debug file + allocated SHT_NOBITS shdrs with stripped moved by prelink via + .gnu.prelink_undo information. + (copy_elided_sections): Call it when we couldn't find every allocated + section. Don't use a debug file non-NOBITS section if SHF_ALLOC. + Take STRIPPED_EHDR arg instead of E_TYPE and PHNUM. + (handle_file): Update callers. + + * unstrip.c (copy_elided_sections): Ignore unfound unallocated section + named ".comment". + + * elflint.c (check_sections): Fix association of segments with + sections when p_memsz > p_filesz. + +2007-04-29 Roland McGrath <roland@redhat.com> + + * addr2line.c (options, main): Tweak argp group settings to fix + usage output. + +2007-04-28 Roland McGrath <roland@redhat.com> + + * strip.c (handle_elf): Update debug file's SHT_NOBITS sections' + sizes to match sections adjusted in the stripped file. + +2007-04-24 Roland McGrath <roland@redhat.com> + + * elfcmp.c (OPT_HASH_INEXACT): New macro. + (hash_inexact): New variable. + (options, parse_opt): Add --hash-inexact option to set it. + (hash_content_equivalent): New function. + (main): Call it for differing SHT_HASH sections under --hash-inexact. + +2007-04-23 Roland McGrath <roland@redhat.com> + + * unstrip.c: New file. + * Makefile.am (bin_PROGRAMS): Add it. + (unstrip_LDADD): New variable. + + * strip.c (options): Allow --output for -o. + +2007-02-15 Ulrich Drepper <drepper@redhat.com> + + * readelf.c: Remove unused code. Add a few consts. + +2007-02-15 Roland McGrath <roland@redhat.com> + + * readelf.c (print_debug): Fix brainos in SHDR test. + +2007-02-05 Roland McGrath <roland@redhat.com> + + * ar.c: Include <limits.h>, since we use LONG_MAX. + +2007-02-05 Ulrich Drepper <drepper@redhat.com> + + * ar.c: Add ugly hack to work around gcc complaining that we + ignore fchown's return value. + (do_oper_insert): Handle error when writing padding. + * ranlib.c: Add fchown complain work around. + + * arlib.c: Make symtab a global variable. Change all users. + * arlib2.c: Likewise. + * ranlib.c: Likewise. + * ar.c: Likewise. + * arlib.h: Declare it. + +2007-01-11 Roland McGrath <roland@redhat.com> + + * elflint.c (check_sections): Use ebl_machine_section_flag_check on + SHF_MASKPROC bits separately from generic sh_flags validation. + +2007-02-04 Ulrich Drepper <drepper@redhat.com> + + * ar.c: New file. + * arlib.c: New file. + * arlib2.c: New file. + * arlib.h: New file. + * Makefile (noinst_LIBRARIES): Add libar. + (libar_a_SOURCES): Define. + (ar_LDADD): Define. + (CFLAGS_ar): Define. + * ranlib.c: Change to use arlib. + + * elflint.c (check_symtab): Work around GNU ld bug which omits + sections but not symbols in those sections. + +2007-01-10 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: Update copyright year. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + +2006-12-09 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (compare_hash_gnu_hash): New function. Report if the + two hash tables have different content (module expected omission + of undefined symbols). + +2006-10-31 Roland McGrath <roland@redhat.com> + + * elflint.c (check_program_header): Don't complain about + p_filesz > p_memsz if p_memsz is zero and p_type is PT_NOTE. + +2006-09-19 Jakub Jelinek <jakub@redhat.com> + + * strip.c (process_file): Disallow -f on archives. + +2006-10-09 Roland McGrath <roland@redhat.com> + + * Makefile.am (libld_elf_i386.so): Use $(LINK), not $(CC). + +2006-08-29 Roland McGrath <roland@redhat.com> + + * Makefile.am (MAINTAINERCLEANFILES): New variable. + + * readelf.c (handle_relocs_rel): Typo fix, test DESTSHDR properly. + Reported by Christian Aichinger <Greek0@gmx.net>. + + * elflint.c (valid_e_machine): Add EM_ALPHA. + Reported by Christian Aichinger <Greek0@gmx.net>. + +2006-08-08 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB. + Keep track of which "high DT" entries are present. + Check that either old or GNU-style hash table is present. + If GNU-style hash table is used a symbol table is mandatory. + Check that if any prelink entry is present all of them are. + (check_gnu_hash): Only fail for undefined symbols in GNU-style hash + table if they don't refer to functions. + +2006-07-17 Roland McGrath <roland@redhat.com> + + * elflint.c (struct version_namelist): Use GElf_Versym for `ndx' field. + (add_version): Likewise for argument. + (check_versym): Cast constant to GElf_Versym for comparison. + +2006-07-12 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_gnu_hash): Add casts for machines where + Elf32_Word != unsigned int. + +2006-07-12 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_sysv_hash64): Fix printf format. + +2006-07-11 Roland McGrath <roland@redhat.com> + + * addr2line.c (options): English fix in -f doc string. + + * addr2line.c (use_comp_dir): New variable. + (options, parse_opt): Grok -A/--absolute to set it. + (handle_address): If set, prepend dwfl_line_comp_dir results to + relative file names. + +2006-07-06 Ulrich Drepper <drepper@redhat.com> + + * elflint.c: Adjust for latest new hash table format. + * readelf.c: Likewise. + + * elflint.c (check_versym): Ignore hidden bit when comparing version + numbers. + +2006-07-05 Ulrich Drepper <drepper@redhat.com> + + * ldgeneric.c (ld_generic_create_outfile): Correctly recognize + discarded COMDAT symbols. + + * i386_ld.c (elf_i386_count_relocations): Lot of corrections. + (elf_i386_create_relocations): Likewise. + * ld.h (struct symbol): Add local and hidden bits. + * ld.c (create_special_section_symbol): These synthsized symbols + are local and hidden. + * ldgeneric.c (file_process2): Check whether input file matches + the emulation. + (fillin_special_symbol): Create symbols as local and/or hidden + if requested. + (ld_generic_create_outfile): Make local copy of symbol. + Don't hide global, defined symbols in dynamic symbol table unless + requested. Synthetic symbols have no version information. + + * elflint.c: Add support for checking 64-bit SysV-style hash tables. + * readelf.c: Add support for printing 64-bit SysV-style hash tables. + +2006-07-04 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (is_rel_dyn): Fix and extend DT_RELCOUNT/DT_RELACOUNT + testing. + +2006-07-03 Ulrich Drepper <drepper@redhat.com> + + * elflint.c: Add testing of DT_GNU_HASH. + * readelf.c: Implement showing histogram for DT_GNU_HASH section. + + * Makefile.am: Add hacks to create dependency files for non-generic + linker. + +2006-06-12 Ulrich Drepper <drepper@redhat.com> + + * ldgeneric.c (ld_generic_generate_sections): Don't create .interp + section if creating a DSO and no interpreter is given. + (ld_generic_create_outfile): Don't store reference to symbols in + discarded COMDAT groups. Don't create PHDR and INTERP program header + for DSO if no interpreter is specified. + (create_verneed_data): Pretty printing. + + * ldscript.y (content): If a DSO is created don't set default + interpreter from linker script. + + * i386_ld.c (elf_i386_count_relocations): Do not add relocations + for symbols in discarded COMDAT groups. + (elf_i386_create_relocations): Likewise. + * ld.h (struct scninfo): Add unused_comdat. + * ldgeneric.c (add_section): Also check group signature when + matching COMDAT sections. + (add_relocatable_file): Ignore symbols in COMDAT group which are + discarded. + + * elflint.c (check_one_reloc): For *_NONE relocs only check type + and symbol reference. + +2006-06-11 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_dynamic): Fix checking value of tags which are + offsets in the string section. Make sure DT_STRTAB points to the + section referenced in sh_link. + + * ld.c (options): Add headers. Add short option 'R' for '--rpath'. + + * ld.c: Recognize --eh-frame-hdr option. + * ld.h (struct ld_state): Add eh_frame_hdr field. + * ldgeneric.c (struct unw_eh_frame_hdr): Define. + + * ldgeneric.c (add_section): Use ebl_sh_flags_combine instead of + SH_FLAGS_COMBINE. + (add_relocatable_file): Minor optimization of last change. + (match_section): Don't preserve SHF_GROUP flag any longer. + +2006-06-10 Ulrich Drepper <drepper@redhat.com> + + * ld.c (parse_z_option): Recognize execstack and noexecstack. + Handle record and ignore as position dependent options. + (parse_z_option_2): Handle ignore and record here. + * ld.h (struct ld_state): Add execstack field. + * ldgeneric.c (add_relocatable_file): Recognize .note.GNU-stack + sections. + (ld_generic_create_outfile): Fix program header creation in native + linker. Add PT_GNU_STACK program header. + +2006-06-09 Ulrich Drepper <drepper@redhat.com> + + * i386_ld.c (elf_i386_finalize_plt): Don't change symbol table entries + for PLT entries if there is no local definition. + + * ld.c (parse_option): Handle -z ignore like --as-needed and + -z record like --no-as-needed. + * ld.h (struct ld_state): Remove ignore_unused_dsos field. + * ldgeneric.c (new_generated_scn): Always compute ndt_needed by + looping over DSOs. When deciding about adding DT_NEEDED entries + use ->as_needed instead of ignore_unused_dsos. + +2006-05-31 Ulrich Drepper <drepper@redhat.com> + + * ld.c: Recognize --as-needed and --no-as-needed options. + * ld.h (struct usedfile): Add as_needed field. + (struct ld_state): Likewise. + * ldgeneric.c (ld_handle_filename_list): Copy as_needed flag from + the list. + * ldscript.y (filename_id_list): Split to correctly parse all + combinations. + (mark_as_needed): Fix loop. + +2006-05-28 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c (print_dwarf_function): Use unsigned type for lineno + and colno. + +2006-05-27 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (handle_relocs_rela): Better notations for addon value. + (print_ehdr): Distinguish e_ident[EI_VERSION] from e_version. + +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: Update copyright year. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + +2006-03-09 Roland McGrath <roland@redhat.com> + + * Makefile.am (AM_LDFLAGS): New variable. + +2006-03-01 Roland McGrath <roland@redhat.com> + + * readelf.c (dwarf_tag_string, dwarf_attr_string): Update name tables + for dwarf.h changes matching 3.0 spec. + (dwarf_encoding_string, dwarf_lang_string, print_ops): Likewise. + +2005-12-04 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_one_reloc): If relocation section is not loaded, + don't check whether the relocations modify read-only sections or + loaded and unloaded sections. + +2005-11-28 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_one_reloc): Take additional parameters. Use + them to determine whether relocation is valid in this type of + file. DSOs and executables can contain relocation sections in + unloaded sections which just show the relocations the linker + applied. Adjust all callers. + (check_program_header): Check that PT_PHDR is loaded and that offset + matches the one in the ELF header. + +2005-10-26 Roland McGrath <roland@redhat.com> + + * nm.c (get_var_range): dwarf_getloclist -> dwarf_getlocation. + +2005-09-03 Ulrich Drepper <drepper@redhat.com> + + * strip.c (handle_elf): Unify some error messages. + * ld.c (main): Likewise. + * ldgeneric.c (open_elf): Likewise. + * elfcmp.c (main): Likewise. + * elflint.c (check_elf_header): Likewise. + + * size.c (process_file): Fix typo in error message. + + * readelf.c: Lots of little cleanups. Use _unlocked functions. + +2005-09-02 Ulrich Drepper <drepper@redhat.com> + + * strings.c (main): Reset elfmap variable after munmap call. + [_MUDFLAP] (map_file): Simplify mudflap debugging by not using mmap. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * ranlib.c: Don't define pread_retry and write_retry here. + + * Makefile.an [BUILD_STATIC] (libdw): Add -ldl. + (CLEANFILES): Add *.gcno *.gcda *.gconv. + + * strings.c (process_chunk): Reorder expressions in conditional + (process_chunk_mb): Likewise. + + * strings.c: New file. + * Makefile.am (bin_PROGRAMS): Add strings. + (strings_no_Wstring): Define. + (strings_LDADD): Define. + +2005-08-27 Roland McGrath <roland@redhat.com> + + * addr2line.c (dwarf_diename_integrate): Function removed. + (print_dwarf_function): Use plain dwarf_diename. + +2005-08-24 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_versym): Versioned symbols should not have + local binding. + +2005-08-15 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_versym): Allow VER_NDX_LOCAL symbols to be + undefined. + + * Makefile.am: Add rules to build ranlib. + * ranlib.c: New file. + +2005-08-14 Roland McGrath <roland@redhat.com> + + * elflint.c (check_sections): Use ebl_section_type_name and allow any + sh_type it recognizes. + + * elflint.c (check_sections): Print unknown flags in hex, don't + truncate high bits. Print section number and name for unknown type. + +2005-08-13 Roland McGrath <roland@redhat.com> + + * elflint.c (check_program_header): Use ebl_segment_type_name and + allow any p_type it recognizes. Include p_type value in error + message for unknown type. + +2005-08-13 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_symtab): Simplify last change a bit. Pass ehdr + to ebl_check_special_symbol. + (check_sections): Pass ehdr to ebl_bss_plt_p. + +2005-08-12 Roland McGrath <roland@redhat.com> + + * elflint.c (check_symtab): Check that _GLOBAL_OFFSET_TABLE_ st_shndx + refers to the right section if it's not SHN_ABS. + Let ebl_check_special_symbol override _G_O_T_ value and size checks. + + * elflint.c (check_sections): Don't complain about a non-NOBITS + section taking no segment space, if it's sh_size is 0. + + * elflint.c (check_sections): Use ebl_bss_plt_p to see if .plt should + be PROGBITS or NOBITS. + + * elflint.c (check_symtab): Use ebl_check_special_symbol to override + standard st_value and st_size checks. + +2005-07-28 Roland McGrath <roland@redhat.com> + + * addr2line.c (options, parse_opt): Don't handle -e here. + (executable): Variable removed. + (argp_children): New static variable. + (argp): Use it. Make const. + (main): Fill in argp_children from dwfl_standard_argp (). + Let libdwfl handle file selection, pass Dwfl handle to handle_address. + (print_dwarf_function): New function. Try to figure out inline chain. + (elf_getname): Function removed, libdwfl does it for us. + (handle_address): Take Dwfl handle instead of Elf, Dwarf handles. + Use dwfl_module_addrname instead of elf_getname. + Use dwfl_module_getsrc and dwfl_lineinfo instead of libdw calls. + * Makefile.am (INCLUDES): Add libdwfl directory to path. + +2005-08-10 Ulrich Drepper <drepper@redhat.com> + + * strip.c (parse_opt): STATE parameter is now used. + Various little cleanups. + + * readelf.c (print_debug_line_section): Correct fallout of renaming + of DW_LNS_set_epilog_begin. + +2005-08-08 Roland McGrath <roland@redhat.com> + + * strip.c (options, parse_opt): Grok -R .comment for compatibility + with binutils strip. Likewise -d, -S, as aliases for -g. + Likewise ignore -s/--strip-all. + +2005-08-07 Roland McGrath <roland@redhat.com> + + * strip.c (process_file): Open read-only when using a different output + file. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (in_nobits_scn): New function. + (check_versym): Allow references for defined symbols against versions + of other DSOs also for symbols in nobits sections. + Move a few variables around. + + * Makefile.am (AM_CFLAGS): Avoid duplication. + Link with statis libs if BUILD_STATIC. + +2005-08-05 Ulrich Drepper <drepper@redhat.com> + + * elflint.c: Many, many more tests. Mostly related to symbol + versioning. Those sections should now be completely checked. + + * readelf.c (print_dynamic): Use gelf_offscn. + +2005-08-04 Ulrich Drepper <drepper@redhat.com> + + * elflint.c: Add lots more tests: more extension symbol table sanity, + versioning section tests, hash table tests. General cleanup. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * objdump.c: New file. + * Makefile.am (bin_PROGRAMS): Add objdump. + (objdump_LDADD): Define. + + * elflint.c (check_reloc_shdr): New function split out from check_rela + and check_rel. + (check_one_reloc): New function. Likewise. + (check_rela): Use check_reloc_shdr and check_one_reloc. + (check_rel): Likewise. + (check_program_header): Check that PT_DYNAMIC entry matches .dynamic + section. + Add checks that relocations against read-only segments are flagged, + that the text relocation flag is not set unnecessarily, and that + relocations in one section are either against loaded or not-loaded + segments. + +2005-08-01 Ulrich Drepper <drepper@redhat.com> + + * elfcmp.c (main): Ignore section count and section name string table + section index. + +2005-07-27 Roland McGrath <roland@redhat.com> + + * elfcmp.c: Include <locale.h>. + +2005-07-27 Ulrich Drepper <drepper@redhat.com> + + * elfcmp.c: Print name and index of differing section. + +2005-07-24 Ulrich Drepper <drepper@redhat.com> + + * elfcmp.c: Implement comparing gaps between sections. + +2005-07-23 Ulrich Drepper <drepper@redhat.com> + + * elflint.c: Include libeblP.h instead of libebl.h. + * nm.c: Likewise. + * readelf.c: Likewise. + * elfcmp.c: Likewise. + + * elfcmp.c (main): Compare individual ELF header fields, excluding + e_shoff instead of the whole struct at once. + Use ebl_section_strip_p instead of SECTION_STRIP_P. + * strip.c: Use ebl_section_strip_p instead of SECTION_STRIP_P. + +2005-07-22 Ulrich Drepper <drepper@redhat.com> + + * elfcmp.c (main): Take empty section into account when comparing + section content. + + * elflint.c (check_dynamic): Check that d_tag value is >= 0 before + using it. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * elfcmp.c: New file. + * Makefile.am (bin_PROGRAMS): Add elfcmp. + (elfcmp_LDADD): Define. + + * elflint.c (check_rela): Check that copy relocations only reference + object symbols or symbols with unknown type. + (check_rel): Likewise. + +2005-06-08 Roland McGrath <roland@redhat.com> + + * readelf.c (print_ops): Add consts. + +2005-05-31 Roland McGrath <roland@redhat.com> + + * readelf.c (print_debug_abbrev_section): Don't bail after first CU's + abbreviations. Print a header line before each CU section. + + * readelf.c (print_debug_loc_section): Fix indentation for larger + address size. + +2005-05-30 Roland McGrath <roland@redhat.com> + + * readelf.c (print_debug_line_section): Print section offset of each + CU's table, so they are easy to find from seeing the stmt_list value. + + * readelf.c (dwarf_attr_string): Add all attributes in <dwarf.h>. + (attr_callback): Grok DW_AT_ranges and print offset in hex. + + * readelf.c (attr_callback): Add 2 to addrsize * 2 for %#0* format. + (print_debug_ranges_section, print_debug_loc_section): Likewise. + + * readelf.c (print_ops): Take different args for indentation control. + (attr_callback): Caller updated. + Grok several more block-form attributes as being location expressions. + For those same attributes with udata forms, format output differently + for location list offset. + (print_debug_loc_section): Implement it for real. + + * readelf.c (options): Mention ranges for --debug-dump. + (enum section_e): Add section_ranges. + (parse_opt): Grok "ranges" for -w/--debug-dump. + (print_debug_ranges_section): New function. + (print_debug): Handle .debug_ranges section. + +2005-05-30 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (handle_notes): At least x86-64 need not have the note + section values aligned to 8 bytes. + +2005-05-18 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (dwarf_tag_string): Add new tags. + +2005-05-08 Roland McGrath <roland@redhat.com> + + * strip.c (handle_elf): Don't translate hash and versym data formats, + elf_getdata already did it for us. + +2005-05-07 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (findtextrel_LDADD): Add $(libmudflap). + (addr2line_LDADD): Likewise. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * strip.c (handle_elf): Apply symbol table fixups to discarded + relocation sections when they are being saved in the debug file. + + * strip.c (handle_elf): Pass EHDR->e_ident[EI_DATA] to gelf_xlatetom + and gelf_xlatetof, not the native byte order. + + * strip.c (parse_opt): Give error if -f or -o is repeated. + (main): Exit if argp_parse returns nonzero. + + * strip.c (debug_fname_embed): New variable. + (options, parse_opt): New option -F to set it. + +2005-05-07 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (parse_opt): Make any_control_option variable + local. Simplify some tests. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * strip.c (crc32_file): Function removed (now in ../lib). + +2005-05-03 Roland McGrath <roland@redhat.com> + + * elflint.c (is_debuginfo): New variable. + (options, parse_opt): New option --debuginfo/-d to set it. + (check_sections): If is_debuginfo, don't complain about SHT_NOBITS. + (check_note): If is_debuginfo, don't try to get note contents. + +2005-04-24 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (print_debug_abbrev_section): Don't print error when end of + section reached. + +2005-04-14 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (dwarf_encoding_string): New function. + (dwarf_inline_string): New function. + (dwarf_access_string): New function. + (dwarf_visibility_string): New function. + (dwarf_virtuality_string): New function. + (dwarf_identifier_case_string): New function. + (dwarf_calling_convention_string): New function. + (dwarf_ordering_string): New function. + (dwarf_discr_list_string): New function. + (attr_callback): Decode man more attribute values. + +2005-04-01 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: Finish implementation of -f option. + +2005-03-29 Ulrich Drepper <drepper@redhat.com> + + * addr2line.c: New file. + * Makefile.am (bin_PROGRAMS): Add addr2line. + Define addr2line_LDADD. + + * findtextrel.c: Use new dwarf_addrdie function. + + * findtextrel.c: Fix usage message and re-add accidentally removed + line. + +2005-03-28 Ulrich Drepper <drepper@redhat.com> + + * findtextrel.c: New file. + * Makefile: Add rules to build findtextrel. + +2005-02-15 Ulrich Drepper <drepper@redhat.com> + + * ldlex.l: Provide ECHO definition to avoid warning. + + * elflint.c (check_program_header): Fix typo in RELRO test. + + * Makefile.am (AM_CFLAGS): Add more warning options. + * elflint.c: Fix warnings introduced by the new warning options. + * i386_ld.c: Likewise. + * ld.c: Likewise. + * ld.h: Likewise. + * ldgeneric.c: Likewise. + * nm.c: Likewise. + * readelf.c: Likewise. + * sectionhash.c: Likewise. + * size.c: Likewise. + * string.c: Likewise. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Check for text relocations in constructed DSOs. + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap. Link all apps + with -lmudflap. + + * ldscript.y: Add as_needed handling. + * ldlex.l: Recognize AS_NEEDED token. + * ld.h (struct filename_list): Add as_needed flag. + +2005-02-04 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (check_symtab): Correctly determine size of GOT section. + +2005-01-19 Ulrich Drepper <drepper@redhat.com> + + * ld.c: Remove unnecessary more_help function. Print bug report + address using argp. + * strip.c: Likewise. + * size.c: Likewise. + * nm.c: Likewise. + * readelf.c: Likewise. + * elflint.c: Likewise. + + * elflint.c (main): Don't check for parameter problems here. + (parse_opt): Do it here, where we get informed about some of them + anyway. + + * readelf.c (main): Don't check for parameter problems here. + (parse_opt): Do it here, where we get informed about some of them + anyway. + +2005-01-11 Ulrich Drepper <drepper@redhat.com> + + * strip.c: Update copyright year. + * readelf.c: Likewise. + * size.c: Likewise. + * nm.c: Likewise. + * ld.c: Likewise. + * elflint.c: Likewise. + + * elflint.c (check_symtab): Don't warn about wrong size for + _DYNAMIC and __GLOBAL_OFFSET_TABLE__ for --gnu-ld. + +2004-10-05 Ulrich Drepper <drepper@redhat.com> + + * readelf.c (print_phdr): In section mapping, also indicate + sections in read-only segments. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * readelf.c: Make compile with gcc 4.0. diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index f147eee2..00000000 --- a/src/Makefile +++ /dev/null @@ -1,638 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# src/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - - - -SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c readelf.c size.c strip.c - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \ - strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) -noinst_PROGRAMS = $(am__EXEEXT_1) -#am__append_1 = libld_elf.a -subdir = src -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in ChangeLog ldlex.c ldscript.c ylwrap -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -AR = ar -ARFLAGS = cru -libld_elf_a_AR = $(AR) $(ARFLAGS) -libld_elf_a_LIBADD = -am_libld_elf_a_OBJECTS = $(base_cpu)_ld.$(OBJEXT) -libld_elf_a_OBJECTS = $(am_libld_elf_a_OBJECTS) -libld_elf_i386_pic_a_AR = $(AR) $(ARFLAGS) -libld_elf_i386_pic_a_LIBADD = -libld_elf_i386_pic_a_OBJECTS = $(am_libld_elf_i386_pic_a_OBJECTS) -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -am__EXEEXT_1 = libld_elf_i386.so$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -elflint_SOURCES = elflint.c -elflint_OBJECTS = elflint.$(OBJEXT) -am__DEPENDENCIES_1 = ../libebl/libebl.a -am__DEPENDENCIES_2 = ../libelf/libelf.so -#am__DEPENDENCIES_2 = ../libelf/libelf.a -am__DEPENDENCIES_3 = ../lib/libeu.a -elflint_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) -am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$(OBJEXT) ldlex.$(OBJEXT) \ - ldscript.$(OBJEXT) symbolhash.$(OBJEXT) sectionhash.$(OBJEXT) \ - versionhash.$(OBJEXT) -ld_OBJECTS = $(am_ld_OBJECTS) -#am__DEPENDENCIES_4 = libld_elf.a -ld_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) -am_libld_elf_i386_so_OBJECTS = -libld_elf_i386_so_OBJECTS = $(am_libld_elf_i386_so_OBJECTS) -libld_elf_i386_so_LDADD = $(LDADD) -nm_SOURCES = nm.c -nm_OBJECTS = nm.$(OBJEXT) -am__DEPENDENCIES_5 = ../libdw/libdw.so -#am__DEPENDENCIES_5 = ../libdw/libdw.a -nm_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) -readelf_SOURCES = readelf.c -readelf_OBJECTS = readelf.$(OBJEXT) -readelf_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) -size_SOURCES = size.c -size_OBJECTS = size.$(OBJEXT) -size_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) -strip_SOURCES = strip.c -strip_OBJECTS = strip.$(OBJEXT) -strip_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \ - elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \ - readelf.c size.c strip.c -DIST_SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \ - elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \ - readelf.c size.c strip.c -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \ - -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" - -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -d -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ - $(if $($(*F)_no_Werror),,-Werror) $(native_ld_cflags) - -#AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ -# $(native_ld_cflags) - -#AM_LDFLAGS = -fmudflap -INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I.. -AM_YFLAGS = -pld -AM_LFLAGS = -Pld -olex.yy.c -native_ld = @native_ld@ -ld_dsos = libld_elf_i386_pic.a -noinst_LIBRARIES = libld_elf.a $(ld_dsos) -#noinst_LIBRARIES = libld_elf.a -#native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) -ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ - versionhash.c - -noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ - ldscript.h xelf.h unaligned.h - -EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) -ld_modules = i386_ld.c -libdw = ../libdw/libdw.so -#libdw = ../libdw/libdw.a -libelf = ../libelf/libelf.so -#libelf = ../libelf/libelf.a -libebl = ../libebl/libebl.a -libeu = ../lib/libeu.a -readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -size_LDADD = $(libelf) $(libeu) -strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl -ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(am__append_1) -ld_LDFLAGS = -rdynamic -elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl -ldlex_no_Werror = yes - -# Machine-specific linker code. -libld_elf_a_SOURCES = $(base_cpu)_ld.c -libld_elf_i386_pic_a_SOURCES = -am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os -libld_elf_i386_so_SOURCES = -CLEANFILES = none_ld.os $(ld_modules:.c=.os) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .l .o .obj .y -$(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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits src/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libld_elf.a: $(libld_elf_a_OBJECTS) $(libld_elf_a_DEPENDENCIES) - -rm -f libld_elf.a - $(libld_elf_a_AR) libld_elf.a $(libld_elf_a_OBJECTS) $(libld_elf_a_LIBADD) - $(RANLIB) libld_elf.a -libld_elf_i386_pic.a: $(libld_elf_i386_pic_a_OBJECTS) $(libld_elf_i386_pic_a_DEPENDENCIES) - -rm -f libld_elf_i386_pic.a - $(libld_elf_i386_pic_a_AR) libld_elf_i386_pic.a $(libld_elf_i386_pic_a_OBJECTS) $(libld_elf_i386_pic_a_LIBADD) - $(RANLIB) libld_elf_i386_pic.a -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -elflint$(EXEEXT): $(elflint_OBJECTS) $(elflint_DEPENDENCIES) - @rm -f elflint$(EXEEXT) - $(LINK) $(elflint_LDFLAGS) $(elflint_OBJECTS) $(elflint_LDADD) $(LIBS) -ld$(EXEEXT): $(ld_OBJECTS) $(ld_DEPENDENCIES) - @rm -f ld$(EXEEXT) - $(LINK) $(ld_LDFLAGS) $(ld_OBJECTS) $(ld_LDADD) $(LIBS) -nm$(EXEEXT): $(nm_OBJECTS) $(nm_DEPENDENCIES) - @rm -f nm$(EXEEXT) - $(LINK) $(nm_LDFLAGS) $(nm_OBJECTS) $(nm_LDADD) $(LIBS) -readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES) - @rm -f readelf$(EXEEXT) - $(LINK) $(readelf_LDFLAGS) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS) -size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES) - @rm -f size$(EXEEXT) - $(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS) -strip$(EXEEXT): $(strip_OBJECTS) $(strip_DEPENDENCIES) - @rm -f strip$(EXEEXT) - $(LINK) $(strip_LDFLAGS) $(strip_OBJECTS) $(strip_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/$(base_cpu)_ld.Po -include ./$(DEPDIR)/elflint.Po -include ./$(DEPDIR)/ld.Po -include ./$(DEPDIR)/ldgeneric.Po -include ./$(DEPDIR)/ldlex.Po -include ./$(DEPDIR)/ldscript.Po -include ./$(DEPDIR)/nm.Po -include ./$(DEPDIR)/readelf.Po -include ./$(DEPDIR)/sectionhash.Po -include ./$(DEPDIR)/size.Po -include ./$(DEPDIR)/strip.Po -include ./$(DEPDIR)/symbolhash.Po -include ./$(DEPDIR)/versionhash.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.l.c: - $(LEXCOMPILE) $< - sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ - rm -f $(LEX_OUTPUT_ROOT).c - -.y.c: - $(YACCCOMPILE) $< - if test -f y.tab.h; then \ - to=`echo "$*_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ - y.tab.h >$*.ht; \ - rm -f y.tab.h; \ - if cmp -s $*.ht $*.h; then \ - rm -f $*.ht ;\ - else \ - mv $*.ht $*.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output $*.output; \ - fi - sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ - rm -f y.tab.c -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -rm -f ldlex.c - -rm -f ldscript.c -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: installcheck-binPROGRAMS - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ - distclean distclean-compile distclean-generic distclean-tags \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installcheck-binPROGRAMS installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am - - -ldlex.o: ldscript.c -ldscript.h: ldscript.c -libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - $(libelf) $(libeu) \ - -Wl,--version-script,$(srcdir)/libld_elf_i386.map - -%.os: %.c %.o - if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \ - -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ - `test -f '$<' || echo '$(srcdir)/'`$<; \ - then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ - rm -f "$(DEPDIR)/$*.Tpo"; \ - else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ - fi - -# Special rule to make it possible to define libld_elf_a_SOURCES as we do. -# Otherwise make would complain. -.deps/none_ld.Po: none_ld.os - -: - -installcheck-binPROGRAMS: $(bin_PROGRAMS) - bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ - case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ - *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ - esac; \ - f=`echo "$$p" | \ - sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - for opt in --help --version; do \ - if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ - $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ - && test -n "`cat c$${pid}_.out`" \ - && test -z "`cat c$${pid}_.err`"; then :; \ - else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ - done; \ - done; rm -f c$${pid}_.???; exit $$bad -# 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/src/Makefile.am b/src/Makefile.am index 7b957eb5..f72bb458 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,31 +1,46 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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. ## -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \ +## You should have received a copy of the GNU General Public License along +## with Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" if MUDFLAP -AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ - $(native_ld_cflags) +AM_CFLAGS = -fmudflap else -AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ - $(if $($(*F)_no_Werror),,-Werror) $(native_ld_cflags) +AM_CFLAGS = endif -if MUDFLAP -AM_LDFLAGS = -fmudflap -endif -INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I.. +AM_CFLAGS += -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \ + $(if $($(*F)_no_Werror),,-Werror) \ + $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ + $(if $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) + +INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ + -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. + +AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw YACC = @YACC@ -d AM_YFLAGS = -pld @@ -36,64 +51,105 @@ AM_LFLAGS = -Pld -olex.yy.c native_ld = @native_ld@ base_cpu = @base_cpu@ -bin_PROGRAMS = readelf nm size strip ld elflint +bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ + elfcmp objdump ranlib strings ar unstrip ld_dsos = libld_elf_i386_pic.a if NATIVE_LD -noinst_LIBRARIES = libld_elf.a +noinst_LIBRARIES = libld_elf.a libar.a native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) else -noinst_LIBRARIES = libld_elf.a $(ld_dsos) +noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) endif +if NEVER +# We never build this library but we need to get the dependency files +# of all the linker backends that might be used in a non-generic linker. +noinst_LIBRARIES += libdummy.a +libdummy_a_SOURCES = i386_ld.c +endif + +textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ versionhash.c +libar_a_SOURCES = arlib.c arlib2.c + noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ ldscript.h xelf.h unaligned.h -EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) +EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \ + debugpred.h ld_modules = i386_ld.c +bin_SCRIPTS = make-debug-archive +EXTRA_DIST += make-debug-archive.in +CLEANFILES = make-debug-archive + if MUDFLAP -libdw = ../libdw/libdw.a +libmudflap = -lmudflap +endif + +if BUILD_STATIC +libasm = ../libasm/libasm.a +libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl libelf = ../libelf/libelf.a else +libasm = ../libasm/libasm.so libdw = ../libdw/libdw.so libelf = ../libelf/libelf.so endif libebl = ../libebl/libebl.a libeu = ../lib/libeu.a -readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -size_LDADD = $(libelf) $(libeu) -strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl -ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl +nm_no_Wformat = yes +size_no_Wformat = yes +strings_no_Wformat = yes +# XXX While the file is not finished, don't warn about this +ldgeneric_no_Wunused = yes + +readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +size_LDADD = $(libelf) $(libeu) $(libmudflap) +strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl if NATIVE_LD +# -ldl is always needed for libebl. ld_LDADD += libld_elf.a endif ld_LDFLAGS = -rdynamic -elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl +elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) +addr2line_LDADD = $(libdw) $(libmudflap) +elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl +objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) +strings_LDADD = $(libelf) $(libeu) $(libmudflap) +ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) +CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" +unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl ldlex.o: ldscript.c ldlex_no_Werror = yes ldscript.h: ldscript.c +if NATIVE_LD # Machine-specific linker code. -libld_elf_a_SOURCES = $(base_cpu)_ld.c - +libld_elf_a_SOURCES := $(base_cpu)_ld.c +else libld_elf_i386_pic_a_SOURCES = am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os libld_elf_i386_so_SOURCES = libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - $(libelf) $(libeu) \ - -Wl,--version-script,$(srcdir)/libld_elf_i386.map + $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + $(libelf) $(libeu) \ + -Wl,--version-script,$(srcdir)/libld_elf_i386.map + $(textrel_check) +endif %.os: %.c %.o @@ -127,4 +183,17 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS) done; \ done; rm -f c$${pid}_.???; exit $$bad -CLEANFILES = none_ld.os $(ld_modules:.c=.os) +CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv + +MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h + + +make-debug-archive: $(srcdir)/make-debug-archive.in + UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \ + AR=$(bindir)/`echo ar | sed '$(transform)'`; \ + sed -e "s,@UNSTRIP@,$$UNSTRIP,g" -e "s,@AR@,$$AR,g" \ + -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \ + -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \ + $(srcdir)/make-debug-archive.in > $@.new + chmod +x $@.new + mv -f $@.new $@ diff --git a/src/Makefile.in b/src/Makefile.in index 0eb72237..7822b10d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -16,17 +16,12 @@ -SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c readelf.c size.c strip.c -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -41,93 +36,143 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \ - strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) + strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) \ + findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \ + objdump$(EXEEXT) ranlib$(EXEEXT) strings$(EXEEXT) ar$(EXEEXT) \ + unstrip$(EXEEXT) @NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) -@NATIVE_LD_TRUE@am__append_1 = libld_elf.a +# We never build this library but we need to get the dependency files +# of all the linker backends that might be used in a non-generic linker. +@NEVER_TRUE@am__append_1 = libdummy.a +# -ldl is always needed for libebl. +@NATIVE_LD_TRUE@am__append_2 = libld_elf.a +@NATIVE_LD_TRUE@am_libld_elf_i386_pic_a_OBJECTS = subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ldlex.c ldscript.c ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru +libar_a_AR = $(AR) $(ARFLAGS) +libar_a_LIBADD = +am_libar_a_OBJECTS = arlib.$(OBJEXT) arlib2.$(OBJEXT) +libar_a_OBJECTS = $(am_libar_a_OBJECTS) +libdummy_a_AR = $(AR) $(ARFLAGS) +libdummy_a_LIBADD = +am__libdummy_a_SOURCES_DIST = i386_ld.c +@NEVER_TRUE@am_libdummy_a_OBJECTS = i386_ld.$(OBJEXT) +libdummy_a_OBJECTS = $(am_libdummy_a_OBJECTS) libld_elf_a_AR = $(AR) $(ARFLAGS) libld_elf_a_LIBADD = -am_libld_elf_a_OBJECTS = $(base_cpu)_ld.$(OBJEXT) +am__libld_elf_a_SOURCES_DIST = $(base_cpu)_ld.c +@NATIVE_LD_TRUE@am_libld_elf_a_OBJECTS = $(base_cpu)_ld.$(OBJEXT) libld_elf_a_OBJECTS = $(am_libld_elf_a_OBJECTS) libld_elf_i386_pic_a_AR = $(AR) $(ARFLAGS) libld_elf_i386_pic_a_LIBADD = libld_elf_i386_pic_a_OBJECTS = $(am_libld_elf_i386_pic_a_OBJECTS) -am__installdirs = "$(DESTDIR)$(bindir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) am__EXEEXT_1 = libld_elf_i386.so$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +addr2line_SOURCES = addr2line.c +addr2line_OBJECTS = addr2line.$(OBJEXT) +@BUILD_STATIC_FALSE@am__DEPENDENCIES_1 = ../libdw/libdw.so +@BUILD_STATIC_TRUE@am__DEPENDENCIES_1 = ../libdw/libdw.a $(libelf) \ +@BUILD_STATIC_TRUE@ $(libebl) +am__DEPENDENCIES_2 = +addr2line_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +ar_SOURCES = ar.c +ar_OBJECTS = ar.$(OBJEXT) +ar_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_2) +elfcmp_SOURCES = elfcmp.c +elfcmp_OBJECTS = elfcmp.$(OBJEXT) +elfcmp_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_2) elflint_SOURCES = elflint.c elflint_OBJECTS = elflint.$(OBJEXT) -am__DEPENDENCIES_1 = ../libebl/libebl.a -@MUDFLAP_FALSE@am__DEPENDENCIES_2 = ../libelf/libelf.so -@MUDFLAP_TRUE@am__DEPENDENCIES_2 = ../libelf/libelf.a -am__DEPENDENCIES_3 = ../lib/libeu.a -elflint_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) +elflint_DEPENDENCIES = $(libebl) $(libelf) $(libeu) \ + $(am__DEPENDENCIES_2) +findtextrel_SOURCES = findtextrel.c +findtextrel_OBJECTS = findtextrel.$(OBJEXT) +findtextrel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libelf) \ + $(am__DEPENDENCIES_2) am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$(OBJEXT) ldlex.$(OBJEXT) \ ldscript.$(OBJEXT) symbolhash.$(OBJEXT) sectionhash.$(OBJEXT) \ versionhash.$(OBJEXT) ld_OBJECTS = $(am_ld_OBJECTS) -@NATIVE_LD_TRUE@am__DEPENDENCIES_4 = libld_elf.a -ld_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__DEPENDENCIES_2) \ + $(am__append_2) +ld_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ld_LDFLAGS) $(LDFLAGS) -o \ + $@ am_libld_elf_i386_so_OBJECTS = libld_elf_i386_so_OBJECTS = $(am_libld_elf_i386_so_OBJECTS) libld_elf_i386_so_LDADD = $(LDADD) nm_SOURCES = nm.c nm_OBJECTS = nm.$(OBJEXT) -@MUDFLAP_FALSE@am__DEPENDENCIES_5 = ../libdw/libdw.so -@MUDFLAP_TRUE@am__DEPENDENCIES_5 = ../libdw/libdw.a -nm_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +nm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libebl) $(libelf) $(libeu) \ + $(am__DEPENDENCIES_2) +objdump_SOURCES = objdump.c +objdump_OBJECTS = objdump.$(OBJEXT) +objdump_DEPENDENCIES = $(libasm) $(libebl) $(libelf) $(libeu) \ + $(am__DEPENDENCIES_2) +ranlib_SOURCES = ranlib.c +ranlib_OBJECTS = ranlib.$(OBJEXT) +ranlib_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_2) readelf_SOURCES = readelf.c readelf_OBJECTS = readelf.$(OBJEXT) -readelf_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +readelf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libebl) $(libelf) \ + $(libeu) $(am__DEPENDENCIES_2) size_SOURCES = size.c size_OBJECTS = size.$(OBJEXT) -size_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +size_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_2) +strings_SOURCES = strings.c +strings_OBJECTS = strings.$(OBJEXT) +strings_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_2) strip_SOURCES = strip.c strip_OBJECTS = strip.$(OBJEXT) -strip_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +strip_DEPENDENCIES = $(libebl) $(libelf) $(libeu) \ + $(am__DEPENDENCIES_2) +unstrip_SOURCES = unstrip.c +unstrip_OBJECTS = unstrip.$(OBJEXT) +unstrip_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_1) \ + $(libeu) $(am__DEPENDENCIES_2) +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/config/ylwrap +@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \ - elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \ - readelf.c size.c strip.c -DIST_SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \ - elflint.c $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c \ - readelf.c size.c strip.c +SOURCES = $(libar_a_SOURCES) $(libdummy_a_SOURCES) \ + $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \ + addr2line.c ar.c elfcmp.c elflint.c findtextrel.c \ + $(ld_SOURCES) $(libld_elf_i386_so_SOURCES) nm.c objdump.c \ + ranlib.c readelf.c size.c strings.c strip.c unstrip.c +DIST_SOURCES = $(libar_a_SOURCES) $(am__libdummy_a_SOURCES_DIST) \ + $(am__libld_elf_a_SOURCES_DIST) \ + $(libld_elf_i386_pic_a_SOURCES) addr2line.c ar.c elfcmp.c \ + elflint.c findtextrel.c $(ld_SOURCES) \ + $(libld_elf_i386_so_SOURCES) nm.c objdump.c ranlib.c readelf.c \ + size.c strings.c strip.c unstrip.c HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -136,45 +181,41 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ -DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \ +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -183,7 +224,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -191,12 +231,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -d +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -209,77 +251,124 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ 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@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ -@MUDFLAP_FALSE@ $(if $($(*F)_no_Werror),,-Werror) $(native_ld_cflags) - -@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ -@MUDFLAP_TRUE@ $(native_ld_cflags) - -@MUDFLAP_TRUE@AM_LDFLAGS = -fmudflap -INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I.. +@MUDFLAP_FALSE@ $(native_ld_cflags) $(if \ +@MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) $(if \ +@MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ +@MUDFLAP_FALSE@ $($(*F)_no_Wformat),,-Wformat=2) \ +@MUDFLAP_FALSE@ $(CFLAGS_$(*F)) +@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -std=gnu99 \ +@MUDFLAP_TRUE@ $(native_ld_cflags) $(if \ +@MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) $(if \ +@MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ +@MUDFLAP_TRUE@ $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) +INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ + -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. + +AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw AM_YFLAGS = -pld AM_LFLAGS = -Pld -olex.yy.c native_ld = @native_ld@ ld_dsos = libld_elf_i386_pic.a -@NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a $(ld_dsos) -@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a +@NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) \ +@NATIVE_LD_FALSE@ $(am__append_1) +@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_1) @NATIVE_LD_TRUE@native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) +@NEVER_TRUE@libdummy_a_SOURCES = i386_ld.c +textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ versionhash.c +libar_a_SOURCES = arlib.c arlib2.c noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ ldscript.h xelf.h unaligned.h -EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) +EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) \ + arlib.h debugpred.h make-debug-archive.in ld_modules = i386_ld.c -@MUDFLAP_FALSE@libdw = ../libdw/libdw.so -@MUDFLAP_TRUE@libdw = ../libdw/libdw.a -@MUDFLAP_FALSE@libelf = ../libelf/libelf.so -@MUDFLAP_TRUE@libelf = ../libelf/libelf.a +bin_SCRIPTS = make-debug-archive +CLEANFILES = make-debug-archive none_ld.os $(ld_modules:.c=.os) *.gcno \ + *.gcda *.gconv +@MUDFLAP_TRUE@libmudflap = -lmudflap +@BUILD_STATIC_FALSE@libasm = ../libasm/libasm.so +@BUILD_STATIC_TRUE@libasm = ../libasm/libasm.a +@BUILD_STATIC_FALSE@libdw = ../libdw/libdw.so +@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +@BUILD_STATIC_FALSE@libelf = ../libelf/libelf.so +@BUILD_STATIC_TRUE@libelf = ../libelf/libelf.a libebl = ../libebl/libebl.a libeu = ../lib/libeu.a -readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl -size_LDADD = $(libelf) $(libeu) -strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl -ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(am__append_1) +nm_no_Wformat = yes +size_no_Wformat = yes +strings_no_Wformat = yes +# XXX While the file is not finished, don't warn about this +ldgeneric_no_Wunused = yes +readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +size_LDADD = $(libelf) $(libeu) $(libmudflap) +strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \ + $(am__append_2) ld_LDFLAGS = -rdynamic -elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl +elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) +addr2line_LDADD = $(libdw) $(libmudflap) +elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl +objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl +ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) +strings_LDADD = $(libelf) $(libeu) $(libmudflap) +ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) +CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" +unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl ldlex_no_Werror = yes # Machine-specific linker code. -libld_elf_a_SOURCES = $(base_cpu)_ld.c -libld_elf_i386_pic_a_SOURCES = -am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os -libld_elf_i386_so_SOURCES = -CLEANFILES = none_ld.os $(ld_modules:.c=.os) +@NATIVE_LD_TRUE@libld_elf_a_SOURCES := $(base_cpu)_ld.c +@NATIVE_LD_FALSE@libld_elf_i386_pic_a_SOURCES = +@NATIVE_LD_FALSE@am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os +@NATIVE_LD_FALSE@libld_elf_i386_so_SOURCES = +MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h all: all-am .SUFFIXES: .SUFFIXES: .c .l .o .obj .y -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -304,13 +393,21 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libar.a: $(libar_a_OBJECTS) $(libar_a_DEPENDENCIES) + -rm -f libar.a + $(libar_a_AR) libar.a $(libar_a_OBJECTS) $(libar_a_LIBADD) + $(RANLIB) libar.a +libdummy.a: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES) + -rm -f libdummy.a + $(libdummy_a_AR) libdummy.a $(libdummy_a_OBJECTS) $(libdummy_a_LIBADD) + $(RANLIB) libdummy.a libld_elf.a: $(libld_elf_a_OBJECTS) $(libld_elf_a_DEPENDENCIES) -rm -f libld_elf.a $(libld_elf_a_AR) libld_elf.a $(libld_elf_a_OBJECTS) $(libld_elf_a_LIBADD) @@ -321,7 +418,7 @@ libld_elf_i386_pic.a: $(libld_elf_i386_pic_a_OBJECTS) $(libld_elf_i386_pic_a_DEP $(RANLIB) libld_elf_i386_pic.a install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -345,24 +442,85 @@ clean-binPROGRAMS: clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES) + @rm -f addr2line$(EXEEXT) + $(LINK) $(addr2line_OBJECTS) $(addr2line_LDADD) $(LIBS) +ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES) + @rm -f ar$(EXEEXT) + $(LINK) $(ar_OBJECTS) $(ar_LDADD) $(LIBS) +elfcmp$(EXEEXT): $(elfcmp_OBJECTS) $(elfcmp_DEPENDENCIES) + @rm -f elfcmp$(EXEEXT) + $(LINK) $(elfcmp_OBJECTS) $(elfcmp_LDADD) $(LIBS) elflint$(EXEEXT): $(elflint_OBJECTS) $(elflint_DEPENDENCIES) @rm -f elflint$(EXEEXT) - $(LINK) $(elflint_LDFLAGS) $(elflint_OBJECTS) $(elflint_LDADD) $(LIBS) + $(LINK) $(elflint_OBJECTS) $(elflint_LDADD) $(LIBS) +findtextrel$(EXEEXT): $(findtextrel_OBJECTS) $(findtextrel_DEPENDENCIES) + @rm -f findtextrel$(EXEEXT) + $(LINK) $(findtextrel_OBJECTS) $(findtextrel_LDADD) $(LIBS) ld$(EXEEXT): $(ld_OBJECTS) $(ld_DEPENDENCIES) @rm -f ld$(EXEEXT) - $(LINK) $(ld_LDFLAGS) $(ld_OBJECTS) $(ld_LDADD) $(LIBS) + $(ld_LINK) $(ld_OBJECTS) $(ld_LDADD) $(LIBS) +@NATIVE_LD_TRUE@libld_elf_i386.so$(EXEEXT): $(libld_elf_i386_so_OBJECTS) $(libld_elf_i386_so_DEPENDENCIES) +@NATIVE_LD_TRUE@ @rm -f libld_elf_i386.so$(EXEEXT) +@NATIVE_LD_TRUE@ $(LINK) $(libld_elf_i386_so_OBJECTS) $(libld_elf_i386_so_LDADD) $(LIBS) nm$(EXEEXT): $(nm_OBJECTS) $(nm_DEPENDENCIES) @rm -f nm$(EXEEXT) - $(LINK) $(nm_LDFLAGS) $(nm_OBJECTS) $(nm_LDADD) $(LIBS) + $(LINK) $(nm_OBJECTS) $(nm_LDADD) $(LIBS) +objdump$(EXEEXT): $(objdump_OBJECTS) $(objdump_DEPENDENCIES) + @rm -f objdump$(EXEEXT) + $(LINK) $(objdump_OBJECTS) $(objdump_LDADD) $(LIBS) +ranlib$(EXEEXT): $(ranlib_OBJECTS) $(ranlib_DEPENDENCIES) + @rm -f ranlib$(EXEEXT) + $(LINK) $(ranlib_OBJECTS) $(ranlib_LDADD) $(LIBS) readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES) @rm -f readelf$(EXEEXT) - $(LINK) $(readelf_LDFLAGS) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS) + $(LINK) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS) size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES) @rm -f size$(EXEEXT) - $(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS) + $(LINK) $(size_OBJECTS) $(size_LDADD) $(LIBS) +strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES) + @rm -f strings$(EXEEXT) + $(LINK) $(strings_OBJECTS) $(strings_LDADD) $(LIBS) strip$(EXEEXT): $(strip_OBJECTS) $(strip_DEPENDENCIES) @rm -f strip$(EXEEXT) - $(LINK) $(strip_LDFLAGS) $(strip_OBJECTS) $(strip_LDADD) $(LIBS) + $(LINK) $(strip_OBJECTS) $(strip_LDADD) $(LIBS) +unstrip$(EXEEXT): $(unstrip_OBJECTS) $(unstrip_DEPENDENCIES) + @rm -f unstrip$(EXEEXT) + $(LINK) $(unstrip_OBJECTS) $(unstrip_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +installcheck-binSCRIPTS: $(bin_SCRIPTS) + bad=0; pid=$$$$; list="$(bin_SCRIPTS)"; for p in $$list; do \ + case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ + *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ + esac; \ + f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \ + for opt in --help --version; do \ + if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ + 2>c$${pid}_.err </dev/null \ + && test -n "`cat c$${pid}_.out`" \ + && test -z "`cat c$${pid}_.err`"; then :; \ + else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -371,67 +529,57 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/$(base_cpu)_ld.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addr2line.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfcmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findtextrel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_ld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldgeneric.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldlex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldscript.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objdump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ranlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sectionhash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbolhash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unstrip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/versionhash.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: - $(LEXCOMPILE) $< - sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ - rm -f $(LEX_OUTPUT_ROOT).c + $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: - $(YACCCOMPILE) $< - if test -f y.tab.h; then \ - to=`echo "$*_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ - y.tab.h >$*.ht; \ - rm -f y.tab.h; \ - if cmp -s $*.ht $*.h; then \ - rm -f $*.ht ;\ - else \ - mv $*.ht $*.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output $*.output; \ - fi - sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ - rm -f y.tab.c -uninstall-info-am: + $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -443,8 +591,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -454,13 +602,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -474,22 +621,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -502,10 +648,10 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -534,6 +680,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." -rm -f ldlex.c -rm -f ldscript.c + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ @@ -557,13 +704,21 @@ info-am: install-data-am: -install-exec-am: install-binPROGRAMS +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS install-binSCRIPTS + +install-html: install-html-am install-info: install-info-am install-man: -installcheck-am: installcheck-binPROGRAMS +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: installcheck-binPROGRAMS installcheck-binSCRIPTS maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) @@ -582,27 +737,33 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installcheck-binPROGRAMS installdirs maintainer-clean \ + install-am install-binPROGRAMS install-binSCRIPTS 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 installcheck-binPROGRAMS \ + installcheck-binSCRIPTS installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS ldlex.o: ldscript.c ldscript.h: ldscript.c -libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map - $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - $(libelf) $(libeu) \ - -Wl,--version-script,$(srcdir)/libld_elf_i386.map +@NATIVE_LD_FALSE@libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map +@NATIVE_LD_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ +@NATIVE_LD_FALSE@ $(libelf) $(libeu) \ +@NATIVE_LD_FALSE@ -Wl,--version-script,$(srcdir)/libld_elf_i386.map +@NATIVE_LD_FALSE@ $(textrel_check) %.os: %.c %.o if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \ @@ -633,6 +794,16 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS) else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad + +make-debug-archive: $(srcdir)/make-debug-archive.in + UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \ + AR=$(bindir)/`echo ar | sed '$(transform)'`; \ + sed -e "s,@UNSTRIP@,$$UNSTRIP,g" -e "s,@AR@,$$AR,g" \ + -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \ + -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \ + $(srcdir)/make-debug-archive.in > $@.new + chmod +x $@.new + mv -f $@.new $@ # 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/src/addr2line.c b/src/addr2line.c new file mode 100644 index 00000000..0d11e188 --- /dev/null +++ b/src/addr2line.c @@ -0,0 +1,490 @@ +/* Locate source files and line information for given addresses + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <inttypes.h> +#include <libdwfl.h> +#include <dwarf.h> +#include <libintl.h> +#include <locale.h> +#include <mcheck.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + + +/* Values for the parameters which have no short form. */ +#define OPT_DEMANGLER 0x100 + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Output selection options:"), 2 }, + { "basenames", 's', NULL, 0, N_("Show only base names of source files"), 0 }, + { "absolute", 'A', NULL, 0, + N_("Show absolute file names using compilation directory"), 0 }, + { "functions", 'f', NULL, 0, N_("Also show function names"), 0 }, + { "symbols", 'S', NULL, 0, N_("Also show symbol or section names"), 0 }, + + { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 }, + /* Unsupported options. */ + { "target", 'b', "ARG", OPTION_HIDDEN, NULL, 0 }, + { "demangle", 'C', "ARG", OPTION_HIDDEN | OPTION_ARG_OPTIONAL, NULL, 0 }, + { "demangler", OPT_DEMANGLER, "ARG", OPTION_HIDDEN, NULL, 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("\ +Locate source files and line information for ADDRs (in a.out by default)."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[ADDR...]"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +static struct argp_child argp_children[2]; /* [0] is set in main. */ + +/* Data structure to communicate with argp functions. */ +static const struct argp argp = +{ + options, parse_opt, args_doc, doc, argp_children, NULL, NULL +}; + + +/* Handle ADDR. */ +static int handle_address (const char *addr, Dwfl *dwfl); + + +/* True if only base names of files should be shown. */ +static bool only_basenames; + +/* True if absolute file names based on DW_AT_comp_dir should be shown. */ +static bool use_comp_dir; + +/* True if function names should be shown. */ +static bool show_functions; + +/* True if ELF symbol or section info should be shown. */ +static bool show_symbols; + + +int +main (int argc, char *argv[]) +{ + int remaining; + int result = 0; + + /* Make memory leak detection possible. */ + mtrace (); + + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. This includes opening the modules. */ + argp_children[0].argp = dwfl_standard_argp (); + argp_children[0].group = 1; + Dwfl *dwfl = NULL; + (void) argp_parse (&argp, argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + /* Now handle the addresses. In case none are given on the command + line, read from stdin. */ + if (remaining == argc) + { + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + + char *buf = NULL; + size_t len = 0; + while (!feof_unlocked (stdin)) + { + if (getline (&buf, &len, stdin) < 0) + break; + + result = handle_address (buf, dwfl); + } + + free (buf); + } + else + { + do + result = handle_address (argv[remaining], dwfl); + while (++remaining < argc); + } + + return result; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "addr2line (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg __attribute__ ((unused)), + struct argp_state *state) +{ + switch (key) + { + case ARGP_KEY_INIT: + state->child_inputs[0] = state->input; + break; + + case 'b': + case 'C': + case OPT_DEMANGLER: + /* Ignored for compatibility. */ + break; + + case 's': + only_basenames = true; + break; + + case 'A': + use_comp_dir = true; + break; + + case 'f': + show_functions = true; + break; + + case 'S': + show_symbols = true; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +static bool +print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr) +{ + Dwarf_Addr bias = 0; + Dwarf_Die *cudie = dwfl_module_addrdie (mod, addr, &bias); + + Dwarf_Die *scopes; + int nscopes = dwarf_getscopes (cudie, addr - bias, &scopes); + if (nscopes <= 0) + return false; + + for (int i = 0; i < nscopes; ++i) + switch (dwarf_tag (&scopes[i])) + { + case DW_TAG_subprogram: + { + const char *name = dwarf_diename (&scopes[i]); + if (name == NULL) + return false; + puts (name); + return true; + } + + case DW_TAG_inlined_subroutine: + { + const char *name = dwarf_diename (&scopes[i]); + if (name == NULL) + return false; + printf ("%s inlined", name); + + Dwarf_Files *files; + if (dwarf_getsrcfiles (cudie, &files, NULL) == 0) + { + Dwarf_Attribute attr_mem; + Dwarf_Word val; + if (dwarf_formudata (dwarf_attr (&scopes[i], + DW_AT_call_file, + &attr_mem), &val) == 0) + { + const char *file = dwarf_filesrc (files, val, NULL, NULL); + unsigned int lineno = 0; + unsigned int colno = 0; + if (dwarf_formudata (dwarf_attr (&scopes[i], + DW_AT_call_line, + &attr_mem), &val) == 0) + lineno = val; + if (dwarf_formudata (dwarf_attr (&scopes[i], + DW_AT_call_column, + &attr_mem), &val) == 0) + colno = val; + if (lineno == 0) + { + if (file != NULL) + printf (" from %s", file); + } + else if (colno == 0) + printf (" at %s:%u", file, lineno); + else + printf (" at %s:%u:%u", file, lineno, colno); + } + } + printf (" in "); + continue; + } + } + + return false; +} + +static void +print_addrsym (Dwfl_Module *mod, GElf_Addr addr) +{ + GElf_Sym s; + GElf_Word shndx; + const char *name = dwfl_module_addrsym (mod, addr, &s, &shndx); + if (name == NULL) + { + /* No symbol name. Get a section name instead. */ + int i = dwfl_module_relocate_address (mod, &addr); + if (i >= 0) + name = dwfl_module_relocation_info (mod, i, NULL); + if (name == NULL) + puts ("??"); + else + printf ("(%s)+%#" PRIx64 "\n", name, addr); + } + else if (addr == s.st_value) + puts (name); + else + printf ("%s+%#" PRIx64 "\n", name, addr - s.st_value); +} + +static int +see_one_module (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr start __attribute__ ((unused)), + void *arg) +{ + Dwfl_Module **result = arg; + if (*result != NULL) + return DWARF_CB_ABORT; + *result = mod; + return DWARF_CB_OK; +} + +static int +find_symbol (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr start __attribute__ ((unused)), + void *arg) +{ + const char *looking_for = ((void **) arg)[0]; + GElf_Sym *symbol = ((void **) arg)[1]; + + int n = dwfl_module_getsymtab (mod); + for (int i = 1; i < n; ++i) + { + const char *symbol_name = dwfl_module_getsym (mod, i, symbol, NULL); + if (symbol_name == NULL) + continue; + switch (GELF_ST_TYPE (symbol->st_info)) + { + case STT_SECTION: + case STT_FILE: + case STT_TLS: + break; + default: + if (!strcmp (symbol_name, looking_for)) + { + ((void **) arg)[0] = NULL; + return DWARF_CB_ABORT; + } + } + } + + return DWARF_CB_OK; +} + +static int +handle_address (const char *string, Dwfl *dwfl) +{ + char *endp; + uintmax_t addr = strtoumax (string, &endp, 0); + if (endp == string) + { + bool parsed = false; + int n; + char *name = NULL; + if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2 + && string[n] == '\0') + { + /* It was (section)+offset. This makes sense if there is + only one module to look in for a section. */ + Dwfl_Module *mod = NULL; + if (dwfl_getmodules (dwfl, &see_one_module, &mod, 0) != 0 + || mod == NULL) + error (EXIT_FAILURE, 0, gettext ("Section syntax requires" + " exactly one module")); + + int nscn = dwfl_module_relocations (mod); + for (int i = 0; i < nscn; ++i) + { + GElf_Word shndx; + const char *scn = dwfl_module_relocation_info (mod, i, &shndx); + if (unlikely (scn == NULL)) + break; + if (!strcmp (scn, name)) + { + /* Found the section. */ + GElf_Shdr shdr_mem; + GElf_Addr shdr_bias; + GElf_Shdr *shdr = gelf_getshdr + (elf_getscn (dwfl_module_getelf (mod, &shdr_bias), shndx), + &shdr_mem); + if (unlikely (shdr == NULL)) + break; + + if (addr >= shdr->sh_size) + error (0, 0, + gettext ("offset %#" PRIxMAX " lies outside" + " section '%s'"), + addr, scn); + + addr += shdr->sh_addr + shdr_bias; + parsed = true; + break; + } + } + } + else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 + && string[n] == '\0') + { + /* It was symbol+offset. */ + GElf_Sym sym; + void *arg[2] = { name, &sym }; + (void) dwfl_getmodules (dwfl, &find_symbol, arg, 0); + if (arg[0] != NULL) + error (0, 0, gettext ("cannot find symbol '%s'"), name); + else + { + if (sym.st_size != 0 && addr >= sym.st_size) + error (0, 0, + gettext ("offset %#" PRIxMAX " lies outside" + " contents of '%s'"), + addr, name); + addr += sym.st_value; + parsed = true; + } + } + + free (name); + if (!parsed) + return 1; + } + + Dwfl_Module *mod = dwfl_addrmodule (dwfl, addr); + + if (show_functions) + { + /* First determine the function name. Use the DWARF information if + possible. */ + if (! print_dwarf_function (mod, addr) && !show_symbols) + puts (dwfl_module_addrname (mod, addr) ?: "??"); + } + + if (show_symbols) + print_addrsym (mod, addr); + + Dwfl_Line *line = dwfl_module_getsrc (mod, addr); + + const char *src; + int lineno, linecol; + if (line != NULL && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol, + NULL, NULL)) != NULL) + { + const char *comp_dir = ""; + const char *comp_dir_sep = ""; + + if (only_basenames) + src = basename (src); + else if (use_comp_dir && src[0] != '/') + { + comp_dir = dwfl_line_comp_dir (line); + if (comp_dir != NULL) + comp_dir_sep = "/"; + } + + if (linecol != 0) + printf ("%s%s%s:%d:%d\n", + comp_dir, comp_dir_sep, src, lineno, linecol); + else + printf ("%s%s%s:%d\n", + comp_dir, comp_dir_sep, src, lineno); + } + else + puts ("??:0"); + + return 0; +} + + +#include "debugpred.h" diff --git a/src/ar.c b/src/ar.c new file mode 100644 index 00000000..aade3511 --- /dev/null +++ b/src/ar.c @@ -0,0 +1,1518 @@ +/* Create, modify, and extract from archives. + Copyright (C) 2005, 2007 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <libintl.h> +#include <limits.h> +#include <locale.h> +#include <mcheck.h> +#include <search.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/statfs.h> +#include <sys/time.h> + +#include <system.h> + +#include "arlib.h" + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Prototypes for local functions. */ +static int do_oper_extract (int oper, const char *arfname, char **argv, + int argc, long int instance); +static int do_oper_delete (const char *arfname, char **argv, int argc, + long int instance); +static int do_oper_insert (int oper, const char *arfname, char **argv, + int argc, const char *member); + + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Commands:"), 0 }, + { NULL, 'd', NULL, 0, N_("Delete files from archive."), 0 }, + { NULL, 'm', NULL, 0, N_("Move files in archive."), 0 }, + { NULL, 'p', NULL, 0, N_("Print files in archive."), 0 }, + { NULL, 'q', NULL, 0, N_("Quick append files to archive."), 0 }, + { NULL, 'r', NULL, 0, + N_("Replace existing or insert new file into archive."), 0 }, + { NULL, 't', NULL, 0, N_("Display content of archive."), 0 }, + { NULL, 'x', NULL, 0, N_("Extract files from archive."), 0 }, + + { NULL, 0, NULL, 0, N_("Command Modifiers:"), 0 }, + { NULL, 'o', NULL, 0, N_("Preserve original dates."), 0 }, + { NULL, 'N', NULL, 0, N_("Use instance [COUNT] of name."), 0 }, + { NULL, 'C', NULL, 0, + N_("Do not replace existing files with extracted files."), 0 }, + { NULL, 'T', NULL, 0, N_("Allow filename to be truncated if necessary."), + 0 }, + { NULL, 'v', NULL, 0, N_("Provide verbose output."), 0 }, + { NULL, 's', NULL, 0, N_("Force regeneration of symbol table."), 0 }, + { NULL, 'a', NULL, 0, N_("Insert file after [MEMBER]."), 0 }, + { NULL, 'b', NULL, 0, N_("Insert file before [MEMBER]."), 0 }, + { NULL, 'i', NULL, 0, N_("Same as -b."), 0 }, + { NULL, 'c', NULL, 0, N_("Suppress message when library has to be created."), + 0 }, + { NULL, 'P', NULL, 0, N_("Use full path for file matching."), 0 }, + { NULL, 'u', NULL, 0, N_("Update only older files in archive."), 0 }, + + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("Create, modify, and extract from archives."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[MEMBER] [COUNT] ARCHIVE [FILE...]"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + options, parse_opt, args_doc, doc, NULL, NULL, NULL +}; + + +/* What operation to perform. */ +static enum + { + oper_none, + oper_delete, + oper_move, + oper_print, + oper_qappend, + oper_replace, + oper_list, + oper_extract + } operation; + +/* Modifiers. */ +static bool verbose; +static bool preserve_dates; +static bool instance_specifed; +static bool dont_replace_existing; +static bool allow_truncate_fname; +static bool force_symtab; +static bool suppress_create_msg; +static bool full_path; +static bool update_newer; +static enum { ipos_none, ipos_before, ipos_after } ipos; + + +int +main (int argc, char *argv[]) +{ + /* Make memory leak detection possible. */ + mtrace (); + + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stderr, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* For historical reasons the options in the first parameter need + not be preceded by a dash. Add it now if necessary. */ + if (argc > 1 && argv[1][0] != '-') + { + size_t len = strlen (argv[1]) + 1; + char *newp = alloca (len + 1); + newp[0] = '-'; + memcpy (&newp[1], argv[1], len); + argv[1] = newp; + } + + /* Parse and process arguments. */ + int remaining; + (void) argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &remaining, NULL); + + /* Tell the library which version we are expecting. */ + (void) elf_version (EV_CURRENT); + + /* Handle the [MEMBER] parameter. */ + const char *member = NULL; + if (ipos != ipos_none) + { + /* Only valid for certain operations. */ + if (operation == oper_extract && operation == oper_delete) + error (1, 0, gettext ("\ +'a', 'b', and 'i' are only allowed with the 'm' and 'r' options")); + + if (remaining == argc) + { + error (0, 0, gettext ("MEMBER parameter required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + exit (EXIT_FAILURE); + } + + member = argv[remaining++]; + } + + /* Handle the [COUNT] parameter. */ + long int instance = -1; + if (instance_specifed) + { + /* Only valid for certain operations. */ + if (operation == oper_extract && operation == oper_delete) + error (1, 0, gettext ("\ +'N' is only meaningful with the 'x' and 'd' options")); + + if (remaining == argc) + { + error (0, 0, gettext ("COUNT parameter required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + exit (EXIT_FAILURE); + } + + char *endp; + errno = 0; + if (((instance = strtol (argv[remaining], &endp, 10)) == LONG_MAX + && errno == ERANGE) + || instance <= 0 + || *endp != '\0') + error (1, 0, gettext ("invalid COUNT parameter %s"), argv[remaining]); + + ++remaining; + } + + if ((dont_replace_existing || allow_truncate_fname) + && unlikely (operation != oper_extract)) + error (1, 0, gettext ("'%' is only meaningful with the 'x' option"), + dont_replace_existing ? 'C' : 'T'); + + /* There must at least be one more parameter specifying the archive. */ + if (remaining == argc) + { + error (0, 0, gettext ("Archive name required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + exit (EXIT_FAILURE); + } + + const char *arfname = argv[remaining++]; + argv += remaining; + argc -= remaining; + + int status; + switch (operation) + { + case oper_list: + case oper_print: + status = do_oper_extract (operation, arfname, argv, argc, -1); + break; + + case oper_extract: + status = do_oper_extract (operation, arfname, argv, argc, instance); + break; + + case oper_delete: + status = do_oper_delete (arfname, argv, argc, instance); + break; + + case oper_move: + case oper_qappend: + case oper_replace: + status = do_oper_insert (operation, arfname, argv, argc, member); + break; + + default: + assert (! "should not happen"); + status = 1; + break; + } + + return status; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "ar (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg __attribute__ ((unused)), + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case 'd': + case 'm': + case 'p': + case 'q': + case 'r': + case 't': + case 'x': + if (operation != oper_none) + { + error (0, 0, gettext ("More than one operation specified")); + argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + exit (EXIT_FAILURE); + } + + switch (key) + { + case 'd': + operation = oper_delete; + break; + case 'm': + operation = oper_move; + break; + case 'p': + operation = oper_print; + break; + case 'q': + operation = oper_qappend; + break; + case 'r': + operation = oper_replace; + break; + case 't': + operation = oper_list; + break; + case 'x': + operation = oper_extract; + break; + } + break; + + case 'a': + ipos = ipos_after; + break; + + case 'b': + case 'i': + ipos = ipos_before; + break; + + case 'c': + suppress_create_msg = true; + break; + + case 'C': + dont_replace_existing = true; + break; + + case 'N': + instance_specifed = true; + break; + + case 'o': + preserve_dates = true; + break; + + case 'P': + full_path = true; + break; + + case 's': + force_symtab = true; + break; + + case 'T': + allow_truncate_fname = true; + break; + + case 'v': + verbose = true; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +static int +open_archive (const char *arfname, int flags, int mode, Elf **elf, + struct stat *st, bool miss_allowed) +{ + int fd = open (arfname, flags, mode); + if (fd == -1) + { + if (miss_allowed) + return -1; + + error (EXIT_FAILURE, errno, gettext ("cannot open archive '%s'"), + arfname); + } + + if (elf != NULL) + { + Elf_Cmd cmd = flags == O_RDONLY ? ELF_C_READ_MMAP : ELF_C_RDWR_MMAP; + + *elf = elf_begin (fd, cmd, NULL); + if (*elf == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot open archive '%s': %s"), + arfname, elf_errmsg (-1)); + + if (flags == O_RDONLY && elf_kind (*elf) != ELF_K_AR) + error (EXIT_FAILURE, 0, gettext ("%s: not an archive file"), arfname); + } + + if (st != NULL && fstat (fd, st) != 0) + error (EXIT_FAILURE, errno, gettext ("cannot stat archive '%s'"), + arfname); + + return fd; +} + + +static void +not_found (int argc, char *argv[argc], bool found[argc]) +{ + for (int i = 0; i < argc; ++i) + if (!found[i]) + printf (gettext ("no entry %s in archive\n"), argv[i]); +} + + +static int +copy_content (Elf *elf, int newfd, off_t off, size_t n) +{ + size_t len; + char *rawfile = elf_rawfile (elf, &len); + + assert (off + n <= len); + + /* Tell the kernel we will read all the pages sequentially. */ + size_t ps = sysconf (_SC_PAGESIZE); + if (n > 2 * ps) + posix_madvise (rawfile + (off & ~(ps - 1)), n, POSIX_MADV_SEQUENTIAL); + + return write_retry (newfd, rawfile + off, n) != (ssize_t) n; +} + + +static int +do_oper_extract (int oper, const char *arfname, char **argv, int argc, + long int instance) +{ + bool found[argc]; + memset (found, '\0', sizeof (found)); + + struct statfs f; + f.f_namelen = 0; + + off_t index_off = -1; + size_t index_size = 0; + off_t cur_off = SARMAG; + + int status = 0; + Elf *elf; + int fd = open_archive (arfname, O_RDONLY, 0, &elf, NULL, false); + + if (hcreate (2 * argc) == 0) + error (EXIT_FAILURE, errno, gettext ("cannot create hash table")); + + for (int cnt = 0; cnt < argc; ++cnt) + { + ENTRY entry = { .key = argv[cnt], .data = &argv[cnt] }; + if (hsearch (entry, ENTER) == NULL) + error (EXIT_FAILURE, errno, + gettext ("cannot insert into hash table")); + } + + struct stat st; + if (force_symtab) + { + if (fstat (fd, &st) != 0) + { + error (0, errno, gettext ("cannot stat '%s'"), arfname); + close (fd); + return 1; + } + arlib_init (); + } + + Elf_Cmd cmd = ELF_C_READ_MMAP; + Elf *subelf; + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + if (strcmp (arhdr->ar_name, "/") == 0) + { + index_off = elf_getaroff (subelf); + index_size = arhdr->ar_size; + goto next; + } + if (strcmp (arhdr->ar_name, "//") == 0) + goto next; + + if (force_symtab) + { + arlib_add_symbols (elf, arfname, arhdr->ar_name, cur_off); + cur_off += (((arhdr->ar_size + 1) & ~((off_t) 1)) + + sizeof (struct ar_hdr)); + } + + bool do_extract = argc <= 0; + if (!do_extract) + { + ENTRY entry; + entry.key = arhdr->ar_name; + ENTRY *res = hsearch (entry, FIND); + if (res != NULL && (instance < 0 || instance-- == 0) + && !found[(char **) res->data - argv]) + found[(char **) res->data - argv] = do_extract = true; + } + + if (do_extract) + { + if (verbose) + { + if (oper == oper_print) + { + printf ("\n<%s>\n\n", arhdr->ar_name); + + /* We have to flush now because now we use the descriptor + directly. */ + fflush (stdout); + } + else if (oper == oper_list) + { + char datestr[100]; + strftime (datestr, sizeof (datestr), "%b %e %H:%M %Y", + localtime (&arhdr->ar_date)); + + printf ("%c%c%c%c%c%c%c%c%c %u/%u %6ju %s %s\n", + (arhdr->ar_mode & S_IRUSR) ? 'r' : '-', + (arhdr->ar_mode & S_IWUSR) ? 'w' : '-', + (arhdr->ar_mode & S_IXUSR) + ? ((arhdr->ar_mode & S_ISUID) ? 's' : 'x') + : ((arhdr->ar_mode & S_ISUID) ? 'S' : '-'), + (arhdr->ar_mode & S_IRGRP) ? 'r' : '-', + (arhdr->ar_mode & S_IWGRP) ? 'w' : '-', + (arhdr->ar_mode & S_IXGRP) + ? ((arhdr->ar_mode & S_ISGID) ? 's' : 'x') + : ((arhdr->ar_mode & S_ISGID) ? 'S' : '-'), + (arhdr->ar_mode & S_IROTH) ? 'r' : '-', + (arhdr->ar_mode & S_IWOTH) ? 'w' : '-', + (arhdr->ar_mode & S_IXOTH) + ? ((arhdr->ar_mode & S_ISVTX) ? 't' : 'x') + : ((arhdr->ar_mode & S_ISVTX) ? 'T' : '-'), + arhdr->ar_uid, + arhdr->ar_gid, + (uintmax_t) arhdr->ar_size, + datestr, + arhdr->ar_name); + } + else + printf ("x - %s\n", arhdr->ar_name); + } + + if (oper == oper_list) + { + if (!verbose) + puts (arhdr->ar_name); + + goto next; + } + + size_t nleft; + char *data = elf_rawfile (subelf, &nleft); + if (data == NULL) + { + error (0, 0, gettext ("cannot read content of %s: %s"), + arhdr->ar_name, elf_errmsg (-1)); + status = 1; + goto next; + } + + int xfd; + char tempfname[] = "XXXXXX"; + bool use_mkstemp = true; + + if (oper == oper_print) + xfd = STDOUT_FILENO; + else + { + xfd = mkstemp (tempfname); + if (unlikely (xfd == -1)) + { + /* We cannot create a temporary file. Try to overwrite + the file or create it if it does not exist. */ + int flags = O_WRONLY | O_CREAT; + if (dont_replace_existing) + flags |= O_EXCL; + else + flags |= O_TRUNC; + xfd = open (arhdr->ar_name, flags, 0600); + if (unlikely (xfd == -1)) + { + int printlen = INT_MAX; + + if (errno == ENAMETOOLONG && allow_truncate_fname + && (f.f_namelen != 0 || statfs (".", &f) == 0)) + { + /* Try to truncate the name. First find out by how + much. */ + printlen = f.f_namelen; + char truncfname[f.f_namelen + 1]; + *((char *) mempcpy (truncfname, arhdr->ar_name, + f.f_namelen)) = '\0'; + + xfd = open (truncfname, flags, 0600); + } + + if (xfd == -1) + { + error (0, errno, gettext ("cannot open %.*s"), + (int) printlen, arhdr->ar_name); + status = 1; + goto next; + } + } + + use_mkstemp = false; + } + } + + ssize_t n; + while ((n = TEMP_FAILURE_RETRY (write (xfd, data, nleft))) != -1) + { + nleft -= n; + if (nleft == 0) + break; + data += n; + } + + if (unlikely (n == -1)) + { + error (0, errno, gettext ("failed to write %s"), arhdr->ar_name); + status = 1; + unlink (tempfname); + close (xfd); + goto next; + } + + if (oper != oper_print) + { + /* Fix up the mode. */ + if (unlikely (fchmod (xfd, arhdr->ar_mode) != 0)) + { + error (0, errno, gettext ("cannot change mode of %s"), + arhdr->ar_name); + status = 0; + } + + if (preserve_dates) + { + struct timeval tv[2]; + tv[0].tv_sec = arhdr->ar_date; + tv[0].tv_usec = 0; + tv[1].tv_sec = arhdr->ar_date; + tv[1].tv_usec = 0; + + if (unlikely (futimes (xfd, tv) != 0)) + { + error (0, errno, + gettext ("cannot change modification time of %s"), + arhdr->ar_name); + status = 1; + } + } + + /* If we used a temporary file, move it do the right + name now. */ + if (use_mkstemp) + { + int r; + + if (dont_replace_existing) + { + r = link (tempfname, arhdr->ar_name); + if (likely (r == 0)) + unlink (tempfname); + } + else + r = rename (tempfname, arhdr->ar_name); + + if (unlikely (r) != 0) + { + int printlen = INT_MAX; + + if (errno == ENAMETOOLONG && allow_truncate_fname + && (f.f_namelen != 0 || statfs (".", &f) == 0)) + { + /* Try to truncate the name. First find out by how + much. */ + printlen = f.f_namelen; + char truncfname[f.f_namelen + 1]; + *((char *) mempcpy (truncfname, arhdr->ar_name, + f.f_namelen)) = '\0'; + + if (dont_replace_existing) + { + r = link (tempfname, truncfname); + if (likely (r == 0)) + unlink (tempfname); + } + else + r = rename (tempfname, truncfname); + } + + if (r != 0) + { + error (0, errno, gettext ("\ +cannot rename temporary file to %.*s"), + printlen, arhdr->ar_name); + unlink (tempfname); + status = 1; + } + } + } + + close (xfd); + } + } + + next: + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + error (1, 0, "%s: %s", arfname, elf_errmsg (-1)); + } + + hdestroy (); + + if (force_symtab) + { + arlib_finalize (); + + if (symtab.symsnamelen != 0 + /* We have to rewrite the file also if it initially had an index + but now does not need one anymore. */ + || (symtab.symsnamelen == 0 && index_size != 0)) + { + char tmpfname[strlen (arfname) + 7]; + strcpy (stpcpy (tmpfname, arfname), "XXXXXX"); + int newfd = mkstemp (tmpfname); + if (unlikely (newfd == -1)) + { + nonew: + error (0, errno, gettext ("cannot create new file")); + status = 1; + } + else + { + /* Create the header. */ + if (unlikely (write_retry (newfd, ARMAG, SARMAG) != SARMAG)) + { + // XXX Use /prof/self/fd/%d ??? + nonew_unlink: + unlink (tmpfname); + if (newfd != -1) + close (newfd); + goto nonew; + } + + /* Create the new file. There are three parts as far we are + concerned: 1. original context before the index, 2. the + new index, 3. everything after the new index. */ + off_t rest_off; + if (index_off != -1) + rest_off = (index_off + sizeof (struct ar_hdr) + + ((index_size + 1) & ~1ul)); + else + rest_off = SARMAG; + + if ((symtab.symsnamelen != 0 + && ((write_retry (newfd, symtab.symsoff, + symtab.symsofflen) + != (ssize_t) symtab.symsofflen) + || (write_retry (newfd, symtab.symsname, + symtab.symsnamelen) + != (ssize_t) symtab.symsnamelen))) + /* Even if the original file had content before the + symbol table, we write it in the correct order. */ + || (index_off != SARMAG + && copy_content (elf, newfd, SARMAG, index_off - SARMAG)) + || copy_content (elf, newfd, rest_off, st.st_size - rest_off) + /* Set the mode of the new file to the same values the + original file has. */ + || fchmod (newfd, st.st_mode & ALLPERMS) != 0 + /* Never complain about fchown failing. */ + || (({asm ("" :: "r" (fchown (newfd, st.st_uid, + st.st_gid))); }), + close (newfd) != 0) + || (newfd = -1, rename (tmpfname, arfname) != 0)) + goto nonew_unlink; + } + } + } + + elf_end (elf); + + close (fd); + + not_found (argc, argv, found); + + return status; +} + + +struct armem +{ + off_t off; + off_t old_off; + size_t size; + long int long_name_off; + struct armem *next; + void *mem; + time_t sec; + uid_t uid; + gid_t gid; + mode_t mode; + const char *name; + Elf *elf; +}; + + +static int +write_member (struct armem *memb, off_t *startp, off_t *lenp, Elf *elf, + off_t end_off, int newfd) +{ + struct ar_hdr arhdr; + char tmpbuf[sizeof (arhdr.ar_name) + 1]; + + bool changed_header = memb->long_name_off != -1; + if (changed_header) + { + /* In case of a long file name we assume the archive header + changed and we write it here. */ + memcpy (&arhdr, elf_rawfile (elf, NULL) + *startp, sizeof (arhdr)); + + snprintf (tmpbuf, sizeof (tmpbuf), "/%-*ld", + (int) sizeof (arhdr.ar_name), memb->long_name_off); + changed_header = memcmp (arhdr.ar_name, tmpbuf, + sizeof (arhdr.ar_name)) != 0; + } + + /* If the files are adjacent in the old file extend the range. */ + if (*startp != -1 && !changed_header && *startp + *lenp == memb->old_off) + { + /* Extend the current range. */ + *lenp += (memb->next != NULL + ? memb->next->off : end_off) - memb->off; + return 0; + } + + /* Write out the old range. */ + if (*startp != -1 && copy_content (elf, newfd, *startp, *lenp)) + return -1; + + *startp = memb->old_off; + *lenp = (memb->next != NULL ? memb->next->off : end_off) - memb->off; + + if (changed_header) + { + memcpy (arhdr.ar_name, tmpbuf, sizeof (arhdr.ar_name)); + + if (unlikely (write_retry (newfd, &arhdr, sizeof (arhdr)) + != sizeof (arhdr))) + return -1; + + *startp += sizeof (struct ar_hdr); + assert ((size_t) *lenp >= sizeof (struct ar_hdr)); + *lenp -= sizeof (struct ar_hdr); + } + + return 0; +} + +/* Store the name in the long name table if necessary. + Record its offset or -1 if we did not need to use the table. */ +static void +remember_long_name (struct armem *mem, const char *name, size_t namelen) +{ + mem->long_name_off = (namelen > MAX_AR_NAME_LEN + ? arlib_add_long_name (name, namelen) + : -1l); +} + +static int +do_oper_delete (const char *arfname, char **argv, int argc, + long int instance) +{ + bool *found = alloca (sizeof (bool) * argc); + memset (found, '\0', sizeof (found)); + + /* List of the files we keep. */ + struct armem *to_copy = NULL; + + int status = 0; + Elf *elf; + struct stat st; + int fd = open_archive (arfname, O_RDONLY, 0, &elf, &st, false); + + if (hcreate (2 * argc) == 0) + error (EXIT_FAILURE, errno, gettext ("cannot create hash table")); + + for (int cnt = 0; cnt < argc; ++cnt) + { + ENTRY entry = { .key = argv[cnt], .data = &argv[cnt] }; + if (hsearch (entry, ENTER) == NULL) + error (EXIT_FAILURE, errno, + gettext ("cannot insert into hash table")); + } + + arlib_init (); + + off_t cur_off = SARMAG; + Elf_Cmd cmd = ELF_C_READ_MMAP; + Elf *subelf; + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + /* Ignore the symbol table and the long file name table here. */ + if (strcmp (arhdr->ar_name, "/") == 0 + || strcmp (arhdr->ar_name, "//") == 0) + goto next; + + bool do_delete = argc <= 0; + if (!do_delete) + { + ENTRY entry; + entry.key = arhdr->ar_name; + ENTRY *res = hsearch (entry, FIND); + if (res != NULL && (instance < 0 || instance-- == 0) + && !found[(char **) res->data - argv]) + found[(char **) res->data - argv] = do_delete = true; + } + + if (do_delete) + { + if (verbose) + printf ("d - %s\n", arhdr->ar_name); + } + else + { + struct armem *newp = alloca (sizeof (struct armem)); + newp->old_off = elf_getaroff (subelf); + newp->off = cur_off; + + cur_off += (((arhdr->ar_size + 1) & ~((off_t) 1)) + + sizeof (struct ar_hdr)); + + if (to_copy == NULL) + to_copy = newp->next = newp; + else + { + newp->next = to_copy->next; + to_copy = to_copy->next = newp; + } + + /* If we recreate the symbol table read the file's symbol + table now. */ + arlib_add_symbols (subelf, arfname, arhdr->ar_name, newp->off); + + /* Remember long file names. */ + remember_long_name (newp, arhdr->ar_name, strlen (arhdr->ar_name)); + } + + next: + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + error (1, 0, "%s: %s", arfname, elf_errmsg (-1)); + } + + arlib_finalize (); + + hdestroy (); + + /* Create a new, temporary file in the same directory as the + original file. */ + char tmpfname[strlen (arfname) + 7]; + strcpy (stpcpy (tmpfname, arfname), "XXXXXX"); + int newfd = mkstemp (tmpfname); + if (unlikely (newfd == -1)) + goto nonew; + + /* Create the header. */ + if (unlikely (write_retry (newfd, ARMAG, SARMAG) != SARMAG)) + { + // XXX Use /prof/self/fd/%d ??? + nonew_unlink: + unlink (tmpfname); + if (newfd != -1) + close (newfd); + nonew: + error (0, errno, gettext ("cannot create new file")); + status = 1; + goto errout; + } + + /* If the archive is empty that is all we have to do. */ + if (likely (to_copy != NULL)) + { + /* Write the symbol table or the long file name table or both. */ + if (symtab.symsnamelen != 0 + && ((write_retry (newfd, symtab.symsoff, symtab.symsofflen) + != (ssize_t) symtab.symsofflen) + || (write_retry (newfd, symtab.symsname, symtab.symsnamelen) + != (ssize_t) symtab.symsnamelen))) + goto nonew_unlink; + + if (symtab.longnameslen > sizeof (struct ar_hdr) + && (write_retry (newfd, symtab.longnames, symtab.longnameslen) + != (ssize_t) symtab.longnameslen)) + goto nonew_unlink; + + /* NULL-terminate the list of files to copy. */ + struct armem *last = to_copy; + to_copy = to_copy->next; + last->next = NULL; + + off_t start = -1; + off_t len = -1; + + do + if (write_member (to_copy, &start, &len, elf, cur_off, newfd) != 0) + goto nonew_unlink; + while ((to_copy = to_copy->next) != NULL); + + /* Write the last part. */ + if (copy_content (elf, newfd, start, len)) + goto nonew_unlink; + } + + /* Set the mode of the new file to the same values the original file + has. */ + if (fchmod (newfd, st.st_mode & ALLPERMS) != 0 + /* Never complain about fchown failing. */ + || (({asm ("" :: "r" (fchown (newfd, st.st_uid, st.st_gid))); }), + close (newfd) != 0) + || (newfd = -1, rename (tmpfname, arfname) != 0)) + goto nonew_unlink; + + errout: +#ifdef DEBUG + elf_end (elf); + + arlib_fini (); + + close (fd); +#endif + + not_found (argc, argv, found); + + return status; +} + + +static void +no0print (bool ofmt, char *buf, int bufsize, long int val) +{ + char tmpbuf[bufsize + 1]; + snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val); + memcpy (buf, tmpbuf, bufsize); +} + + +static int +do_oper_insert (int oper, const char *arfname, char **argv, int argc, + const char *member) +{ + int status = 0; + Elf *elf; + struct stat st; + int fd = open_archive (arfname, O_RDONLY, 0, &elf, &st, oper != oper_move); + + /* List of the files we keep. */ + struct armem *all = NULL; + struct armem *after_memberelem = NULL; + struct armem **found = alloca (sizeof (*found) * argc); + memset (found, '\0', sizeof (*found) * argc); + + arlib_init (); + + /* Initialize early for no_old case. */ + off_t cur_off = SARMAG; + + if (fd == -1) + { + if (!suppress_create_msg) + fprintf (stderr, "%s: creating %s\n", AR, arfname); + + goto no_old; + } + + /* Store the names of all files from the command line in a hash + table so that we can match it. Note that when no file name is + given we are basically doing nothing except recreating the + index. */ + if (oper != oper_qappend) + { + if (hcreate (2 * argc) == 0) + error (EXIT_FAILURE, errno, gettext ("cannot create hash table")); + + for (int cnt = 0; cnt < argc; ++cnt) + { + ENTRY entry; + entry.key = full_path ? argv[cnt] : basename (argv[cnt]); + entry.data = &argv[cnt]; + if (hsearch (entry, ENTER) == NULL) + error (EXIT_FAILURE, errno, + gettext ("cannot insert into hash table")); + } + } + + /* While iterating over the current content of the archive we must + determine a number of things: which archive members to keep, + which are replaced, and where to insert the new members. */ + Elf_Cmd cmd = ELF_C_READ_MMAP; + Elf *subelf; + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + /* Ignore the symbol table and the long file name table here. */ + if (strcmp (arhdr->ar_name, "/") == 0 + || strcmp (arhdr->ar_name, "//") == 0) + goto next; + + struct armem *newp = alloca (sizeof (struct armem)); + newp->old_off = elf_getaroff (subelf); + newp->size = arhdr->ar_size; + newp->sec = arhdr->ar_date; + newp->mem = NULL; + + /* Remember long file names. */ + remember_long_name (newp, arhdr->ar_name, strlen (arhdr->ar_name)); + + /* Check whether this is a file we are looking for. */ + if (oper != oper_qappend) + { + /* Check whether this is the member used as the insert point. */ + if (member != NULL && strcmp (arhdr->ar_name, member) == 0) + { + /* Note that all == NULL means insert at the beginning. */ + if (ipos == ipos_before) + after_memberelem = all; + else + after_memberelem = newp; + member = NULL; + } + + ENTRY entry; + entry.key = arhdr->ar_name; + ENTRY *res = hsearch (entry, FIND); + if (res != NULL && found[(char **) res->data - argv] == NULL) + { + found[(char **) res->data - argv] = newp; + + /* If we insert before or after a certain element move + all files to a special list. */ + if (unlikely (ipos != ipos_none || oper == oper_move)) + { + if (after_memberelem == newp) + /* Since we remove this element even though we should + insert everything after it, we in fact insert + everything after the previous element. */ + after_memberelem = all; + + goto next; + } + } + } + + if (all == NULL) + all = newp->next = newp; + else + { + newp->next = all->next; + all = all->next = newp; + } + + next: + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + error (EXIT_FAILURE, 0, "%s: %s", arfname, elf_errmsg (-1)); + } + + if (oper != oper_qappend) + hdestroy (); + + no_old: + if (member != NULL) + error (EXIT_FAILURE, 0, gettext ("position member %s not found"), + member); + + if (oper == oper_move) + { + /* Make sure all requested elements are found in the archive. */ + for (int cnt = 0; cnt < argc; ++cnt) + { + if (found[cnt] == NULL) + { + fprintf (stderr, gettext ("%s: no entry %s in archive!\n"), + AR, argv[cnt]); + status = 1; + } + + if (verbose) + printf ("m - %s\n", argv[cnt]); + } + } + else + { + /* Open all the new files, get their sizes and add all symbols. */ + for (int cnt = 0; cnt < argc; ++cnt) + { + const char *bname = basename (argv[cnt]); + size_t bnamelen = strlen (bname); + if (found[cnt] == NULL) + { + found[cnt] = alloca (sizeof (struct armem)); + found[cnt]->old_off = -1; + + remember_long_name (found[cnt], bname, bnamelen); + } + + struct stat newst; + Elf *newelf; + int newfd = open (argv[cnt], O_RDONLY); + if (newfd == -1) + { + error (0, errno, gettext ("cannot open %s"), argv[cnt]); + status = 1; + } + else if (fstat (newfd, &newst) == -1) + { + error (0, errno, gettext ("cannot stat %s"), argv[cnt]); + close (newfd); + status = 1; + } + else if (!S_ISREG (newst.st_mode)) + { + error (0, errno, gettext ("%s is no regular file"), argv[cnt]); + close (newfd); + status = 1; + } + else if (update_newer + && found[cnt]->old_off != -1l + && found[cnt]->sec > st.st_mtime) + /* Do nothing, the file in the archive is younger. */ + close (newfd); + else if ((newelf = elf_begin (newfd, ELF_C_READ_MMAP, NULL)) + == NULL) + { + fprintf (stderr, + gettext ("cannot get ELF descriptor for %s: %s\n"), + argv[cnt], elf_errmsg (-1)); + status = 1; + } + else + { + if (verbose) + printf ("%c - %s\n", + found[cnt]->old_off == -1l ? 'a' : 'r', argv[cnt]); + + found[cnt]->elf = newelf; + found[cnt]->sec = newst.st_mtime; + found[cnt]->uid = newst.st_uid; + found[cnt]->gid = newst.st_gid; + found[cnt]->mode = newst.st_mode; + found[cnt]->name = bname; + + found[cnt]->mem = elf_rawfile (newelf, &found[cnt]->size); + if (found[cnt] == NULL || elf_cntl (newelf, ELF_C_FDDONE) != 0) + error (EXIT_FAILURE, 0, gettext ("cannot read %s: %s"), + argv[cnt], elf_errmsg (-1)); + + close (newfd); + + if (found[cnt]->old_off != -1l) + /* Remember long file names. */ + remember_long_name (found[cnt], bname, bnamelen); + } + } + } + + if (status != 0) + { +#ifdef DEBUG + elf_end (elf); + + arlib_fini (); + + close (fd); +#endif + + return status; + } + + /* If we have no entry point so far add at the end. AFTER_MEMBERELEM + being NULL when adding before an entry means add at the beginning. */ + if (ipos != ipos_before && after_memberelem == NULL) + after_memberelem = all; + + /* Convert the circular list into a normal list first. */ + if (all != NULL) + { + struct armem *tmp = all; + all = all->next; + tmp->next = NULL; + } + + struct armem *last_added = after_memberelem; + for (int cnt = 0; cnt < argc; ++cnt) + if (oper != oper_replace || found[cnt]->old_off == -1) + { + if (last_added == NULL) + { + found[cnt]->next = all; + last_added = all = found[cnt]; + } + else + { + found[cnt]->next = last_added->next; + last_added = last_added->next = found[cnt]; + } + } + + /* Finally compute the offset and add the symbols for the files + after the insert point. */ + if (likely (all != NULL)) + for (struct armem *memp = all; memp != NULL; memp = memp->next) + { + memp->off = cur_off; + + if (memp->mem == NULL) + { + Elf_Arhdr *arhdr; + /* Fake initializing arhdr and subelf to keep gcc calm. */ + asm ("" : "=m" (arhdr), "=m" (subelf)); + if (elf_rand (elf, memp->old_off) == 0 + || (subelf = elf_begin (fd, ELF_C_READ_MMAP, elf)) == NULL + || (arhdr = elf_getarhdr (subelf)) == NULL) + /* This should never happen since we already looked at the + archive content. But who knows... */ + error (EXIT_FAILURE, 0, "%s: %s", arfname, elf_errmsg (-1)); + + arlib_add_symbols (subelf, arfname, arhdr->ar_name, cur_off); + + elf_end (subelf); + } + else + arlib_add_symbols (memp->elf, arfname, memp->name, cur_off); + + cur_off += (((memp->size + 1) & ~((off_t) 1)) + + sizeof (struct ar_hdr)); + } + + /* Now we have all the information for the symbol table and long + file name table. Construct the final layout. */ + arlib_finalize (); + + /* Create a new, temporary file in the same directory as the + original file. */ + char tmpfname[strlen (arfname) + 7]; + strcpy (stpcpy (tmpfname, arfname), "XXXXXX"); + int newfd; + if (fd != -1) + newfd = mkstemp (tmpfname); + else + { + newfd = open (arfname, O_RDWR | O_CREAT | O_EXCL, DEFFILEMODE); + if (newfd == -1 && errno == EEXIST) + /* Bah, first the file did not exist, now it does. Restart. */ + return do_oper_insert (oper, arfname, argv, argc, member); + } + if (unlikely (newfd == -1)) + goto nonew; + + /* Create the header. */ + if (unlikely (write_retry (newfd, ARMAG, SARMAG) != SARMAG)) + { + nonew_unlink: + if (fd != -1) + { + // XXX Use /prof/self/fd/%d ??? + unlink (tmpfname); + if (newfd != -1) + close (newfd); + } + nonew: + error (0, errno, gettext ("cannot create new file")); + status = 1; + goto errout; + } + + /* If the new archive is not empty we actually have something to do. */ + if (likely (all != NULL)) + { + /* Write the symbol table or the long file name table or both. */ + if (symtab.symsnamelen != 0 + && ((write_retry (newfd, symtab.symsoff, symtab.symsofflen) + != (ssize_t) symtab.symsofflen) + || (write_retry (newfd, symtab.symsname, symtab.symsnamelen) + != (ssize_t) symtab.symsnamelen))) + goto nonew_unlink; + + if (symtab.longnameslen > sizeof (struct ar_hdr) + && (write_retry (newfd, symtab.longnames, symtab.longnameslen) + != (ssize_t) symtab.longnameslen)) + goto nonew_unlink; + + off_t start = -1; + off_t len = -1; + + while (all != NULL) + { + if (all->mem != NULL) + { + /* This is a new file. If there is anything from the + archive left to be written do it now. */ + if (start != -1 && copy_content (elf, newfd, start, len)) + goto nonew_unlink; + + start = -1; + len = -1; + + /* Create the header. */ + struct ar_hdr arhdr; + char tmpbuf[sizeof (arhdr.ar_name) + 1]; + if (all->long_name_off == -1) + { + size_t namelen = strlen (all->name); + char *p = mempcpy (arhdr.ar_name, all->name, namelen); + *p++ = '/'; + memset (p, ' ', sizeof (arhdr.ar_name) - namelen - 1); + } + else + { + snprintf (tmpbuf, sizeof (arhdr.ar_name) + 1, "/%-*ld", + (int) sizeof (arhdr.ar_name), all->long_name_off); + memcpy (arhdr.ar_name, tmpbuf, sizeof (arhdr.ar_name)); + } + + no0print (false, arhdr.ar_date, sizeof (arhdr.ar_date), + all->sec); + no0print (false, arhdr.ar_uid, sizeof (arhdr.ar_uid), all->uid); + no0print (false, arhdr.ar_gid, sizeof (arhdr.ar_gid), all->gid); + no0print (true, arhdr.ar_mode, sizeof (arhdr.ar_mode), + all->mode); + no0print (false, arhdr.ar_size, sizeof (arhdr.ar_size), + all->size); + memcpy (arhdr.ar_fmag, ARFMAG, sizeof (arhdr.ar_fmag)); + + if (unlikely (write_retry (newfd, &arhdr, sizeof (arhdr)) + != sizeof (arhdr))) + goto nonew_unlink; + + /* Now the file itself. */ + if (unlikely (write_retry (newfd, all->mem, all->size) + != (off_t) all->size)) + goto nonew_unlink; + + /* Pad the file if its size is odd. */ + if ((all->size & 1) != 0) + if (unlikely (write_retry (newfd, "\n", 1) != 1)) + goto nonew_unlink; + } + else + { + /* This is a member from the archive. */ + if (write_member (all, &start, &len, elf, cur_off, newfd) + != 0) + goto nonew_unlink; + } + + all = all->next; + } + + /* Write the last part. */ + if (start != -1 && copy_content (elf, newfd, start, len)) + goto nonew_unlink; + } + + /* Set the mode of the new file to the same values the original file + has. */ + if (fd != -1 + && (fchmod (newfd, st.st_mode & ALLPERMS) != 0 + /* Never complain about fchown failing. */ + || (({asm ("" :: "r" (fchown (newfd, st.st_uid, st.st_gid))); }), + close (newfd) != 0) + || (newfd = -1, rename (tmpfname, arfname) != 0))) + goto nonew_unlink; + + errout: +#ifdef DEBUG + elf_end (elf); + + arlib_fini (); + + close (fd); +#endif + + return status; +} + + +#include "debugpred.h" diff --git a/src/arlib.c b/src/arlib.c new file mode 100644 index 00000000..af98454c --- /dev/null +++ b/src/arlib.c @@ -0,0 +1,279 @@ +/* Functions to handle creation of Linux archives. + Copyright (C) 2007 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <error.h> +#include <gelf.h> +#include <libintl.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +#include <system.h> + +#include "arlib.h" + + +/* The one symbol table we hanble. */ +struct arlib_symtab symtab; + + +/* Initialize ARLIB_SYMTAB structure. */ +void +arlib_init (void) +{ +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + obstack_init (&symtab.symsoffob); + obstack_init (&symtab.symsnameob); + obstack_init (&symtab.longnamesob); + + /* We add the archive header here as well, that avoids allocating + another memory block. */ + struct ar_hdr ar_hdr; + memcpy (ar_hdr.ar_name, "/ ", sizeof (ar_hdr.ar_name)); + /* Using snprintf here has a problem: the call always wants to add a + NUL byte. We could use a trick whereby we specify the target + buffer size longer than it is and this would not actually fail, + since all the fields are consecutive and we fill them in in + sequence (i.e., the NUL byte gets overwritten). But + _FORTIFY_SOURCE=2 would not let us play these games. Therefore + we play it safe. */ + char tmpbuf[sizeof (ar_hdr.ar_date) + 1]; + memcpy (ar_hdr.ar_date, tmpbuf, + snprintf (tmpbuf, sizeof (tmpbuf), "%-*lld", + (int) sizeof (ar_hdr.ar_date), + (long long int) time (NULL))); + assert ((sizeof (struct ar_hdr) % sizeof (uint32_t)) == 0); + + /* Note the string for the ar_uid and ar_gid cases is longer than + necessary. This does not matter since we copy only as much as + necessary but it helps the compiler to use the same string for + the ar_mode case. */ + memcpy (ar_hdr.ar_uid, "0 ", sizeof (ar_hdr.ar_uid)); + memcpy (ar_hdr.ar_gid, "0 ", sizeof (ar_hdr.ar_gid)); + memcpy (ar_hdr.ar_mode, "0 ", sizeof (ar_hdr.ar_mode)); + memcpy (ar_hdr.ar_fmag, ARFMAG, sizeof (ar_hdr.ar_fmag)); + + /* Add the archive header to the file content. */ + obstack_grow (&symtab.symsoffob, &ar_hdr, sizeof (ar_hdr)); + + /* The first word in the offset table specifies the size. Create + such an entry now. The real value will be filled-in later. For + all supported platforms the following is true. */ + assert (sizeof (uint32_t) == sizeof (int)); + obstack_int_grow (&symtab.symsoffob, 0); + + /* The long name obstack also gets its archive header. As above, + some of the input strings are longer than required but we only + copy the necessary part. */ + memcpy (ar_hdr.ar_name, "// ", sizeof (ar_hdr.ar_name)); + memcpy (ar_hdr.ar_date, " ", sizeof (ar_hdr.ar_date)); + memcpy (ar_hdr.ar_uid, " ", sizeof (ar_hdr.ar_uid)); + memcpy (ar_hdr.ar_gid, " ", sizeof (ar_hdr.ar_gid)); + memcpy (ar_hdr.ar_mode, " ", sizeof (ar_hdr.ar_mode)); + /* The ar_size field will be filled in later and ar_fmag is already OK. */ + obstack_grow (&symtab.longnamesob, &ar_hdr, sizeof (ar_hdr)); + + /* All other members are zero. */ + symtab.symsofflen = 0; + symtab.symsoff = NULL; + symtab.symsnamelen = 0; + symtab.symsname = NULL; +} + + +/* Finalize ARLIB_SYMTAB content. */ +void +arlib_finalize (void) +{ + char tmpbuf[sizeof (((struct ar_hdr *) NULL)->ar_size) + 1]; + + symtab.longnameslen = obstack_object_size (&symtab.longnamesob); + if (symtab.longnameslen != sizeof (struct ar_hdr)) + { + if ((symtab.longnameslen & 1) != 0) + { + /* Add one more byte to make length even. */ + obstack_grow (&symtab.longnamesob, "\n", 1); + ++symtab.longnameslen; + } + + symtab.longnames = obstack_finish (&symtab.longnamesob); + + memcpy (&((struct ar_hdr *) symtab.longnames)->ar_size, tmpbuf, + snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", + (int) sizeof (((struct ar_hdr *) NULL)->ar_size), + symtab.longnameslen - sizeof (struct ar_hdr))); + } + + symtab.symsofflen = obstack_object_size (&symtab.symsoffob); + assert (symtab.symsofflen % sizeof (uint32_t) == 0); + if (symtab.symsofflen != 0) + { + symtab.symsoff = (uint32_t *) obstack_finish (&symtab.symsoffob); + + /* Fill in the number of offsets now. */ + symtab.symsoff[AR_HDR_WORDS] = le_bswap_32 ((symtab.symsofflen + - sizeof (struct ar_hdr)) + / sizeof (uint32_t) - 1); + } + + symtab.symsnamelen = obstack_object_size (&symtab.symsnameob); + if ((symtab.symsnamelen & 1) != 0) + { + /* Add one more NUL byte to make length even. */ + obstack_grow (&symtab.symsnameob, "", 1); + ++symtab.symsnamelen; + } + symtab.symsname = obstack_finish (&symtab.symsnameob); + + /* Determine correction for the offsets in the symbol table. */ + off_t disp = 0; + if (symtab.symsnamelen > 0) + disp = symtab.symsofflen + symtab.symsnamelen; + if (symtab.longnameslen > sizeof (struct ar_hdr)) + disp += symtab.longnameslen; + + if (disp != 0 && symtab.symsoff != NULL) + { + uint32_t nsyms = le_bswap_32 (symtab.symsoff[AR_HDR_WORDS]); + + for (uint32_t cnt = 1; cnt <= nsyms; ++cnt) + { + uint32_t val = le_bswap_32 (symtab.symsoff[AR_HDR_WORDS + cnt]); + val += disp; + symtab.symsoff[AR_HDR_WORDS + cnt] = le_bswap_32 (val); + } + } + + /* See comment for ar_date above. */ + memcpy (&((struct ar_hdr *) symtab.symsoff)->ar_size, tmpbuf, + snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", + (int) sizeof (((struct ar_hdr *) NULL)->ar_size), + symtab.symsofflen + symtab.symsnamelen + - sizeof (struct ar_hdr))); +} + + +/* Free resources for ARLIB_SYMTAB. */ +void +arlib_fini (void) +{ + obstack_free (&symtab.symsoffob, NULL); + obstack_free (&symtab.symsnameob, NULL); + obstack_free (&symtab.longnamesob, NULL); +} + + +/* Add name a file offset of a symbol. */ +void +arlib_add_symref (const char *symname, off_t symoff) +{ + /* For all supported platforms the following is true. */ + assert (sizeof (uint32_t) == sizeof (int)); + obstack_int_grow (&symtab.symsoffob, (int) le_bswap_32 (symoff)); + + size_t symname_len = strlen (symname) + 1; + obstack_grow (&symtab.symsnameob, symname, symname_len); +} + + +/* Add symbols from ELF with value OFFSET to the symbol table SYMTAB. */ +void +arlib_add_symbols (Elf *elf, const char *arfname, const char *membername, + off_t off) +{ + if (sizeof (off) > sizeof (uint32_t) && off > ~((uint32_t) 0)) + /* The archive is too big. */ + error (EXIT_FAILURE, 0, gettext ("the archive '%s' is too large"), + arfname); + + /* We only add symbol tables for ELF files. It makes not much sense + to add symbols from executables but we do so for compatibility. + For DSOs and executables we use the dynamic symbol table, for + relocatable files all the DT_SYMTAB tables. */ + if (elf_kind (elf) != ELF_K_ELF) + return; + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot read ELF header of %s(%s): %s"), + arfname, membername, elf_errmsg (-1)); + + GElf_Word symtype; + if (ehdr->e_type == ET_REL) + symtype = SHT_SYMTAB; + else if (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN) + symtype = SHT_DYNSYM; + else + /* We do not handle that type. */ + return; + + /* Iterate over all sections. */ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + /* Get the section header. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + continue; + + if (shdr->sh_type != symtype) + continue; + + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + continue; + + int nsyms = shdr->sh_size / shdr->sh_entsize; + for (int ndx = shdr->sh_info; ndx < nsyms; ++ndx) + { + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (data, ndx, &sym_mem); + if (sym == NULL) + continue; + + /* Ignore undefined symbols. */ + if (sym->st_shndx == SHN_UNDEF) + continue; + + /* Use this symbol. */ + const char *symname = elf_strptr (elf, shdr->sh_link, sym->st_name); + if (symname != NULL) + arlib_add_symref (symname, off); + } + + /* Only relocatable files can have more than one symbol table. */ + if (ehdr->e_type != ET_REL) + break; + } +} diff --git a/src/arlib.h b/src/arlib.h new file mode 100644 index 00000000..fd26d248 --- /dev/null +++ b/src/arlib.h @@ -0,0 +1,96 @@ +/* Copyright (C) 2007 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _ARLIB_H +#define _ARLIB_H 1 + +#include <ar.h> +#include <byteswap.h> +#include <endian.h> +#include <libelf.h> +#include <obstack.h> +#include <stddef.h> +#include <stdint.h> +#include <sys/types.h> + + +/* Maximum length of a file name that fits directly into the ar header. + We cannot use the final byte since a / goes there. */ +#define MAX_AR_NAME_LEN (sizeof (((struct ar_hdr *) NULL)->ar_name) - 1) + + +/* Words matching in size to archive header. */ +#define AR_HDR_WORDS (sizeof (struct ar_hdr) / sizeof (uint32_t)) + + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define le_bswap_32(val) bswap_32 (val) +#else +# define le_bswap_32(val) (val) +#endif + + +/* Symbol table type. */ +struct arlib_symtab +{ + /* Symbol table handling. */ + struct obstack symsoffob; + struct obstack symsnameob; + size_t symsofflen; + uint32_t *symsoff; + size_t symsnamelen; + char *symsname; + + /* Long filename handling. */ + struct obstack longnamesob; + size_t longnameslen; + char *longnames; +}; + + +/* Global variable with symbol table. */ +extern struct arlib_symtab symtab; + + +/* Initialize ARLIB_SYMTAB structure. */ +extern void arlib_init (void); + +/* Finalize ARLIB_SYMTAB content. */ +extern void arlib_finalize (void); + +/* Free resources for ARLIB_SYMTAB. */ +extern void arlib_fini (void); + +/* Add symbols from ELF with value OFFSET to the symbol table SYMTAB. */ +extern void arlib_add_symbols (Elf *elf, const char *arfname, + const char *membername, off_t off); + +/* Add name a file offset of a symbol. */ +extern void arlib_add_symref (const char *symname, off_t symoff); + +/* Add long file name FILENAME of length FILENAMELEN to the symbol table + SYMTAB. Return the offset into the long file name table. */ +extern long int arlib_add_long_name (const char *filename, size_t filenamelen); + +#endif /* arlib.h */ diff --git a/src/arlib2.c b/src/arlib2.c new file mode 100644 index 00000000..7098fec1 --- /dev/null +++ b/src/arlib2.c @@ -0,0 +1,50 @@ +/* Functions to handle creation of Linux archives. + Copyright (C) 2007 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <error.h> +#include <libintl.h> +#include <limits.h> +#include <string.h> +#include <sys/param.h> + +#include "arlib.h" + + +/* Add long file name FILENAME of length FILENAMELEN to the symbol table + SYMTAB. Return the offset into the long file name table. */ +long int +arlib_add_long_name (const char *filename, size_t filenamelen) +{ + size_t size = obstack_object_size (&symtab.longnamesob); + + obstack_grow (&symtab.longnamesob, filename, filenamelen); + obstack_grow (&symtab.longnamesob, "/\n", 2); + + return size - sizeof (struct ar_hdr); +} diff --git a/src/debugpred.h b/src/debugpred.h new file mode 100644 index 00000000..867f4ace --- /dev/null +++ b/src/debugpred.h @@ -0,0 +1,53 @@ +/* Support to debug branch prediction. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <stdio.h> + +#if DEBUGPRED +extern const unsigned long int __start_predict_data; +extern const unsigned long int __stop_predict_data; +extern const unsigned long int __start_predict_line; +extern const char *__start_predict_file; + +static void +__attribute__ ((destructor)) +predprint (void) +{ + const unsigned long int *s = &__start_predict_data; + const unsigned long int *e = &__stop_predict_data; + const unsigned long int *sl = &__start_predict_line; + const char **sf = &__start_predict_file; + while (s < e) + { + if (s[0] != 0 || s[1] != 0) + printf ("%s:%lu: wrong=%lu, correct=%lu%s\n", *sf, *sl, s[0], s[1], + s[0] > s[1] ? " <==== WARNING" : ""); + ++sl; + ++sf; + s += 2; + } +} +#endif diff --git a/src/elf32-i386.script b/src/elf32-i386.script index d62333ac..a6cfffa1 100644 --- a/src/elf32-i386.script +++ b/src/elf32-i386.script @@ -18,7 +18,10 @@ SEGMENT [RX] #endif .interp; + .note.ABI-tag; + .note.gnu.build-id; .hash; + .gnu.hash; .dynsym; .dynstr; .gnu.version; @@ -47,6 +50,7 @@ SEGMENT [RX] *(.gnu.linkonce.r.*) } .rodata1; + .eh_frame_hdr; . = ALIGN(32 / 8); PROVIDE (__preinit_array_start = .); .preinit_array @@ -85,18 +89,24 @@ SEGMENT [RW] /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ . = ALIGN(PAGESIZE) + (. & (PAGESIZE - 1)); - .data - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - } - .data1; .eh_frame { KEEP (*(.eh_frame)) } .gcc_except_table; + .tdata + { + *(.tdata) + *(.tdata.*) + *(.gnu.linkone.td.*) + } + .tbss + { + *(.tbss) + *(.tbss.*) + *(.gnu.linkone.tb.*) + *(.tcommon) + } .ctors { /* gcc uses crtbegin.o to find the start of @@ -125,15 +135,19 @@ SEGMENT [RW] KEEP (*(.dtors)) } .jcr; - .got + .dynamic; + .got; + .got.plt; + .data { - *(.got.plt) - *(.got) + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) } - .dynamic; /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ + .data1; .sdata { *(.sdata) diff --git a/src/elfcmp.c b/src/elfcmp.c new file mode 100644 index 00000000..0e134df8 --- /dev/null +++ b/src/elfcmp.c @@ -0,0 +1,751 @@ +/* Compare relevant content of two ELF files. + Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <locale.h> +#include <libintl.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "../libelf/elf-knowledge.h" +#include "../libebl/libeblP.h" + + +/* Prototypes of local functions. */ +static Elf *open_file (const char *fname, int *fdp, Ebl **eblp); +static bool search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx); +static int regioncompare (const void *p1, const void *p2); + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +/* Values for the parameters which have no short form. */ +#define OPT_GAPS 0x100 +#define OPT_HASH_INEXACT 0x101 + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Control options:"), 0 }, + { "gaps", OPT_GAPS, "ACTION", 0, N_("Control treatment of gaps in loadable segments [ignore|match] (default: ignore)"), 0 }, + { "hash-inexact", OPT_HASH_INEXACT, NULL, 0, + N_("Ignore permutation of buckets in SHT_HASH section"), 0 }, + { "quiet", 'q', NULL, 0, N_("Output nothing; yield exit status only"), 0 }, + + { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("\ +Compare relevant parts of two ELF files for equality."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("FILE1 FILE2"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + options, parse_opt, args_doc, doc, NULL, NULL, NULL +}; + + +/* How to treat gaps in loadable segments. */ +static enum + { + gaps_ignore = 0, + gaps_match + } + gaps; + +/* Structure to hold information about used regions. */ +struct region +{ + GElf_Addr from; + GElf_Addr to; + struct region *next; +}; + +/* Nonzero if only exit status is wanted. */ +static bool quiet; + +/* True iff SHT_HASH treatment should be generous. */ +static bool hash_inexact; + +static bool hash_content_equivalent (size_t entsize, Elf_Data *, Elf_Data *); + + +int +main (int argc, char *argv[]) +{ + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + int remaining; + (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + /* We expect exactly two non-option parameters. */ + if (unlikely (remaining + 2 != argc)) + { + fputs (gettext ("Invalid number of parameters.\n"), stderr); + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); + exit (1); + } + + /* Comparing the files is done in two phases: + 1. compare all sections. Sections which are irrelevant (i.e., if + strip would remove them) are ignored. Some section types are + handled special. + 2. all parts of the loadable segments which are not parts of any + section is compared according to the rules of the --gaps option. + */ + int result = 0; + elf_version (EV_CURRENT); + + const char *const fname1 = argv[remaining]; + int fd1; + Ebl *ebl1; + Elf *elf1 = open_file (fname1, &fd1, &ebl1); + + const char *const fname2 = argv[remaining + 1]; + int fd2; + Ebl *ebl2; + Elf *elf2 = open_file (fname2, &fd2, &ebl2); + + GElf_Ehdr ehdr1_mem; + GElf_Ehdr *ehdr1 = gelf_getehdr (elf1, &ehdr1_mem); + if (ehdr1 == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"), + fname1, elf_errmsg (-1)); + GElf_Ehdr ehdr2_mem; + GElf_Ehdr *ehdr2 = gelf_getehdr (elf2, &ehdr2_mem); + if (ehdr2 == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"), + fname2, elf_errmsg (-1)); + + /* Compare the ELF headers. */ + if (unlikely (memcmp (ehdr1->e_ident, ehdr2->e_ident, EI_NIDENT) != 0 + || ehdr1->e_type != ehdr2->e_type + || ehdr1->e_machine != ehdr2->e_machine + || ehdr1->e_version != ehdr2->e_version + || ehdr1->e_entry != ehdr2->e_entry + || ehdr1->e_phoff != ehdr2->e_phoff + || ehdr1->e_flags != ehdr2->e_flags + || ehdr1->e_ehsize != ehdr2->e_ehsize + || ehdr1->e_phentsize != ehdr2->e_phentsize + || ehdr1->e_phnum != ehdr2->e_phnum + || ehdr1->e_shentsize != ehdr2->e_shentsize)) + { + if (! quiet) + error (0, 0, gettext ("%s %s diff: ELF header"), fname1, fname2); + result = 1; + goto out; + } + + /* Iterate over all sections. We expect the sections in the two + files to match exactly. */ + Elf_Scn *scn1 = NULL; + Elf_Scn *scn2 = NULL; + struct region *regions = NULL; + size_t nregions = 0; + while (1) + { + GElf_Shdr shdr1_mem; + GElf_Shdr *shdr1; + const char *sname1 = NULL; + do + { + scn1 = elf_nextscn (elf1, scn1); + shdr1 = gelf_getshdr (scn1, &shdr1_mem); + if (shdr1 != NULL) + sname1 = elf_strptr (elf1, ehdr1->e_shstrndx, shdr1->sh_name); + } + while (scn1 != NULL + && ebl_section_strip_p (ebl1, ehdr1, shdr1, sname1, true, false)); + + GElf_Shdr shdr2_mem; + GElf_Shdr *shdr2; + const char *sname2 = NULL; + do + { + scn2 = elf_nextscn (elf2, scn2); + shdr2 = gelf_getshdr (scn2, &shdr2_mem); + if (shdr2 != NULL) + sname2 = elf_strptr (elf2, ehdr2->e_shstrndx, shdr2->sh_name); + } + while (scn2 != NULL + && ebl_section_strip_p (ebl2, ehdr2, shdr2, sname2, true, false)); + + if (scn1 == NULL || scn2 == NULL) + break; + + if (gaps != gaps_ignore && (shdr1->sh_flags & SHF_ALLOC) != 0) + { + struct region *newp = (struct region *) alloca (sizeof (*newp)); + newp->from = shdr1->sh_offset; + newp->to = shdr1->sh_offset + shdr1->sh_size; + newp->next = regions; + regions = newp; + + ++nregions; + } + + /* Compare the headers. We allow the name to be at a different + location. */ + if (unlikely (strcmp (sname1, sname2) != 0)) + { + header_mismatch: + error (0, 0, gettext ("%s %s differ: section header"), + fname1, fname2); + result = 1; + goto out; + } + + /* We ignore certain sections. */ + if (strcmp (sname1, ".gnu_debuglink") == 0 + || strcmp (sname1, ".gnu.prelink_undo") == 0) + continue; + + if (shdr1->sh_type != shdr2->sh_type + // XXX Any flags which should be ignored? + || shdr1->sh_flags != shdr2->sh_flags + || shdr1->sh_addr != shdr2->sh_addr + || (shdr1->sh_offset != shdr2->sh_offset + && (shdr1->sh_flags & SHF_ALLOC) + && ehdr1->e_type != ET_REL) + || shdr1->sh_size != shdr2->sh_size + || shdr1->sh_link != shdr2->sh_link + || shdr1->sh_info != shdr2->sh_info + || shdr1->sh_addralign != shdr2->sh_addralign + || shdr1->sh_entsize != shdr2->sh_entsize) + goto header_mismatch; + + Elf_Data *data1 = elf_getdata (scn1, NULL); + if (data1 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get content of section %zu in '%s': %s"), + elf_ndxscn (scn1), fname1, elf_errmsg (-1)); + + Elf_Data *data2 = elf_getdata (scn2, NULL); + if (data2 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get content of section %zu in '%s': %s"), + elf_ndxscn (scn2), fname2, elf_errmsg (-1)); + + switch (shdr1->sh_type) + { + case SHT_DYNSYM: + case SHT_SYMTAB: + /* Iterate over the symbol table. We ignore the st_size + value of undefined symbols. */ + for (int ndx = 0; ndx < (int) (shdr1->sh_size / shdr1->sh_entsize); + ++ndx) + { + GElf_Sym sym1_mem; + GElf_Sym *sym1 = gelf_getsym (data1, ndx, &sym1_mem); + if (sym1 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get symbol in '%s': %s"), + fname1, elf_errmsg (-1)); + GElf_Sym sym2_mem; + GElf_Sym *sym2 = gelf_getsym (data2, ndx, &sym2_mem); + if (sym2 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get symbol in '%s': %s"), + fname2, elf_errmsg (-1)); + + const char *name1 = elf_strptr (elf1, shdr1->sh_link, + sym1->st_name); + const char *name2 = elf_strptr (elf2, shdr2->sh_link, + sym2->st_name); + if (unlikely (strcmp (name1, name2) != 0 + || sym1->st_value != sym2->st_value + || (sym1->st_size != sym2->st_size + && sym1->st_shndx != SHN_UNDEF) + || sym1->st_info != sym2->st_info + || sym1->st_other != sym2->st_other + || sym1->st_shndx != sym1->st_shndx)) + { + // XXX Do we want to allow reordered symbol tables? + symtab_mismatch: + if (! quiet) + { + if (elf_ndxscn (scn1) == elf_ndxscn (scn2)) + error (0, 0, + gettext ("%s %s differ: symbol table [%zu]"), + fname1, fname2, elf_ndxscn (scn1)); + else + error (0, 0, gettext ("\ +%s %s differ: symbol table [%zu,%zu]"), + fname1, fname2, elf_ndxscn (scn1), + elf_ndxscn (scn2)); + } + result = 1; + goto out; + } + + if (sym1->st_shndx == SHN_UNDEF + && sym1->st_size != sym2->st_size) + { + /* The size of the symbol in the object defining it + might have changed. That is OK unless the symbol + is used in a copy relocation. Look over the + sections in both files and determine which + relocation section uses this symbol table + section. Then look through the relocations to + see whether any copy relocation references this + symbol. */ + if (search_for_copy_reloc (ebl1, elf_ndxscn (scn1), ndx) + || search_for_copy_reloc (ebl2, elf_ndxscn (scn2), ndx)) + goto symtab_mismatch; + } + } + break; + + default: + /* Compare the section content byte for byte. */ + assert (shdr1->sh_type == SHT_NOBITS + || (data1->d_buf != NULL || data1->d_size == 0)); + assert (shdr2->sh_type == SHT_NOBITS + || (data2->d_buf != NULL || data1->d_size == 0)); + + if (unlikely (data1->d_size != data2->d_size + || (shdr1->sh_type != SHT_NOBITS + && memcmp (data1->d_buf, data2->d_buf, + data1->d_size) != 0))) + { + if (hash_inexact + && shdr1->sh_type == SHT_HASH + && data1->d_size == data2->d_size + && hash_content_equivalent (shdr1->sh_entsize, data1, data2)) + break; + + if (! quiet) + { + if (elf_ndxscn (scn1) == elf_ndxscn (scn2)) + error (0, 0, gettext ("\ +%s %s differ: section [%zu] '%s' content"), + fname1, fname2, elf_ndxscn (scn1), sname1); + else + error (0, 0, gettext ("\ +%s %s differ: section [%zu,%zu] '%s' content"), + fname1, fname2, elf_ndxscn (scn1), + elf_ndxscn (scn2), sname1); + } + result = 1; + goto out; + } + break; + } + } + + if (unlikely (scn1 != scn2)) + { + if (! quiet) + error (0, 0, + gettext ("%s %s differ: unequal amount of important sections"), + fname1, fname2); + result = 1; + goto out; + } + + /* We we look at gaps, create artificial ones for the parts of the + program which we are not in sections. */ + struct region ehdr_region; + struct region phdr_region; + if (gaps != gaps_ignore) + { + ehdr_region.from = 0; + ehdr_region.to = ehdr1->e_ehsize; + ehdr_region.next = &phdr_region; + + phdr_region.from = ehdr1->e_phoff; + phdr_region.to = ehdr1->e_phoff + ehdr1->e_phnum * ehdr1->e_phentsize; + phdr_region.next = regions; + + regions = &ehdr_region; + nregions += 2; + } + + /* If we need to look at the gaps we need access to the file data. */ + char *raw1 = NULL; + size_t size1 = 0; + char *raw2 = NULL; + size_t size2 = 0; + struct region *regionsarr = alloca (nregions * sizeof (struct region)); + if (gaps != gaps_ignore) + { + raw1 = elf_rawfile (elf1, &size1); + if (raw1 == NULL ) + error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"), + fname1, elf_errmsg (-1)); + + raw2 = elf_rawfile (elf2, &size2); + if (raw2 == NULL ) + error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"), + fname2, elf_errmsg (-1)); + + for (size_t cnt = 0; cnt < nregions; ++cnt) + { + regionsarr[cnt] = *regions; + regions = regions->next; + } + + qsort (regionsarr, nregions, sizeof (regionsarr[0]), regioncompare); + } + + /* Compare the program header tables. */ + for (int ndx = 0; ndx < ehdr1->e_phnum; ++ndx) + { + GElf_Phdr phdr1_mem; + GElf_Phdr *phdr1 = gelf_getphdr (elf1, ndx, &phdr1_mem); + if (ehdr1 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get program header entry %d of '%s': %s"), + ndx, fname1, elf_errmsg (-1)); + GElf_Phdr phdr2_mem; + GElf_Phdr *phdr2 = gelf_getphdr (elf2, ndx, &phdr2_mem); + if (ehdr2 == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get program header entry %d of '%s': %s"), + ndx, fname2, elf_errmsg (-1)); + + if (unlikely (memcmp (phdr1, phdr2, sizeof (GElf_Phdr)) != 0)) + { + if (! quiet) + error (0, 0, gettext ("%s %s differ: program header %d"), + fname1, fname2, ndx); + result = 1; + goto out; + } + + if (gaps != gaps_ignore && phdr1->p_type == PT_LOAD) + { + size_t cnt = 0; + while (cnt < nregions && regionsarr[cnt].to < phdr1->p_offset) + ++cnt; + + GElf_Off last = phdr1->p_offset; + GElf_Off end = phdr1->p_offset + phdr1->p_filesz; + while (cnt < nregions && regionsarr[cnt].from < end) + { + if (last < regionsarr[cnt].from) + { + /* Compare the [LAST,FROM) region. */ + assert (gaps == gaps_match); + if (unlikely (memcmp (raw1 + last, raw2 + last, + regionsarr[cnt].from - last) != 0)) + { + gapmismatch: + if (!quiet) + error (0, 0, gettext ("%s %s differ: gap"), + fname1, fname2); + result = 1; + goto out; + } + + } + last = regionsarr[cnt].to; + ++cnt; + } + + if (cnt == nregions && last < end) + goto gapmismatch; + } + } + + out: + elf_end (elf1); + elf_end (elf2); + close (fd1); + close (fd2); + + return result; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "elfcmp (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case 'q': + quiet = true; + break; + + case OPT_GAPS: + if (strcasecmp (arg, "ignore") == 0) + gaps = gaps_ignore; + else if (likely (strcasecmp (arg, "match") == 0)) + gaps = gaps_match; + else + { + fprintf (stderr, + gettext ("Invalid value '%s' for --gaps parameter."), + arg); + argp_help (&argp, stderr, ARGP_HELP_SEE, + program_invocation_short_name); + exit (1); + } + break; + + case OPT_HASH_INEXACT: + hash_inexact = true; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +static Elf * +open_file (const char *fname, int *fdp, Ebl **eblp) +{ + int fd = open (fname, O_RDONLY); + if (unlikely (fd == -1)) + error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"), fname); + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot create ELF descriptor for '%s': %s"), + fname, elf_errmsg (-1)); + Ebl *ebl = ebl_openbackend (elf); + if (ebl == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot create EBL descriptor for '%s'"), fname); + + *fdp = fd; + *eblp = ebl; + return elf; +} + + +static bool +search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx) +{ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header of section %zu: %s"), + elf_ndxscn (scn), elf_errmsg (-1)); + + if ((shdr->sh_type != SHT_REL && shdr->sh_type != SHT_RELA) + || shdr->sh_link != scnndx) + continue; + + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot get content of section %zu: %s"), + elf_ndxscn (scn), elf_errmsg (-1)); + + if (shdr->sh_type == SHT_REL) + for (int ndx = 0; ndx < (int) (shdr->sh_size / shdr->sh_entsize); + ++ndx) + { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel (data, ndx, &rel_mem); + if (rel == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot get relocation: %s"), + elf_errmsg (-1)); + + if ((int) GELF_R_SYM (rel->r_info) == symndx + && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rel->r_info))) + return true; + } + else + for (int ndx = 0; ndx < (int) (shdr->sh_size / shdr->sh_entsize); + ++ndx) + { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (data, ndx, &rela_mem); + if (rela == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot get relocation: %s"), + elf_errmsg (-1)); + + if ((int) GELF_R_SYM (rela->r_info) == symndx + && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rela->r_info))) + return true; + } + } + + return false; +} + + +static int +regioncompare (const void *p1, const void *p2) +{ + const struct region *r1 = (const struct region *) p1; + const struct region *r2 = (const struct region *) p2; + + if (r1->from < r2->from) + return -1; + return 1; +} + + +static int +compare_Elf32_Word (const void *p1, const void *p2) +{ + const Elf32_Word *w1 = p1; + const Elf32_Word *w2 = p2; + assert (sizeof (int) >= sizeof (*w1)); + return (int) *w1 - (int) *w2; +} + +static int +compare_Elf64_Xword (const void *p1, const void *p2) +{ + const Elf64_Xword *w1 = p1; + const Elf64_Xword *w2 = p2; + return *w1 < *w2 ? -1 : *w1 > *w2 ? 1 : 0; +} + +static bool +hash_content_equivalent (size_t entsize, Elf_Data *data1, Elf_Data *data2) +{ +#define CHECK_HASH(Hash_Word) \ + { \ + const Hash_Word *const hash1 = data1->d_buf; \ + const Hash_Word *const hash2 = data2->d_buf; \ + const size_t nbucket = hash1[0]; \ + const size_t nchain = hash1[1]; \ + if (data1->d_size != (2 + nbucket + nchain) * sizeof hash1[0] \ + || hash2[0] != nbucket || hash2[1] != nchain) \ + return false; \ + \ + const Hash_Word *const bucket1 = &hash1[2]; \ + const Hash_Word *const chain1 = &bucket1[nbucket]; \ + const Hash_Word *const bucket2 = &hash2[2]; \ + const Hash_Word *const chain2 = &bucket2[nbucket]; \ + \ + bool chain_ok[nchain]; \ + Hash_Word temp1[nchain - 1]; \ + Hash_Word temp2[nchain - 1]; \ + memset (chain_ok, 0, sizeof chain_ok); \ + for (size_t i = 0; i < nbucket; ++i) \ + { \ + if (bucket1[i] >= nchain || bucket2[i] >= nchain) \ + return false; \ + \ + size_t b1 = 0; \ + for (size_t p = bucket1[i]; p != STN_UNDEF; p = chain1[p]) \ + if (p >= nchain || b1 >= nchain - 1) \ + return false; \ + else \ + temp1[b1++] = p; \ + \ + size_t b2 = 0; \ + for (size_t p = bucket2[i]; p != STN_UNDEF; p = chain2[p]) \ + if (p >= nchain || b2 >= nchain - 1) \ + return false; \ + else \ + temp2[b2++] = p; \ + \ + if (b1 != b2) \ + return false; \ + \ + qsort (temp1, b1, sizeof temp1[0], compare_##Hash_Word); \ + qsort (temp2, b2, sizeof temp2[0], compare_##Hash_Word); \ + \ + for (b1 = 0; b1 < b2; ++b1) \ + if (temp1[b1] != temp2[b1]) \ + return false; \ + else \ + chain_ok[temp1[b1]] = true; \ + } \ + \ + for (size_t i = 0; i < nchain; ++i) \ + if (!chain_ok[i] && chain1[i] != chain2[i]) \ + return false; \ + \ + return true; \ + } + + switch (entsize) + { + case 4: + CHECK_HASH (Elf32_Word); + break; + case 8: + CHECK_HASH (Elf64_Xword); + break; + } + + return false; +} + + +#include "debugpred.h" diff --git a/src/elflint.c b/src/elflint.c index d66cdd13..bc4219b3 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -1,16 +1,28 @@ /* Pedantic checking of ELF files compliance with gABI/psABI spec. - Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,7 +36,6 @@ #include <fcntl.h> #include <gelf.h> #include <inttypes.h> -#include <libebl.h> #include <libintl.h> #include <locale.h> #include <stdbool.h> @@ -35,12 +46,20 @@ #include <elf-knowledge.h> #include <system.h> +#include "../libelf/libelfP.h" +#include "../libelf/common.h" +#include "../libebl/libeblP.h" +#include "../libdw/libdwP.h" +#include "../libdwfl/libdwflP.h" +#include "../libdw/memory-access.h" /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; #define ARGP_strict 300 #define ARGP_gnuld 301 @@ -50,12 +69,13 @@ static const struct argp_option options[] = { { "strict", ARGP_strict, NULL, 0, - N_("Be extremely strict, flag level 2 features.") }, - { "quiet", 'q', NULL, 0, N_("Do not print anything if successful") }, + N_("Be extremely strict, flag level 2 features."), 0 }, + { "quiet", 'q', NULL, 0, N_("Do not print anything if successful"), 0 }, + { "debuginfo", 'd', NULL, 0, N_("Binary is a separate debuginfo file"), 0 }, { "gnu-ld", ARGP_gnuld, NULL, 0, N_("Binary has been created with GNU ld and is therefore known to be \ -broken in certain ways") }, - { NULL, 0, NULL, 0, NULL } +broken in certain ways"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } }; /* Short description of program. */ @@ -68,13 +88,10 @@ static const char args_doc[] = N_("FILE..."); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp = { - options, parse_opt, args_doc, doc, NULL, more_help + options, parse_opt, args_doc, doc, NULL, NULL, NULL }; @@ -84,6 +101,9 @@ static void process_file (int fd, Elf *elf, const char *prefix, bool only_one); static void process_elf_file (Elf *elf, const char *prefix, const char *suffix, const char *fname, size_t size, bool only_one); +static void check_note_section (Ebl *ebl, GElf_Ehdr *ehdr, + GElf_Shdr *shdr, int idx); + /* Report an error. */ #define ERROR(str, args...) \ @@ -91,7 +111,7 @@ static void process_elf_file (Elf *elf, const char *prefix, const char *suffix, printf (str, ##args); \ ++error_count; \ } while (0) -static int error_count; +static unsigned int error_count; /* True if we should perform very strict testing. */ static bool be_strict; @@ -99,6 +119,9 @@ static bool be_strict; /* True if no message is to be printed if the run is succesful. */ static bool be_quiet; +/* True if binary is from strip -f, not a normal ELF file. */ +static bool is_debuginfo; + /* True if binary is assumed to be generated with GNU ld. */ static bool gnuld; @@ -112,38 +135,25 @@ static int *scnref; int main (int argc, char *argv[]) { - int remaining; - bool only_one; - /* Set locale. */ setlocale (LC_ALL, ""); /* Initialize the message catalog. */ - textdomain (PACKAGE); + textdomain (PACKAGE_TARNAME); /* Parse and process arguments. */ + int remaining; argp_parse (&argp, argc, argv, 0, &remaining, NULL); - /* If no ELF file is given punt. */ - if (remaining >= argc) - { - argp_help (&argp, stdout, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, - program_invocation_short_name); - exit (1); - } - /* Before we start tell the ELF library which version we are using. */ elf_version (EV_CURRENT); /* Now process all the files given at the command line. */ - only_one = remaining + 1 == argc; + bool only_one = remaining + 1 == argc; do { - int fd; - Elf *elf; - /* Open the file. */ - fd = open (argv[remaining], O_RDONLY); + int fd = open (argv[remaining], O_RDONLY); if (fd == -1) { error (0, errno, gettext ("cannot open input file")); @@ -151,7 +161,7 @@ main (int argc, char *argv[]) } /* Create an `Elf' descriptor. */ - elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); if (elf == NULL) ERROR (gettext ("cannot generate Elf descriptor: %s\n"), elf_errmsg (-1)); @@ -189,7 +199,8 @@ main (int argc, char *argv[]) /* Handle program arguments. */ static error_t -parse_opt (int key, char *arg, struct argp_state *state) +parse_opt (int key, char *arg __attribute__ ((unused)), + struct argp_state *state __attribute__ ((unused))) { switch (key) { @@ -201,10 +212,19 @@ parse_opt (int key, char *arg, struct argp_state *state) be_quiet = true; break; + case 'd': + is_debuginfo = true; + case ARGP_gnuld: gnuld = true; break; + case ARGP_KEY_NO_ARGS: + fputs (gettext ("Missing file name.\n"), stderr); + argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, + program_invocation_short_name); + exit (1); + default: return ARGP_ERR_UNKNOWN; } @@ -212,37 +232,16 @@ parse_opt (int key, char *arg, struct argp_state *state) } -static char * -more_help (int key, const char *text, void *input) -{ - char *buf; - - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - - default: - break; - } - return (char *) text; -} - - /* Print the version information. */ static void -print_version (FILE *stream, struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "elflint (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "elflint (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -310,14 +309,14 @@ process_file (int fd, Elf *elf, const char *prefix, const char *suffix, default: /* We cannot do anything. */ ERROR (gettext ("\ -Not an ELF file - it has the wrong magic bytes at the start")); +Not an ELF file - it has the wrong magic bytes at the start\n")); break; } } static const char * -section_name (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +section_name (Ebl *ebl, int idx) { GElf_Shdr shdr_mem; GElf_Shdr *shdr; @@ -340,7 +339,7 @@ static const int valid_e_machine[] = EM_68HC16, EM_68HC11, EM_68HC08, EM_68HC05, EM_SVX, EM_ST19, EM_VAX, EM_CRIS, EM_JAVELIN, EM_FIREPATH, EM_ZSP, EM_MMIX, EM_HUANY, EM_PRISM, EM_AVR, EM_FR30, EM_D10V, EM_D30V, EM_V850, EM_M32R, EM_MN10300, - EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA + EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA, EM_ALPHA }; #define nvalid_e_machine \ (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) @@ -382,7 +381,7 @@ check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size) /* We currently don't handle any OS ABIs. */ if (ehdr->e_ident[EI_OSABI] != ELFOSABI_NONE) - ERROR (gettext ("unsupported OS ABI e_ident[%d] == \"%s\"\n"), + ERROR (gettext ("unsupported OS ABI e_ident[%d] == '%s'\n"), EI_OSABI, ebl_osabi_name (ebl, ehdr->e_ident[EI_OSABI], buf, sizeof (buf))); @@ -441,9 +440,7 @@ executables and DSOs cannot have zero program header offset\n")); /* Get the header of the zeroth section. The sh_size field might contain the section number. */ GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - - shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); if (shdr != NULL) { /* The error will be reported later. */ @@ -460,17 +457,9 @@ invalid number of section header table entries\n")); /* Get the header of the zeroth section. The sh_size field might contain the section number. */ GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - - shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); - if (shdr != NULL) - { - /* The error will be reported later. */ - if (shdr->sh_link >= shnum) - ERROR (gettext ("invalid section header index\n")); - else - shstrndx = shdr->sh_link; - } + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + if (shdr != NULL && shdr->sh_link < shnum) + shstrndx = shdr->sh_link; } else if (shstrndx >= shnum) ERROR (gettext ("invalid section header index\n")); @@ -522,7 +511,7 @@ invalid number of section header table entries\n")); /* Check that there is a section group section with index < IDX which contains section IDX and that there is exactly one. */ static void -check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_scn_group (Ebl *ebl, int idx) { if (scnref[idx] == 0) { @@ -532,15 +521,9 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx) for (cnt = idx + 1; cnt < shnum; ++cnt) { - Elf_Scn *scn; + Elf_Scn *scn = elf_getscn (ebl->elf, cnt); GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - Elf_Data *data; - Elf32_Word *grpdata; - size_t inner; - - scn = elf_getscn (ebl->elf, cnt); - shdr = gelf_getshdr (scn, &shdr_mem); + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr == NULL) /* We cannot get the section header so we cannot check it. The error to get the section header will be shown @@ -550,13 +533,14 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx) if (shdr->sh_type != SHT_GROUP) continue; - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL || data->d_size < sizeof (Elf32_Word)) /* Cannot check the section. */ continue; - grpdata = (Elf32_Word *) data->d_buf; - for (inner = 1; inner < data->d_size / sizeof (Elf32_Word); ++inner) + Elf32_Word *grpdata = (Elf32_Word *) data->d_buf; + for (size_t inner = 1; inner < data->d_size / sizeof (Elf32_Word); + ++inner) if (grpdata[inner] == (Elf32_Word) idx) goto out; } @@ -565,74 +549,74 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx) if (cnt == shnum) ERROR (gettext ("\ section [%2d] '%s': section with SHF_GROUP flag set not part of a section group\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); else ERROR (gettext ("\ section [%2d] '%s': section group [%2zu] '%s' does not preceed group member\n"), - idx, section_name (ebl, ehdr, idx), - cnt, section_name (ebl, ehdr, cnt)); + idx, section_name (ebl, idx), + cnt, section_name (ebl, cnt)); } } static void -check_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_symtab (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { bool no_xndx_warned = false; int no_pt_tls = 0; - - Elf_Scn *scn = elf_getscn (ebl->elf, idx); - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - GElf_Shdr strshdr_mem; - GElf_Shdr *strshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), - &strshdr_mem); - if (shdr == NULL || strshdr == NULL) - return; - Elf_Data *data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (data == NULL) { ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); return; } + GElf_Shdr strshdr_mem; + GElf_Shdr *strshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + &strshdr_mem); + if (strshdr == NULL) + return; + if (strshdr->sh_type != SHT_STRTAB) - ERROR (gettext ("section [%2d] '%s': referenced as string table for section [%2d] '%s' but type is not SHT_STRTAB\n"), - shdr->sh_link, section_name (ebl, ehdr, shdr->sh_link), - idx, section_name (ebl, ehdr, idx)); + { + ERROR (gettext ("section [%2d] '%s': referenced as string table for section [%2d] '%s' but type is not SHT_STRTAB\n"), + shdr->sh_link, section_name (ebl, shdr->sh_link), + idx, section_name (ebl, idx)); + strshdr = NULL; + } /* Search for an extended section index table section. */ - size_t cnt; - GElf_Shdr xndxshdr_mem; - GElf_Shdr *xndxshdr = NULL; Elf_Data *xndxdata = NULL; Elf32_Word xndxscnidx = 0; - for (cnt = 1; cnt < shnum; ++cnt) + bool found_xndx = false; + for (size_t cnt = 1; cnt < shnum; ++cnt) if (cnt != (size_t) idx) { Elf_Scn *xndxscn = elf_getscn (ebl->elf, cnt); - xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem); - xndxdata = elf_getdata (xndxscn, NULL); - xndxscnidx = elf_ndxscn (xndxscn); - - if (xndxshdr == NULL || xndxdata == NULL) + GElf_Shdr xndxshdr_mem; + GElf_Shdr *xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem); + if (xndxshdr == NULL) continue; if (xndxshdr->sh_type == SHT_SYMTAB_SHNDX && xndxshdr->sh_link == (GElf_Word) idx) - break; + { + if (found_xndx) + ERROR (gettext ("\ +section [%2d] '%s': symbol table cannot have more than one extended index section\n"), + idx, section_name (ebl, idx)); + + xndxdata = elf_getdata (xndxscn, NULL); + xndxscnidx = elf_ndxscn (xndxscn); + found_xndx = true; + } } - if (cnt == shnum) - { - xndxshdr = NULL; - xndxdata = NULL; - } if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT)) ERROR (gettext ("\ -section [%2zu] '%s': entry size is does not match ElfXX_Sym\n"), - cnt, section_name (ebl, ehdr, cnt)); +section [%2u] '%s': entry size is does not match ElfXX_Sym\n"), + idx, section_name (ebl, idx)); /* Test the zeroth entry. */ GElf_Sym sym_mem; @@ -640,48 +624,50 @@ section [%2zu] '%s': entry size is does not match ElfXX_Sym\n"), GElf_Sym *sym = gelf_getsymshndx (data, xndxdata, 0, &sym_mem, &xndx); if (sym == NULL) ERROR (gettext ("section [%2d] '%s': cannot get symbol %d: %s\n"), - idx, section_name (ebl, ehdr, idx), 0, elf_errmsg (-1)); + idx, section_name (ebl, idx), 0, elf_errmsg (-1)); else { if (sym->st_name != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_name"); + idx, section_name (ebl, idx), "st_name"); if (sym->st_value != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_value"); + idx, section_name (ebl, idx), "st_value"); if (sym->st_size != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_size"); + idx, section_name (ebl, idx), "st_size"); if (sym->st_info != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_info"); + idx, section_name (ebl, idx), "st_info"); if (sym->st_other != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_other"); + idx, section_name (ebl, idx), "st_other"); if (sym->st_shndx != 0) ERROR (gettext ("section [%2d] '%s': '%s' in zeroth entry not zero\n"), - idx, section_name (ebl, ehdr, idx), "st_shndx"); + idx, section_name (ebl, idx), "st_shndx"); if (xndxdata != NULL && xndx != 0) ERROR (gettext ("\ section [%2d] '%s': XINDEX for zeroth entry not zero\n"), - xndxscnidx, section_name (ebl, ehdr, xndxscnidx)); + xndxscnidx, section_name (ebl, xndxscnidx)); } - for (cnt = 1; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) + for (size_t cnt = 1; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx); if (sym == NULL) { ERROR (gettext ("section [%2d] '%s': cannot get symbol %zu: %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, elf_errmsg (-1)); + idx, section_name (ebl, idx), cnt, elf_errmsg (-1)); continue; } const char *name = NULL; - if (sym->st_name >= strshdr->sh_size) + if (strshdr == NULL) + name = ""; + else if (sym->st_name >= strshdr->sh_size) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: invalid name value\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); else { name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); @@ -694,13 +680,13 @@ section [%2d] '%s': symbol %zu: invalid name value\n"), { ERROR (gettext ("\ section [%2d] '%s': symbol %zu: too large section index but no extended section index section\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); no_xndx_warned = true; } else if (xndx < SHN_LORESERVE) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: XINDEX used for index which would fit in st_shndx (%" PRIu32 ")\n"), - xndxscnidx, section_name (ebl, ehdr, xndxscnidx), cnt, + xndxscnidx, section_name (ebl, xndxscnidx), cnt, xndx); } else if ((sym->st_shndx >= SHN_LORESERVE @@ -712,18 +698,19 @@ section [%2d] '%s': symbol %zu: XINDEX used for index which would fit in st_shnd /* || sym->st_shndx > SHN_HIRESERVE always false */))) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: invalid section index\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); else xndx = sym->st_shndx; - if (GELF_ST_TYPE (sym->st_info) >= STT_NUM) + if (GELF_ST_TYPE (sym->st_info) >= STT_NUM + && !ebl_symbol_type_name (ebl, GELF_ST_TYPE (sym->st_info), NULL, 0)) ERROR (gettext ("section [%2d] '%s': symbol %zu: unknown type\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (GELF_ST_BIND (sym->st_info) >= STB_NUM) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: unknown symbol binding\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (xndx == SHN_COMMON) { @@ -731,15 +718,15 @@ section [%2d] '%s': symbol %zu: unknown symbol binding\n"), if (ehdr->e_type != ET_REL) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: COMMON only allowed in relocatable files\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (cnt < shdr->sh_info) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: local COMMON symbols are nonsense\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (GELF_R_TYPE (sym->st_info) == STT_FUNC) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); } else if (xndx > 0 && xndx < shnum) { @@ -749,26 +736,45 @@ section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n"), destshdr = gelf_getshdr (elf_getscn (ebl->elf, xndx), &destshdr_mem); if (destshdr != NULL) { + GElf_Addr sh_addr = (ehdr->e_type == ET_REL ? 0 + : destshdr->sh_addr); if (GELF_ST_TYPE (sym->st_info) != STT_TLS) { - if ((sym->st_value - destshdr->sh_addr) > destshdr->sh_size) - ERROR (gettext ("\ + if (! ebl_check_special_symbol (ebl, ehdr, sym, name, + destshdr)) + { + if (sym->st_value - sh_addr > destshdr->sh_size) + { + /* GNU ld has severe bugs. When it decides to remove + empty sections it leaves symbols referencing them + behind. These are symbols in .symtab. */ + if (!gnuld + || strcmp (section_name (ebl, idx), ".symtab") + || (strcmp (name, "__preinit_array_start") != 0 + && strcmp (name, "__preinit_array_end") != 0 + && strcmp (name, "__init_array_start") != 0 + && strcmp (name, "__init_array_end") != 0 + && strcmp (name, "__fini_array_start") != 0 + && strcmp (name, "__fini_array_end") != 0)) + ERROR (gettext ("\ section [%2d] '%s': symbol %zu: st_value out of bounds\n"), - idx, section_name (ebl, ehdr, idx), cnt); - else if ((sym->st_value - destshdr->sh_addr + sym->st_size) - > destshdr->sh_size) - ERROR (gettext ("\ + idx, section_name (ebl, idx), cnt); + } + else if ((sym->st_value - sh_addr + + sym->st_size) > destshdr->sh_size) + ERROR (gettext ("\ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); + } } else { if ((destshdr->sh_flags & SHF_TLS) == 0) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have SHF_TLS flag set\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); if (ehdr->e_type == ET_REL) { @@ -777,14 +783,14 @@ section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have SHF_ if (sym->st_value > destshdr->sh_size) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); else if (sym->st_value + sym->st_size > destshdr->sh_size) ERROR (gettext ("\ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); } else { @@ -804,7 +810,7 @@ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2 if (no_pt_tls++ == 0) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); } else { @@ -812,22 +818,22 @@ section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n"), < destshdr->sh_offset - phdr->p_offset) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: st_value short of referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); else if (sym->st_value > (destshdr->sh_offset - phdr->p_offset + destshdr->sh_size)) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); else if (sym->st_value + sym->st_size > (destshdr->sh_offset - phdr->p_offset + destshdr->sh_size)) ERROR (gettext ("\ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), cnt, - (int) xndx, section_name (ebl, ehdr, xndx)); + idx, section_name (ebl, idx), cnt, + (int) xndx, section_name (ebl, xndx)); } } } @@ -839,100 +845,137 @@ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2 if (cnt >= shdr->sh_info) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: local symbol outside range described in sh_info\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); } else { if (cnt < shdr->sh_info) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: non-local symbol outside range described in sh_info\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); } if (GELF_ST_TYPE (sym->st_info) == STT_SECTION && GELF_ST_BIND (sym->st_info) != STB_LOCAL) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: non-local section symbol\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (name != NULL) { if (strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) { - /* Check that address and size match the global offset - table. We have to locate the GOT by searching for a - section named ".got". */ - Elf_Scn *gscn = NULL; + /* Check that address and size match the global offset table. */ - while ((gscn = elf_nextscn (ebl->elf, gscn)) != NULL) + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr = gelf_getshdr (elf_getscn (ebl->elf, xndx), + &destshdr_mem); + + if (destshdr == NULL && xndx == SHN_ABS) + { + /* In a DSO, we have to find the GOT section by name. */ + Elf_Scn *gotscn = NULL; + Elf_Scn *gscn = NULL; + while ((gscn = elf_nextscn (ebl->elf, gscn)) != NULL) + { + destshdr = gelf_getshdr (gscn, &destshdr_mem); + assert (destshdr != NULL); + const char *sname = elf_strptr (ebl->elf, + ehdr->e_shstrndx, + destshdr->sh_name); + if (sname != NULL) + { + if (strcmp (sname, ".got.plt") == 0) + break; + if (strcmp (sname, ".got") == 0) + /* Do not stop looking. + There might be a .got.plt section. */ + gotscn = gscn; + } + + destshdr = NULL; + } + + if (destshdr == NULL && gotscn != NULL) + destshdr = gelf_getshdr (gotscn, &destshdr_mem); + } + + const char *sname = ((destshdr == NULL || xndx == SHN_UNDEF) + ? NULL + : elf_strptr (ebl->elf, ehdr->e_shstrndx, + destshdr->sh_name)); + if (sname == NULL) { - GElf_Shdr gshdr_mem; - GElf_Shdr *gshdr = gelf_getshdr (gscn, &gshdr_mem); - assert (gshdr != NULL); + if (xndx != SHN_UNDEF || ehdr->e_type != ET_REL) + ERROR (gettext ("\ +section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to \ +bad section [%2d]\n"), + idx, section_name (ebl, idx), xndx); + } + else if (strcmp (sname, ".got.plt") != 0 + && strcmp (sname, ".got") != 0) + ERROR (gettext ("\ +section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to \ +section [%2d] '%s'\n"), + idx, section_name (ebl, idx), xndx, sname); - const char *sname = elf_strptr (ebl->elf, ehdr->e_shstrndx, - gshdr->sh_name); - if (sname != NULL && strcmp (sname, ".got") == 0) + if (destshdr != NULL) + { + /* Found it. */ + if (!ebl_check_special_symbol (ebl, ehdr, sym, name, + destshdr)) { - /* Found it. */ - if (sym->st_value != gshdr->sh_addr) - /* This test is more strict than the psABIs - which usually allow the symbol to be in the - middle of the .got section, allowing - negative offsets. */ + if (ehdr->e_type != ET_REL + && sym->st_value != destshdr->sh_addr) + /* This test is more strict than the psABIs which + usually allow the symbol to be in the middle of + the .got section, allowing negative offsets. */ ERROR (gettext ("\ -section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#" PRIx64 " does not match .got section address %#" PRIx64 "\n"), - idx, section_name (ebl, ehdr, idx), +section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#" PRIx64 " does not match %s section address %#" PRIx64 "\n"), + idx, section_name (ebl, idx), (uint64_t) sym->st_value, - (uint64_t) gshdr->sh_addr); + sname, (uint64_t) destshdr->sh_addr); - if (sym->st_size != gshdr->sh_size) + if (!gnuld && sym->st_size != destshdr->sh_size) ERROR (gettext ("\ -section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol size %" PRIu64 " does not match .got section size %" PRIu64 "\n"), - idx, section_name (ebl, ehdr, idx), +section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol size %" PRIu64 " does not match %s section size %" PRIu64 "\n"), + idx, section_name (ebl, idx), (uint64_t) sym->st_size, - (uint64_t) gshdr->sh_size); - - break; + sname, (uint64_t) destshdr->sh_size); } } - - if (gscn == NULL) + else ERROR (gettext ("\ section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol present, but no .got section\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); } else if (strcmp (name, "_DYNAMIC") == 0) - { - /* Check that address and size match the dynamic - section. We locate the dynamic section via the - program header entry. */ - int pcnt; - - for (pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) - { - GElf_Phdr phdr_mem; - GElf_Phdr *phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); + /* Check that address and size match the dynamic section. + We locate the dynamic section via the program header + entry. */ + for (int pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); - if (phdr != NULL && phdr->p_type == PT_DYNAMIC) - { - if (sym->st_value != phdr->p_vaddr) - ERROR (gettext ("\ + if (phdr != NULL && phdr->p_type == PT_DYNAMIC) + { + if (sym->st_value != phdr->p_vaddr) + ERROR (gettext ("\ section [%2d] '%s': _DYNAMIC_ symbol value %#" PRIx64 " does not match dynamic segment address %#" PRIx64 "\n"), - idx, section_name (ebl, ehdr, idx), - (uint64_t) sym->st_value, - (uint64_t) phdr->p_vaddr); + idx, section_name (ebl, idx), + (uint64_t) sym->st_value, + (uint64_t) phdr->p_vaddr); - if (sym->st_size != phdr->p_memsz) - ERROR (gettext ("\ + if (!gnuld && sym->st_size != phdr->p_memsz) + ERROR (gettext ("\ section [%2d] '%s': _DYNAMIC symbol size %" PRIu64 " does not match dynamic segment size %" PRIu64 "\n"), - idx, section_name (ebl, ehdr, idx), - (uint64_t) sym->st_size, - (uint64_t) phdr->p_memsz); + idx, section_name (ebl, idx), + (uint64_t) sym->st_size, + (uint64_t) phdr->p_memsz); - break; - } - } + break; + } } } } @@ -940,14 +983,15 @@ section [%2d] '%s': _DYNAMIC symbol size %" PRIu64 " does not match dynamic segm static bool -is_rel_dyn (Ebl *ebl, GElf_Ehdr *ehdr, int idx, GElf_Shdr *shdr, bool rela) +is_rel_dyn (Ebl *ebl, const GElf_Ehdr *ehdr, int idx, const GElf_Shdr *shdr, + bool is_rela) { /* If this is no executable or DSO it cannot be a .rel.dyn section. */ if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) return false; /* Check the section name. Unfortunately necessary. */ - if (strcmp (section_name (ebl, ehdr, idx), rela ? ".rela.dyn" : ".rel.dyn")) + if (strcmp (section_name (ebl, idx), is_rela ? ".rela.dyn" : ".rel.dyn")) return false; /* When a .rel.dyn section is used a DT_RELCOUNT dynamic section @@ -963,7 +1007,7 @@ is_rel_dyn (Ebl *ebl, GElf_Ehdr *ehdr, int idx, GElf_Shdr *shdr, bool rela) { /* Found the dynamic section. Look through it. */ Elf_Data *d = elf_getdata (scn, NULL); - int cnt; + size_t cnt; for (cnt = 1; cnt < rcshdr->sh_size / rcshdr->sh_entsize; ++cnt) { @@ -973,14 +1017,106 @@ is_rel_dyn (Ebl *ebl, GElf_Ehdr *ehdr, int idx, GElf_Shdr *shdr, bool rela) if (dyn->d_tag == DT_RELCOUNT) { - /* Found it. One last check: does the number - specified number of relative relocations exceed - the total number of relocations? */ - if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize) + /* Found it. Does the type match. */ + if (is_rela) ERROR (gettext ("\ +section [%2d] '%s': DT_RELCOUNT used for this RELA section\n"), + idx, section_name (ebl, idx)); + else + { + /* Does the number specified number of relative + relocations exceed the total number of + relocations? */ + if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize) + ERROR (gettext ("\ +section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), + idx, section_name (ebl, idx), + (int) dyn->d_un.d_val); + + /* Make sure the specified number of relocations are + relative. */ + Elf_Data *reldata = elf_getdata (elf_getscn (ebl->elf, + idx), NULL); + if (reldata != NULL) + for (size_t inner = 0; + inner < shdr->sh_size / shdr->sh_entsize; + ++inner) + { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel (reldata, inner, + &rel_mem); + if (rel == NULL) + /* The problem will be reported elsewhere. */ + break; + + if (ebl_relative_reloc_p (ebl, + GELF_R_TYPE (rel->r_info))) + { + if (inner >= dyn->d_un.d_val) + ERROR (gettext ("\ +section [%2d] '%s': relative relocations after index %d as specified by DT_RELCOUNT\n"), + idx, section_name (ebl, idx), + (int) dyn->d_un.d_val); + } + else if (inner < dyn->d_un.d_val) + ERROR (gettext ("\ +section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT specified %d relative relocations\n"), + idx, section_name (ebl, idx), + inner, (int) dyn->d_un.d_val); + } + } + } + + if (dyn->d_tag == DT_RELACOUNT) + { + /* Found it. Does the type match. */ + if (!is_rela) + ERROR (gettext ("\ +section [%2d] '%s': DT_RELACOUNT used for this REL section\n"), + idx, section_name (ebl, idx)); + else + { + /* Does the number specified number of relative + relocations exceed the total number of + relocations? */ + if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize) + ERROR (gettext ("\ section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), - idx, section_name (ebl, ehdr, idx), - (int) dyn->d_un.d_val); + idx, section_name (ebl, idx), + (int) dyn->d_un.d_val); + + /* Make sure the specified number of relocations are + relative. */ + Elf_Data *reldata = elf_getdata (elf_getscn (ebl->elf, + idx), NULL); + if (reldata != NULL) + for (size_t inner = 0; + inner < shdr->sh_size / shdr->sh_entsize; + ++inner) + { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (reldata, inner, + &rela_mem); + if (rela == NULL) + /* The problem will be reported elsewhere. */ + break; + + if (ebl_relative_reloc_p (ebl, + GELF_R_TYPE (rela->r_info))) + { + if (inner >= dyn->d_un.d_val) + ERROR (gettext ("\ +section [%2d] '%s': relative relocations after index %d as specified by DT_RELCOUNT\n"), + idx, section_name (ebl, idx), + (int) dyn->d_un.d_val); + } + else if (inner < dyn->d_un.d_val) + ERROR (gettext ("\ +section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT specified %d relative relocations\n"), + idx, section_name (ebl, idx), + inner, (int) dyn->d_un.d_val); + } + } } } @@ -992,273 +1128,360 @@ section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), } -static void -check_rela (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +struct loaded_segment { - Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - Elf_Data *data; - GElf_Shdr destshdr_mem; - GElf_Shdr *destshdr = NULL; - size_t cnt; - bool reldyn = false; - bool known_broken = gnuld; + GElf_Addr from; + GElf_Addr to; + bool read_only; + struct loaded_segment *next; +}; - scn = elf_getscn (ebl->elf, idx); - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) - return; - data = elf_getdata (scn, NULL); - if (data == NULL) - { - ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), - idx, section_name (ebl, ehdr, idx)); - return; - } + +/* Check whether binary has text relocation flag set. */ +static bool textrel; + +/* Keep track of whether text relocation flag is needed. */ +static bool needed_textrel; + + +static bool +check_reloc_shdr (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr, + int idx, int reltype, GElf_Shdr **destshdrp, + GElf_Shdr *destshdr_memp, struct loaded_segment **loadedp) +{ + bool reldyn = false; /* Check whether the link to the section we relocate is reasonable. */ if (shdr->sh_info >= shnum) ERROR (gettext ("section [%2d] '%s': invalid destination section index\n"), - idx, section_name (ebl, ehdr, idx)); - else + idx, section_name (ebl, idx)); + else if (shdr->sh_info != 0) { - destshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), - &destshdr_mem); - if (destshdr != NULL) + *destshdrp = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), + destshdr_memp); + if (*destshdrp != NULL) { - if(destshdr->sh_type != SHT_PROGBITS - && destshdr->sh_type != SHT_NOBITS) + if((*destshdrp)->sh_type != SHT_PROGBITS + && (*destshdrp)->sh_type != SHT_NOBITS) { reldyn = is_rel_dyn (ebl, ehdr, idx, shdr, true); if (!reldyn) ERROR (gettext ("\ section [%2d] '%s': invalid destination section type\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); else { - /* There is no standard, but we require that .rela.dyn + /* There is no standard, but we require that .rel{,a}.dyn sections have a sh_info value of zero. */ if (shdr->sh_info != 0) ERROR (gettext ("\ section [%2d] '%s': sh_info should be zero\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); } } - if ((destshdr->sh_flags & (SHF_MERGE | SHF_STRINGS)) != 0) + if (((*destshdrp)->sh_flags & (SHF_MERGE | SHF_STRINGS)) != 0) ERROR (gettext ("\ section [%2d] '%s': no relocations for merge-able sections possible\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); } } - if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_RELA, 1, EV_CURRENT)) - ERROR (gettext ("\ -section [%2d] '%s': section entry size does not match ElfXX_Rela\n"), - idx, section_name (ebl, ehdr, idx)); - - Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); - GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); - Elf_Data *symdata = elf_getdata (symscn, NULL); - - for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) + if (shdr->sh_entsize != gelf_fsize (ebl->elf, reltype, 1, EV_CURRENT)) + ERROR (gettext (reltype == ELF_T_RELA ? "\ +section [%2d] '%s': section entry size does not match ElfXX_Rela\n" : "\ +section [%2d] '%s': section entry size does not match ElfXX_Rel\n"), + idx, section_name (ebl, idx)); + + /* In preparation of checking whether relocations are text + relocations or not we need to determine whether the file is + flagged to have text relocation and we need to determine a) what + the loaded segments are and b) which are read-only. This will + also allow us to determine whether the same reloc section is + modifying loaded and not loaded segments. */ + for (int i = 0; i < ehdr->e_phnum; ++i) { - GElf_Rela rela_mem; - GElf_Rela *rela; + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, i, &phdr_mem); + if (phdr == NULL) + continue; - rela = gelf_getrela (data, cnt, &rela_mem); - if (rela == NULL) + if (phdr->p_type == PT_LOAD) { - ERROR (gettext ("\ -section [%2d] '%s': cannot get relocation %zu: %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, elf_errmsg (-1)); - continue; + struct loaded_segment *newp = xmalloc (sizeof (*newp)); + newp->from = phdr->p_vaddr; + newp->to = phdr->p_vaddr + phdr->p_memsz; + newp->read_only = (phdr->p_flags & PF_W) == 0; + newp->next = *loadedp; + *loadedp = newp; } + else if (phdr->p_type == PT_DYNAMIC) + { + Elf_Scn *dynscn = gelf_offscn (ebl->elf, phdr->p_offset); + GElf_Shdr dynshdr_mem; + GElf_Shdr *dynshdr = gelf_getshdr (dynscn, &dynshdr_mem); + Elf_Data *dyndata = elf_getdata (dynscn, NULL); + if (dynshdr != NULL && dynshdr->sh_type == SHT_DYNAMIC + && dyndata != NULL) + for (size_t j = 0; j < dynshdr->sh_size / dynshdr->sh_entsize; ++j) + { + GElf_Dyn dyn_mem; + GElf_Dyn *dyn = gelf_getdyn (dyndata, j, &dyn_mem); + if (dyn != NULL + && (dyn->d_tag == DT_TEXTREL + || (dyn->d_tag == DT_FLAGS + && (dyn->d_un.d_val & DF_TEXTREL) != 0))) + { + textrel = true; + break; + } + } + } + } - if (!ebl_reloc_type_check (ebl, GELF_R_TYPE (rela->r_info))) - ERROR (gettext ("section [%2d] '%s': relocation %zu: invalid type\n"), - idx, section_name (ebl, ehdr, idx), cnt); - else if (!ebl_reloc_valid_use (ebl, GELF_R_TYPE (rela->r_info))) + /* A quick test which can be easily done here (although it is a bit + out of place): the text relocation flag makes only sense if there + is a segment which is not writable. */ + if (textrel) + { + struct loaded_segment *seg = *loadedp; + while (seg != NULL && !seg->read_only) + seg = seg->next; + if (seg == NULL) ERROR (gettext ("\ +text relocation flag set but there is no read-only segment\n")); + } + + return reldyn; +} + + +enum load_state + { + state_undecided, + state_loaded, + state_unloaded, + state_error + }; + + +static void +check_one_reloc (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *relshdr, int idx, + size_t cnt, const GElf_Shdr *symshdr, Elf_Data *symdata, + GElf_Addr r_offset, GElf_Xword r_info, + const GElf_Shdr *destshdr, bool reldyn, + struct loaded_segment *loaded, enum load_state *statep) +{ + bool known_broken = gnuld; + + if (!ebl_reloc_type_check (ebl, GELF_R_TYPE (r_info))) + ERROR (gettext ("section [%2d] '%s': relocation %zu: invalid type\n"), + idx, section_name (ebl, idx), cnt); + else if (((ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) + /* The executable/DSO can contain relocation sections with + all the relocations the linker has applied. Those sections + are marked non-loaded, though. */ + || (relshdr->sh_flags & SHF_ALLOC) != 0) + && !ebl_reloc_valid_use (ebl, GELF_R_TYPE (r_info))) + ERROR (gettext ("\ section [%2d] '%s': relocation %zu: relocation type invalid for the file type\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); - if (symshdr != NULL - && ((GELF_R_SYM (rela->r_info) + 1) - * gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT) - > symshdr->sh_size)) - ERROR (gettext ("\ + if (symshdr != NULL + && ((GELF_R_SYM (r_info) + 1) + * gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT) + > symshdr->sh_size)) + ERROR (gettext ("\ section [%2d] '%s': relocation %zu: invalid symbol index\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); - if (ebl_gotpc_reloc_check (ebl, GELF_R_TYPE (rela->r_info))) - { - const char *name; - char buf[64]; - GElf_Sym sym_mem; - GElf_Sym *sym = gelf_getsym (symdata, GELF_R_SYM (rela->r_info), - &sym_mem); - if (sym != NULL - /* Get the name for the symbol. */ - && (name = elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name)) - && strcmp (name, "_GLOBAL_OFFSET_TABLE_") !=0 ) - ERROR (gettext ("\ + /* No more tests if this is a no-op relocation. */ + if (ebl_none_reloc_p (ebl, GELF_R_TYPE (r_info))) + return; + + if (ebl_gotpc_reloc_check (ebl, GELF_R_TYPE (r_info))) + { + const char *name; + char buf[64]; + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symdata, GELF_R_SYM (r_info), &sym_mem); + if (sym != NULL + /* Get the name for the symbol. */ + && (name = elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name)) + && strcmp (name, "_GLOBAL_OFFSET_TABLE_") !=0 ) + ERROR (gettext ("\ section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can be used with %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, - ebl_reloc_type_name (ebl, GELF_R_SYM (rela->r_info), - buf, sizeof (buf))); - } + idx, section_name (ebl, idx), cnt, + ebl_reloc_type_name (ebl, GELF_R_SYM (r_info), + buf, sizeof (buf))); + } - if (reldyn) + if (reldyn) + { + // XXX TODO Check .rel.dyn section addresses. + } + else if (!known_broken) + { + if (destshdr != NULL + && GELF_R_TYPE (r_info) != 0 + && (r_offset - (ehdr->e_type == ET_REL ? 0 + : destshdr->sh_addr)) >= destshdr->sh_size) + ERROR (gettext ("\ +section [%2d] '%s': relocation %zu: offset out of bounds\n"), + idx, section_name (ebl, idx), cnt); + } + + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symdata, GELF_R_SYM (r_info), &sym_mem); + + if (ebl_copy_reloc_p (ebl, GELF_R_TYPE (r_info)) + /* Make sure the referenced symbol is an object or unspecified. */ + && sym != NULL + && GELF_ST_TYPE (sym->st_info) != STT_NOTYPE + && GELF_ST_TYPE (sym->st_info) != STT_OBJECT) + { + char buf[64]; + ERROR (gettext ("section [%2d] '%s': relocation %zu: copy relocation against symbol of type %s\n"), + idx, section_name (ebl, idx), cnt, + ebl_symbol_type_name (ebl, GELF_ST_TYPE (sym->st_info), + buf, sizeof (buf))); + } + + if ((ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) + || (relshdr->sh_flags & SHF_ALLOC) != 0) + { + bool in_loaded_seg = false; + while (loaded != NULL) { - // XXX TODO Check .rel.dyn section addresses. + if (r_offset < loaded->to + && r_offset + (sym == NULL ? 0 : sym->st_size) >= loaded->from) + { + /* The symbol is in this segment. */ + if (loaded->read_only) + { + if (textrel) + needed_textrel = true; + else + ERROR (gettext ("section [%2d] '%s': relocation %zu: read-only section modified but text relocation flag not set\n"), + idx, section_name (ebl, idx), cnt); + } + + in_loaded_seg = true; + } + + loaded = loaded->next; } - else if (!known_broken) + + if (*statep == state_undecided) + *statep = in_loaded_seg ? state_loaded : state_unloaded; + else if ((*statep == state_unloaded && in_loaded_seg) + || (*statep == state_loaded && !in_loaded_seg)) { - if (destshdr != NULL - && (rela->r_offset - destshdr->sh_addr) >= destshdr->sh_size) - ERROR (gettext ("\ -section [%2d] '%s': relocation %zu: offset out of bounds\n"), - idx, section_name (ebl, ehdr, idx), cnt); + ERROR (gettext ("\ +section [%2d] '%s': relocations are against loaded and unloaded data\n"), + idx, section_name (ebl, idx)); + *statep = state_error; } } } static void -check_rel (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_rela (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { - Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - Elf_Data *data; - GElf_Shdr destshdr_mem; - GElf_Shdr *destshdr = NULL; - size_t cnt; - bool reldyn = false; - bool known_broken = gnuld; - - scn = elf_getscn (ebl->elf, idx); - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) - return; - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (data == NULL) { ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); return; } - /* Check whether the link to the section we relocate is reasonable. */ - if (shdr->sh_info >= shnum) - ERROR (gettext ("section [%2d] '%s': invalid destination section index\n"), - idx, section_name (ebl, ehdr, idx)); - else + /* Check the fields of the section header. */ + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr = NULL; + struct loaded_segment *loaded = NULL; + bool reldyn = check_reloc_shdr (ebl, ehdr, shdr, idx, ELF_T_RELA, &destshdr, + &destshdr_mem, &loaded); + + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); + Elf_Data *symdata = elf_getdata (symscn, NULL); + enum load_state state = state_undecided; + + for (size_t cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { - destshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), - &destshdr_mem); - if (destshdr != NULL) + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem); + if (rela == NULL) { - if (destshdr->sh_type != SHT_PROGBITS - && destshdr->sh_type != SHT_NOBITS) - { - reldyn = is_rel_dyn (ebl, ehdr, idx, shdr, false); - if (!reldyn) - ERROR (gettext ("\ -section [%2d] '%s': invalid destination section type\n"), - idx, section_name (ebl, ehdr, idx)); - else - { - /* There is no standard, but we require that .rela.dyn - sections have a sh_info value of zero. */ - if (shdr->sh_info != 0) - ERROR (gettext ("\ -section [%2d] '%s': sh_info should be zero\n"), - idx, section_name (ebl, ehdr, idx)); - } - } - - if ((destshdr->sh_flags & (SHF_MERGE | SHF_STRINGS)) != 0) - ERROR (gettext ("\ -section [%2d] '%s': no relocations for merge-able sections possible\n"), - idx, section_name (ebl, ehdr, idx)); + ERROR (gettext ("\ +section [%2d] '%s': cannot get relocation %zu: %s\n"), + idx, section_name (ebl, idx), cnt, elf_errmsg (-1)); + continue; } + + check_one_reloc (ebl, ehdr, shdr, idx, cnt, symshdr, symdata, + rela->r_offset, rela->r_info, destshdr, reldyn, loaded, + &state); } - if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_REL, 1, EV_CURRENT)) - ERROR (gettext ("\ -section [%2d] '%s': section entry size does not match ElfXX_Rel\n"), - idx, section_name (ebl, ehdr, idx)); + while (loaded != NULL) + { + struct loaded_segment *old = loaded; + loaded = loaded->next; + free (old); + } +} + + +static void +check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +{ + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); + if (data == NULL) + { + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + + /* Check the fields of the section header. */ + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr = NULL; + struct loaded_segment *loaded = NULL; + bool reldyn = check_reloc_shdr (ebl, ehdr, shdr, idx, ELF_T_REL, &destshdr, + &destshdr_mem, &loaded); Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); GElf_Shdr symshdr_mem; GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); Elf_Data *symdata = elf_getdata (symscn, NULL); + enum load_state state = state_undecided; - for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) + for (size_t cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { GElf_Rel rel_mem; - GElf_Rel *rel; - - rel = gelf_getrel (data, cnt, &rel_mem); + GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem); if (rel == NULL) { ERROR (gettext ("\ section [%2d] '%s': cannot get relocation %zu: %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, elf_errmsg (-1)); + idx, section_name (ebl, idx), cnt, elf_errmsg (-1)); continue; } - if (!ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))) - ERROR (gettext ("section [%2d] '%s': relocation %zu: invalid type\n"), - idx, section_name (ebl, ehdr, idx), cnt); - else if (!ebl_reloc_valid_use (ebl, GELF_R_TYPE (rel->r_info))) - ERROR (gettext ("\ -section [%2d] '%s': relocation %zu: relocation type invalid for the file type\n"), - idx, section_name (ebl, ehdr, idx), cnt); - - if (symshdr != NULL - && ((GELF_R_SYM (rel->r_info) + 1) - * gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT) - > symshdr->sh_size)) - ERROR (gettext ("\ -section [%2d] '%s': relocation %zu: invalid symbol index\n"), - idx, section_name (ebl, ehdr, idx), cnt); - - if (ebl_gotpc_reloc_check (ebl, GELF_R_TYPE (rel->r_info))) - { - const char *name; - char buf[64]; - GElf_Sym sym_mem; - GElf_Sym *sym = gelf_getsym (symdata, GELF_R_SYM (rel->r_info), - &sym_mem); - if (sym != NULL - /* Get the name for the symbol. */ - && (name = elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name)) - && strcmp (name, "_GLOBAL_OFFSET_TABLE_") !=0 ) - ERROR (gettext ("\ -section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can be used with %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, - ebl_reloc_type_name (ebl, GELF_R_SYM (rel->r_info), - buf, sizeof (buf))); - } + check_one_reloc (ebl, ehdr, shdr, idx, cnt, symshdr, symdata, + rel->r_offset, rel->r_info, destshdr, reldyn, loaded, + &state); + } - if (reldyn) - { - // XXX TODO Check .rel.dyn section addresses. - } - else if (!known_broken) - { - if (destshdr != NULL - && GELF_R_TYPE (rel->r_info) != 0 - && (rel->r_offset - destshdr->sh_addr) >= destshdr->sh_size) - ERROR (gettext ("\ -section [%2d] '%s': relocation %zu: offset out of bounds\n"), - idx, section_name (ebl, ehdr, idx), cnt); - } + while (loaded != NULL) + { + struct loaded_segment *old = loaded; + loaded = loaded->next; + free (old); } } @@ -1268,11 +1491,8 @@ static int ndynamic; static void -check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { - Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; Elf_Data *data; GElf_Shdr strshdr_mem; GElf_Shdr *strshdr; @@ -1283,8 +1503,7 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) [DT_PLTRELSZ] = { [DT_JMPREL] = true }, [DT_HASH] = { [DT_SYMTAB] = true }, [DT_STRTAB] = { [DT_STRSZ] = true }, - [DT_SYMTAB] = { [DT_STRTAB] = true, [DT_HASH] = true, - [DT_SYMENT] = true }, + [DT_SYMTAB] = { [DT_STRTAB] = true, [DT_SYMENT] = true }, [DT_RELA] = { [DT_RELASZ] = true, [DT_RELAENT] = true }, [DT_RELASZ] = { [DT_RELA] = true }, [DT_RELAENT] = { [DT_RELA] = true }, @@ -1298,9 +1517,10 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) [DT_JMPREL] = { [DT_PLTRELSZ] = true, [DT_PLTREL] = true }, [DT_RUNPATH] = { [DT_STRTAB] = true }, [DT_PLTREL] = { [DT_JMPREL] = true }, - [DT_PLTRELSZ] = { [DT_JMPREL] = true } }; bool has_dt[DT_NUM]; + bool has_val_dt[DT_VALNUM]; + bool has_addr_dt[DT_ADDRNUM]; static const bool level2[DT_NUM] = { [DT_RPATH] = true, @@ -1311,7 +1531,6 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) static const bool mandatory[DT_NUM] = { [DT_NULL] = true, - [DT_HASH] = true, [DT_STRTAB] = true, [DT_SYMTAB] = true, [DT_STRSZ] = true, @@ -1323,19 +1542,17 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) GElf_Word pltrelsz = 0; memset (has_dt, '\0', sizeof (has_dt)); + memset (has_val_dt, '\0', sizeof (has_val_dt)); + memset (has_addr_dt, '\0', sizeof (has_addr_dt)); if (++ndynamic == 2) ERROR (gettext ("more than one dynamic section present\n")); - scn = elf_getscn (ebl->elf, idx); - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) - return; - data = elf_getdata (scn, NULL); + data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (data == NULL) { ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); return; } @@ -1343,30 +1560,28 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx) if (strshdr != NULL && strshdr->sh_type != SHT_STRTAB) ERROR (gettext ("\ section [%2d] '%s': referenced as string table for section [%2d] '%s' but type is not SHT_STRTAB\n"), - shdr->sh_link, section_name (ebl, ehdr, shdr->sh_link), - idx, section_name (ebl, ehdr, idx)); + shdr->sh_link, section_name (ebl, shdr->sh_link), + idx, section_name (ebl, idx)); if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_DYN, 1, EV_CURRENT)) ERROR (gettext ("\ section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (shdr->sh_info != 0) ERROR (gettext ("section [%2d] '%s': sh_info not zero\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); bool non_null_warned = false; for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { GElf_Dyn dyn_mem; - GElf_Dyn *dyn; - - dyn = gelf_getdyn (data, cnt, &dyn_mem); + GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem); if (dyn == NULL) { ERROR (gettext ("\ section [%2d] '%s': cannot get dynamic section entry %zu: %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, elf_errmsg (-1)); + idx, section_name (ebl, idx), cnt, elf_errmsg (-1)); continue; } @@ -1374,15 +1589,15 @@ section [%2d] '%s': cannot get dynamic section entry %zu: %s\n"), { ERROR (gettext ("\ section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); non_null_warned = true; } if (!ebl_dynamic_tag_check (ebl, dyn->d_tag)) ERROR (gettext ("section [%2d] '%s': entry %zu: unknown tag\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); - if (dyn->d_tag < DT_NUM) + if (dyn->d_tag >= 0 && dyn->d_tag < DT_NUM) { if (has_dt[dyn->d_tag] && dyn->d_tag != DT_NEEDED @@ -1392,7 +1607,7 @@ section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n"), char buf[50]; ERROR (gettext ("\ section [%2d] '%s': entry %zu: more than one entry with tag %s\n"), - idx, section_name (ebl, ehdr, idx), cnt, + idx, section_name (ebl, idx), cnt, ebl_dynamic_tag_name (ebl, dyn->d_tag, buf, sizeof (buf))); } @@ -1402,19 +1617,25 @@ section [%2d] '%s': entry %zu: more than one entry with tag %s\n"), char buf[50]; ERROR (gettext ("\ section [%2d] '%s': entry %zu: level 2 tag %s used\n"), - idx, section_name (ebl, ehdr, idx), cnt, + idx, section_name (ebl, idx), cnt, ebl_dynamic_tag_name (ebl, dyn->d_tag, buf, sizeof (buf))); } has_dt[dyn->d_tag] = true; } + else if (dyn->d_tag <= DT_VALRNGHI + && DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM) + has_val_dt[DT_VALTAGIDX (dyn->d_tag)] = true; + else if (dyn->d_tag <= DT_ADDRRNGHI + && DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM) + has_addr_dt[DT_ADDRTAGIDX (dyn->d_tag)] = true; if (dyn->d_tag == DT_PLTREL && dyn->d_un.d_val != DT_REL && dyn->d_un.d_val != DT_RELA) ERROR (gettext ("\ section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"), - idx, section_name (ebl, ehdr, idx), cnt); + idx, section_name (ebl, idx), cnt); if (dyn->d_tag == DT_REL) reladdr = dyn->d_un.d_ptr; @@ -1424,14 +1645,89 @@ section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"), pltreladdr = dyn->d_un.d_ptr; if (dyn->d_tag == DT_PLTRELSZ) pltrelsz = dyn->d_un.d_val; + + /* Check that addresses for entries are in loaded segments. */ + switch (dyn->d_tag) + { + size_t n; + case DT_STRTAB: + /* We require the referenced section is the same as the one + specified in sh_link. */ + if (strshdr->sh_addr != dyn->d_un.d_val) + { + ERROR (gettext ("\ +section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] '%s' referenced by sh_link\n"), + idx, section_name (ebl, idx), cnt, + shdr->sh_link, section_name (ebl, shdr->sh_link)); + break; + } + goto check_addr; + + default: + if (dyn->d_tag < DT_ADDRRNGLO || dyn->d_tag > DT_ADDRRNGHI) + /* Value is no pointer. */ + break; + /* FALLTHROUGH */ + + case DT_AUXILIARY: + case DT_FILTER: + case DT_FINI: + case DT_FINI_ARRAY: + case DT_HASH: + case DT_INIT: + case DT_INIT_ARRAY: + case DT_JMPREL: + case DT_PLTGOT: + case DT_REL: + case DT_RELA: + case DT_SYMBOLIC: + case DT_SYMTAB: + case DT_VERDEF: + case DT_VERNEED: + case DT_VERSYM: + check_addr: + for (n = 0; n < ehdr->e_phnum; ++n) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, n, &phdr_mem); + if (phdr != NULL && phdr->p_type == PT_LOAD + && phdr->p_vaddr <= dyn->d_un.d_ptr + && phdr->p_vaddr + phdr->p_memsz > dyn->d_un.d_ptr) + break; + } + if (unlikely (n >= ehdr->e_phnum)) + { + char buf[50]; + ERROR (gettext ("\ +section [%2d] '%s': entry %zu: %s value must point into loaded segment\n"), + idx, section_name (ebl, idx), cnt, + ebl_dynamic_tag_name (ebl, dyn->d_tag, buf, + sizeof (buf))); + } + break; + + case DT_NEEDED: + case DT_RPATH: + case DT_RUNPATH: + case DT_SONAME: + if (dyn->d_un.d_ptr >= strshdr->sh_size) + { + char buf[50]; + ERROR (gettext ("\ +section [%2d] '%s': entry %zu: %s value must be valid offset in section [%2d] '%s'\n"), + idx, section_name (ebl, idx), cnt, + ebl_dynamic_tag_name (ebl, dyn->d_tag, buf, + sizeof (buf)), + shdr->sh_link, section_name (ebl, shdr->sh_link)); + } + break; + } } for (cnt = 1; cnt < DT_NUM; ++cnt) if (has_dt[cnt]) { - int inner; - - for (inner = 0; inner < DT_NUM; ++inner) + for (int inner = 0; inner < DT_NUM; ++inner) if (dependencies[cnt][inner] && ! has_dt[inner]) { char buf1[50]; @@ -1439,7 +1735,7 @@ section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"), ERROR (gettext ("\ section [%2d] '%s': contains %s entry but not %s\n"), - idx, section_name (ebl, ehdr, idx), + idx, section_name (ebl, idx), ebl_dynamic_tag_name (ebl, cnt, buf1, sizeof (buf1)), ebl_dynamic_tag_name (ebl, inner, buf2, sizeof (buf2))); } @@ -1451,95 +1747,144 @@ section [%2d] '%s': contains %s entry but not %s\n"), char buf[50]; ERROR (gettext ("\ section [%2d] '%s': mandatory tag %s not present\n"), - idx, section_name (ebl, ehdr, idx), + idx, section_name (ebl, idx), ebl_dynamic_tag_name (ebl, cnt, buf, sizeof (buf))); } } + /* Make sure we have an hash table. */ + if (!has_dt[DT_HASH] && !has_addr_dt[DT_ADDRTAGIDX (DT_GNU_HASH)]) + ERROR (gettext ("\ +section [%2d] '%s': no hash section present\n"), + idx, section_name (ebl, idx)); + + /* The GNU-style hash table also needs a symbol table. */ + if (!has_dt[DT_HASH] && has_addr_dt[DT_ADDRTAGIDX (DT_GNU_HASH)] + && !has_dt[DT_SYMTAB]) + ERROR (gettext ("\ +section [%2d] '%s': contains %s entry but not %s\n"), + idx, section_name (ebl, idx), + "DT_GNU_HASH", "DT_SYMTAB"); + /* Check the rel/rela tags. At least one group must be available. */ if ((has_dt[DT_RELA] || has_dt[DT_RELASZ] || has_dt[DT_RELAENT]) && (!has_dt[DT_RELA] || !has_dt[DT_RELASZ] || !has_dt[DT_RELAENT])) ERROR (gettext ("\ section [%2d] '%s': not all of %s, %s, and %s are present\n"), - idx, section_name (ebl, ehdr, idx), + idx, section_name (ebl, idx), "DT_RELA", "DT_RELASZ", "DT_RELAENT"); if ((has_dt[DT_REL] || has_dt[DT_RELSZ] || has_dt[DT_RELENT]) && (!has_dt[DT_REL] || !has_dt[DT_RELSZ] || !has_dt[DT_RELENT])) ERROR (gettext ("\ section [%2d] '%s': not all of %s, %s, and %s are present\n"), - idx, section_name (ebl, ehdr, idx), + idx, section_name (ebl, idx), "DT_REL", "DT_RELSZ", "DT_RELENT"); + + /* Check that all prelink sections are present if any of them is. */ + if (has_val_dt[DT_VALTAGIDX (DT_GNU_PRELINKED)] + || has_val_dt[DT_VALTAGIDX (DT_CHECKSUM)]) + { + if (!has_val_dt[DT_VALTAGIDX (DT_GNU_PRELINKED)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in DSO marked during prelinking\n"), + idx, section_name (ebl, idx), "DT_GNU_PRELINKED"); + if (!has_val_dt[DT_VALTAGIDX (DT_CHECKSUM)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in DSO marked during prelinking\n"), + idx, section_name (ebl, idx), "DT_CHECKSUM"); + + /* Only DSOs can be marked like this. */ + if (ehdr->e_type != ET_DYN) + ERROR (gettext ("\ +section [%2d] '%s': non-DSO file marked as dependency during prelink\n"), + idx, section_name (ebl, idx)); + } + + if (has_val_dt[DT_VALTAGIDX (DT_GNU_CONFLICTSZ)] + || has_val_dt[DT_VALTAGIDX (DT_GNU_LIBLISTSZ)] + || has_addr_dt[DT_ADDRTAGIDX (DT_GNU_CONFLICT)] + || has_addr_dt[DT_ADDRTAGIDX (DT_GNU_LIBLIST)]) + { + if (!has_val_dt[DT_VALTAGIDX (DT_GNU_CONFLICTSZ)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in prelinked executable\n"), + idx, section_name (ebl, idx), "DT_GNU_CONFLICTSZ"); + if (!has_val_dt[DT_VALTAGIDX (DT_GNU_LIBLISTSZ)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in prelinked executable\n"), + idx, section_name (ebl, idx), "DT_GNU_LIBLISTSZ"); + if (!has_addr_dt[DT_ADDRTAGIDX (DT_GNU_CONFLICT)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in prelinked executable\n"), + idx, section_name (ebl, idx), "DT_GNU_CONFLICT"); + if (!has_addr_dt[DT_ADDRTAGIDX (DT_GNU_LIBLIST)]) + ERROR (gettext ("\ +section [%2d] '%s': %s tag missing in prelinked executable\n"), + idx, section_name (ebl, idx), "DT_GNU_LIBLIST"); + } } static void -check_symtab_shndx (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_symtab_shndx (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { - Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr; - Elf_Scn *symscn; - size_t cnt; - Elf_Data *data; - Elf_Data *symdata; - - scn = elf_getscn (ebl->elf, idx); - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) - return; + if (ehdr->e_type != ET_REL) + { + ERROR (gettext ("\ +section [%2d] '%s': only relocatable files can have extended section index\n"), + idx, section_name (ebl, idx)); + return; + } - symscn = elf_getscn (ebl->elf, shdr->sh_link); - symshdr = gelf_getshdr (symscn, &symshdr_mem); + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); if (symshdr != NULL && symshdr->sh_type != SHT_SYMTAB) ERROR (gettext ("\ section [%2d] '%s': extended section index section not for symbol table\n"), - idx, section_name (ebl, ehdr, idx)); - symdata = elf_getdata (symscn, NULL); + idx, section_name (ebl, idx)); + Elf_Data *symdata = elf_getdata (symscn, NULL); if (symdata == NULL) ERROR (gettext ("cannot get data for symbol section\n")); if (shdr->sh_entsize != sizeof (Elf32_Word)) ERROR (gettext ("\ section [%2d] '%s': entry size does not match Elf32_Word\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (symshdr != NULL && (shdr->sh_size / shdr->sh_entsize < symshdr->sh_size / symshdr->sh_entsize)) ERROR (gettext ("\ section [%2d] '%s': extended index table too small for symbol table\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (shdr->sh_info != 0) ERROR (gettext ("section [%2d] '%s': sh_info not zero\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); - for (cnt = idx + 1; cnt < shnum; ++cnt) + for (size_t cnt = idx + 1; cnt < shnum; ++cnt) { GElf_Shdr rshdr_mem; - GElf_Shdr *rshdr; - - rshdr = gelf_getshdr (elf_getscn (ebl->elf, cnt), &rshdr_mem); + GElf_Shdr *rshdr = gelf_getshdr (elf_getscn (ebl->elf, cnt), &rshdr_mem); if (rshdr != NULL && rshdr->sh_type == SHT_SYMTAB_SHNDX && rshdr->sh_link == shdr->sh_link) { ERROR (gettext ("\ section [%2d] '%s': extended section index in section [%2zu] '%s' refers to same symbol table\n"), - idx, section_name (ebl, ehdr, idx), - cnt, section_name (ebl, ehdr, cnt)); + idx, section_name (ebl, idx), + cnt, section_name (ebl, cnt)); break; } } - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (*((Elf32_Word *) data->d_buf) != 0) ERROR (gettext ("symbol 0 should have zero extended section index\n")); - for (cnt = 1; cnt < data->d_size / sizeof (Elf32_Word); ++cnt) + for (size_t cnt = 1; cnt < data->d_size / sizeof (Elf32_Word); ++cnt) { Elf32_Word xndx = ((Elf32_Word *) data->d_buf)[cnt]; @@ -1563,92 +1908,437 @@ extended section index is %" PRIu32 " but symbol index is not XINDEX\n"), static void -check_hash (Ebl *ebl, GElf_Ehdr *ehdr, int idx) +check_sysv_hash (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx, + GElf_Shdr *symshdr) { - Elf_Scn *scn; - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - Elf_Data *data; - Elf32_Word nbucket; - Elf32_Word nchain; - GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr; + Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0]; + Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1]; - scn = elf_getscn (ebl->elf, idx); - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) - return; - data = elf_getdata (scn, NULL); + if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize) + ERROR (gettext ("\ +section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"), + idx, section_name (ebl, idx), (long int) shdr->sh_size, + (long int) ((2 + nbucket + nchain) * shdr->sh_entsize)); + + size_t maxidx = nchain; + + if (symshdr != NULL) + { + size_t symsize = symshdr->sh_size / symshdr->sh_entsize; + + if (nchain > symshdr->sh_size / symshdr->sh_entsize) + ERROR (gettext ("section [%2d] '%s': chain array too large\n"), + idx, section_name (ebl, idx)); + + maxidx = symsize; + } + + size_t cnt; + for (cnt = 2; cnt < 2 + nbucket; ++cnt) + if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx) + ERROR (gettext ("\ +section [%2d] '%s': hash bucket reference %zu out of bounds\n"), + idx, section_name (ebl, idx), cnt - 2); + + for (; cnt < 2 + nbucket + nchain; ++cnt) + if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx) + ERROR (gettext ("\ +section [%2d] '%s': hash chain reference %zu out of bounds\n"), + idx, section_name (ebl, idx), cnt - 2 - nbucket); +} + + +static void +check_sysv_hash64 (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx, + GElf_Shdr *symshdr) +{ + Elf64_Xword nbucket = ((Elf64_Xword *) data->d_buf)[0]; + Elf64_Xword nchain = ((Elf64_Xword *) data->d_buf)[1]; + + if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize) + ERROR (gettext ("\ +section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"), + idx, section_name (ebl, idx), (long int) shdr->sh_size, + (long int) ((2 + nbucket + nchain) * shdr->sh_entsize)); + + size_t maxidx = nchain; + + if (symshdr != NULL) + { + size_t symsize = symshdr->sh_size / symshdr->sh_entsize; + + if (nchain > symshdr->sh_size / symshdr->sh_entsize) + ERROR (gettext ("section [%2d] '%s': chain array too large\n"), + idx, section_name (ebl, idx)); + + maxidx = symsize; + } + + size_t cnt; + for (cnt = 2; cnt < 2 + nbucket; ++cnt) + if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx) + ERROR (gettext ("\ +section [%2d] '%s': hash bucket reference %zu out of bounds\n"), + idx, section_name (ebl, idx), cnt - 2); + + for (; cnt < 2 + nbucket + nchain; ++cnt) + if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx) + ERROR (gettext ("\ +section [%2d] '%s': hash chain reference %" PRIu64 " out of bounds\n"), + idx, section_name (ebl, idx), (uint64_t) (cnt - 2 - nbucket)); +} + + +static void +check_gnu_hash (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, int idx, + GElf_Shdr *symshdr) +{ + Elf32_Word nbuckets = ((Elf32_Word *) data->d_buf)[0]; + Elf32_Word symbias = ((Elf32_Word *) data->d_buf)[1]; + Elf32_Word bitmask_words = ((Elf32_Word *) data->d_buf)[2]; + + if (!powerof2 (bitmask_words)) + ERROR (gettext ("\ +section [%2d] '%s': bitmask size not power of 2: %u\n"), + idx, section_name (ebl, idx), bitmask_words); + + size_t bitmask_idxmask = bitmask_words - 1; + if (gelf_getclass (ebl->elf) == ELFCLASS64) + bitmask_words *= 2; + Elf32_Word shift = ((Elf32_Word *) data->d_buf)[3]; + + if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)) + { + ERROR (gettext ("\ +section [%2d] '%s': hash table section is too small (is %ld, expected at least%ld)\n"), + idx, section_name (ebl, idx), (long int) shdr->sh_size, + (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))); + return; + } + + if (shift > 31) + ERROR (gettext ("\ +section [%2d] '%s': 2nd hash function shift too big: %u\n"), + idx, section_name (ebl, idx), shift); + + size_t maxidx = shdr->sh_size / sizeof (Elf32_Word) - (4 + bitmask_words + + nbuckets); + + if (symshdr != NULL) + maxidx = MIN (maxidx, symshdr->sh_size / symshdr->sh_entsize); + + /* We need the symbol section data. */ + Elf_Data *symdata = elf_getdata (elf_getscn (ebl->elf, shdr->sh_link), NULL); + + union + { + Elf32_Word *p32; + Elf64_Xword *p64; + } bitmask = { .p32 = &((Elf32_Word *) data->d_buf)[4] }, + collected = { .p32 = xcalloc (bitmask_words, sizeof (Elf32_Word)) }; + + size_t classbits = gelf_getclass (ebl->elf) == ELFCLASS32 ? 32 : 64; + + size_t cnt; + for (cnt = 4 + bitmask_words; cnt < 4 + bitmask_words + nbuckets; ++cnt) + { + Elf32_Word symidx = ((Elf32_Word *) data->d_buf)[cnt]; + + if (symidx == 0) + continue; + + if (symidx < symbias) + { + ERROR (gettext ("\ +section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n"), + idx, section_name (ebl, idx), cnt - (4 + bitmask_words)); + continue; + } + + while (symidx - symbias < maxidx) + { + Elf32_Word chainhash = ((Elf32_Word *) data->d_buf)[4 + + bitmask_words + + nbuckets + + symidx + - symbias]; + + if (symdata != NULL) + { + /* Check that the referenced symbol is not undefined. */ + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symdata, symidx, &sym_mem); + if (sym != NULL && sym->st_shndx == SHN_UNDEF + && GELF_ST_TYPE (sym->st_info) != STT_FUNC) + ERROR (gettext ("\ +section [%2d] '%s': symbol %u referenced in chain for bucket %zu is undefined\n"), + idx, section_name (ebl, idx), symidx, + cnt - (4 + bitmask_words)); + + const char *symname = elf_strptr (ebl->elf, symshdr->sh_link, + sym->st_name); + if (symname != NULL) + { + Elf32_Word hval = elf_gnu_hash (symname); + if ((hval & ~1u) != (chainhash & ~1u)) + ERROR (gettext ("\ +section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n"), + idx, section_name (ebl, idx), symidx, + cnt - (4 + bitmask_words)); + + /* Set the bits in the bitmask. */ + size_t maskidx = (hval / classbits) & bitmask_idxmask; + if (classbits == 32) + { + collected.p32[maskidx] + |= UINT32_C (1) << (hval & (classbits - 1)); + collected.p32[maskidx] + |= UINT32_C (1) << ((hval >> shift) & (classbits - 1)); + } + else + { + collected.p64[maskidx] + |= UINT64_C (1) << (hval & (classbits - 1)); + collected.p64[maskidx] + |= UINT64_C (1) << ((hval >> shift) & (classbits - 1)); + } + } + } + + if ((chainhash & 1) != 0) + break; + + ++symidx; + } + + if (symidx - symbias >= maxidx) + ERROR (gettext ("\ +section [%2d] '%s': hash chain for bucket %zu out of bounds\n"), + idx, section_name (ebl, idx), cnt - (4 + bitmask_words)); + else if (symshdr != NULL + && symidx > symshdr->sh_size / symshdr->sh_entsize) + ERROR (gettext ("\ +section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n"), + idx, section_name (ebl, idx), cnt - (4 + bitmask_words)); + } + + if (memcmp (collected.p32, bitmask.p32, bitmask_words * sizeof (Elf32_Word))) + ERROR (gettext ("\ +section [%2d] '%s': bitmask does not match names in the hash table\n"), + idx, section_name (ebl, idx)); + + free (collected.p32); +} + + +static void +check_hash (int tag, Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +{ + if (ehdr->e_type == ET_REL) + { + ERROR (gettext ("\ +section [%2d] '%s': relocatable files cannot have hash tables\n"), + idx, section_name (ebl, idx)); + return; + } + + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (data == NULL) { ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); return; } - symshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &symshdr_mem); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + &symshdr_mem); if (symshdr != NULL && symshdr->sh_type != SHT_DYNSYM) ERROR (gettext ("\ section [%2d] '%s': hash table not for dynamic symbol table\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); - if (shdr->sh_entsize != sizeof (Elf32_Word)) + if (shdr->sh_entsize != (tag == SHT_GNU_HASH + ? (gelf_getclass (ebl->elf) == ELFCLASS32 + ? sizeof (Elf32_Word) : 0) + : (size_t) ebl_sysvhash_entrysize (ebl))) ERROR (gettext ("\ -section [%2d] '%s': entry size does not match Elf32_Word\n"), - idx, section_name (ebl, ehdr, idx)); +section [%2d] '%s': hash table entry size incorrect\n"), + idx, section_name (ebl, idx)); if ((shdr->sh_flags & SHF_ALLOC) == 0) ERROR (gettext ("section [%2d] '%s': not marked to be allocated\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); - if (shdr->sh_size < 2 * shdr->sh_entsize) + if (shdr->sh_size < (tag == SHT_GNU_HASH ? 4 : 2) * (shdr->sh_entsize ?: 4)) { ERROR (gettext ("\ -section [%2d] '%s': hash table has not even room for nbucket and nchain\n"), - idx, section_name (ebl, ehdr, idx)); +section [%2d] '%s': hash table has not even room for initial administrative entries\n"), + idx, section_name (ebl, idx)); return; } - nbucket = ((Elf32_Word *) data->d_buf)[0]; - nchain = ((Elf32_Word *) data->d_buf)[1]; + switch (tag) + { + case SHT_HASH: + if (ebl_sysvhash_entrysize (ebl) == sizeof (Elf64_Xword)) + check_sysv_hash64 (ebl, shdr, data, idx, symshdr); + else + check_sysv_hash (ebl, shdr, data, idx, symshdr); + break; - if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize) - ERROR (gettext ("\ -section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n"), - idx, section_name (ebl, ehdr, idx), (long int) shdr->sh_size, - (long int) ((2 + nbucket + nchain) * shdr->sh_entsize)); + case SHT_GNU_HASH: + check_gnu_hash (ebl, shdr, data, idx, symshdr); + break; - if (symshdr != NULL) + default: + assert (! "should not happen"); + } +} + + +/* Compare content of both hash tables, it must be identical. */ +static void +compare_hash_gnu_hash (Ebl *ebl, GElf_Ehdr *ehdr, size_t hash_idx, + size_t gnu_hash_idx) +{ + Elf_Scn *hash_scn = elf_getscn (ebl->elf, hash_idx); + Elf_Data *hash_data = elf_getdata (hash_scn, NULL); + GElf_Shdr hash_shdr_mem; + GElf_Shdr *hash_shdr = gelf_getshdr (hash_scn, &hash_shdr_mem); + Elf_Scn *gnu_hash_scn = elf_getscn (ebl->elf, gnu_hash_idx); + Elf_Data *gnu_hash_data = elf_getdata (gnu_hash_scn, NULL); + GElf_Shdr gnu_hash_shdr_mem; + GElf_Shdr *gnu_hash_shdr = gelf_getshdr (gnu_hash_scn, &gnu_hash_shdr_mem); + + if (hash_shdr == NULL || gnu_hash_shdr == NULL + || hash_data == NULL || gnu_hash_data == NULL) + /* None of these pointers should be NULL since we used the + sections already. We are careful nonetheless. */ + return; + + /* The link must point to the same symbol table. */ + if (hash_shdr->sh_link != gnu_hash_shdr->sh_link) { - size_t symsize = symshdr->sh_size / symshdr->sh_entsize; - size_t cnt; + ERROR (gettext ("\ +sh_link in hash sections [%2zu] '%s' and [%2zu] '%s' not identical\n"), + hash_idx, elf_strptr (ebl->elf, shstrndx, hash_shdr->sh_name), + gnu_hash_idx, + elf_strptr (ebl->elf, shstrndx, gnu_hash_shdr->sh_name)); + return; + } - if (nchain < symshdr->sh_size / symshdr->sh_entsize) - ERROR (gettext ("section [%2d] '%s': chain array not large enough\n"), - idx, section_name (ebl, ehdr, idx)); + Elf_Scn *sym_scn = elf_getscn (ebl->elf, hash_shdr->sh_link); + Elf_Data *sym_data = elf_getdata (sym_scn, NULL); + GElf_Shdr sym_shdr_mem; + GElf_Shdr *sym_shdr = gelf_getshdr (sym_scn, &sym_shdr_mem); - for (cnt = 2; cnt < 2 + nbucket; ++cnt) - if (((Elf32_Word *) data->d_buf)[cnt] >= symsize) - ERROR (gettext ("\ -section [%2d] '%s': hash bucket reference %zu out of bounds\n"), - idx, section_name (ebl, ehdr, idx), cnt - 2); + if (sym_data == NULL || sym_shdr == NULL) + return; - for (; cnt < 2 + nbucket + nchain; ++cnt) - if (((Elf32_Word *) data->d_buf)[cnt] >= symsize) - ERROR (gettext ("\ -section [%2d] '%s': hash chain reference %zu out of bounds\n"), - idx, section_name (ebl, ehdr, idx), cnt - 2 - nbucket); + int nentries = sym_shdr->sh_size / sym_shdr->sh_entsize; + char *used = alloca (nentries); + memset (used, '\0', nentries); + + /* First go over the GNU_HASH table and mark the entries as used. */ + const Elf32_Word *gnu_hasharr = (Elf32_Word *) gnu_hash_data->d_buf; + Elf32_Word gnu_nbucket = gnu_hasharr[0]; + const int bitmap_factor = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 1 : 2; + const Elf32_Word *gnu_bucket = (gnu_hasharr + + (4 + gnu_hasharr[2] * bitmap_factor)); + const Elf32_Word *gnu_chain = gnu_bucket + gnu_hasharr[0] - gnu_hasharr[1]; + + for (Elf32_Word cnt = 0; cnt < gnu_nbucket; ++cnt) + { + Elf32_Word symidx = gnu_bucket[cnt]; + if (symidx != STN_UNDEF) + do + used[symidx] |= 1; + while ((gnu_chain[symidx++] & 1u) == 0); + } + + /* Now go over the old hash table and check that we cover the same + entries. */ + if (hash_shdr->sh_entsize == sizeof (Elf32_Word)) + { + const Elf32_Word *hasharr = (Elf32_Word *) hash_data->d_buf; + Elf32_Word nbucket = hasharr[0]; + const Elf32_Word *bucket = &hasharr[2]; + const Elf32_Word *chain = &hasharr[2 + nbucket]; + + for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) + { + Elf32_Word symidx = bucket[cnt]; + while (symidx != STN_UNDEF) + { + used[symidx] |= 2; + symidx = chain[symidx]; + } + } + } + else + { + const Elf64_Xword *hasharr = (Elf64_Xword *) hash_data->d_buf; + Elf64_Xword nbucket = hasharr[0]; + const Elf64_Xword *bucket = &hasharr[2]; + const Elf64_Xword *chain = &hasharr[2 + nbucket]; + + for (Elf64_Xword cnt = 0; cnt < nbucket; ++cnt) + { + Elf64_Xword symidx = bucket[cnt]; + while (symidx != STN_UNDEF) + { + used[symidx] |= 2; + symidx = chain[symidx]; + } + } } + + /* Now see which entries are not set in one or both hash tables + (unless the symbol is undefined in which case it can be omitted + in the new table format). */ + if ((used[0] & 1) != 0) + ERROR (gettext ("section [%2zu] '%s': reference to symbol index 0\n"), + gnu_hash_idx, + elf_strptr (ebl->elf, shstrndx, gnu_hash_shdr->sh_name)); + if ((used[0] & 2) != 0) + ERROR (gettext ("section [%2zu] '%s': reference to symbol index 0\n"), + hash_idx, elf_strptr (ebl->elf, shstrndx, hash_shdr->sh_name)); + + for (int cnt = 1; cnt < nentries; ++cnt) + if (used[cnt] != 0 && used[cnt] != 3) + { + if (used[cnt] == 1) + ERROR (gettext ("\ +symbol %d referenced in new hash table in [%2zu] '%s' but not in old hash table in [%2zu] '%s'\n"), + cnt, gnu_hash_idx, + elf_strptr (ebl->elf, shstrndx, gnu_hash_shdr->sh_name), + hash_idx, + elf_strptr (ebl->elf, shstrndx, hash_shdr->sh_name)); + else + { + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (sym_data, cnt, &sym_mem); + + if (sym != NULL && sym->st_shndx != STN_UNDEF) + ERROR (gettext ("\ +symbol %d referenced in old hash table in [%2zu] '%s' but not in new hash table in [%2zu] '%s'\n"), + cnt, hash_idx, + elf_strptr (ebl->elf, shstrndx, hash_shdr->sh_name), + gnu_hash_idx, + elf_strptr (ebl->elf, shstrndx, gnu_hash_shdr->sh_name)); + } + } } static void -check_null (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +check_null (Ebl *ebl, GElf_Shdr *shdr, int idx) { #define TEST(name, extra) \ if (extra && shdr->sh_##name != 0) \ ERROR (gettext ("section [%2d] '%s': nonzero sh_%s for NULL section\n"), \ - idx, section_name (ebl, ehdr, idx), #name) + idx, section_name (ebl, idx), #name) TEST (name, 1); TEST (flags, 1); @@ -1669,44 +2359,57 @@ check_group (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { ERROR (gettext ("\ section [%2d] '%s': section groups only allowed in relocatable object files\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); return; } /* Check that sh_link is an index of a symbol table. */ + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), - &symshdr_mem); + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); if (symshdr == NULL) ERROR (gettext ("section [%2d] '%s': cannot get symbol table: %s\n"), - idx, section_name (ebl, ehdr, idx), elf_errmsg (-1)); + idx, section_name (ebl, idx), elf_errmsg (-1)); else { if (symshdr->sh_type != SHT_SYMTAB) ERROR (gettext ("\ section [%2d] '%s': section reference in sh_link is no symbol table\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (shdr->sh_info >= symshdr->sh_size / gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT)) ERROR (gettext ("\ section [%2d] '%s': invalid symbol index in sh_info\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (shdr->sh_flags != 0) ERROR (gettext ("section [%2d] '%s': sh_flags not zero\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); + + GElf_Sym sym_data; + GElf_Sym *sym = gelf_getsym (elf_getdata (symscn, NULL), shdr->sh_info, + &sym_data); + if (sym == NULL) + ERROR (gettext ("\ +section [%2d] '%s': cannot get symbol for signature\n"), + idx, section_name (ebl, idx)); + else if (strcmp (elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name), + "") == 0) + ERROR (gettext ("\ +section [%2d] '%s': signature symbol canot be empty string\n"), + idx, section_name (ebl, idx)); if (be_strict && shdr->sh_entsize != elf32_fsize (ELF_T_WORD, 1, EV_CURRENT)) ERROR (gettext ("section [%2d] '%s': sh_flags not set correctly\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); } Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); if (data == NULL) ERROR (gettext ("section [%2d] '%s': cannot get data: %s\n"), - idx, section_name (ebl, ehdr, idx), elf_errmsg (-1)); + idx, section_name (ebl, idx), elf_errmsg (-1)); else { size_t elsize = elf32_fsize (ELF_T_WORD, 1, EV_CURRENT); @@ -1716,22 +2419,22 @@ section [%2d] '%s': invalid symbol index in sh_info\n"), if (data->d_size % elsize != 0) ERROR (gettext ("\ section [%2d] '%s': section size not multiple of sizeof(Elf32_Word)\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); if (data->d_size < elsize) ERROR (gettext ("\ section [%2d] '%s': section group without flags word\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); else if (be_strict) { if (data->d_size < 2 * elsize) ERROR (gettext ("\ section [%2d] '%s': section group without member\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); else if (data->d_size < 3 * elsize) ERROR (gettext ("\ section [%2d] '%s': section group with only one member\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); } #if ALLOW_UNALIGNED @@ -1741,7 +2444,7 @@ section [%2d] '%s': section group with only one member\n"), #endif if ((val & ~GRP_COMDAT) != 0) ERROR (gettext ("section [%2d] '%s': unknown section group flags\n"), - idx, section_name (ebl, ehdr, idx)); + idx, section_name (ebl, idx)); for (cnt = elsize; cnt < data->d_size; cnt += elsize) { @@ -1754,97 +2457,48 @@ section [%2d] '%s': section group with only one member\n"), if (val > shnum) ERROR (gettext ("\ section [%2d] '%s': section index %Zu out of range\n"), - idx, section_name (ebl, ehdr, idx), cnt / elsize); + idx, section_name (ebl, idx), cnt / elsize); else { GElf_Shdr refshdr_mem; - GElf_Shdr *refshdr; - - refshdr = gelf_getshdr (elf_getscn (ebl->elf, val), - &refshdr_mem); + GElf_Shdr *refshdr = gelf_getshdr (elf_getscn (ebl->elf, val), + &refshdr_mem); if (refshdr == NULL) ERROR (gettext ("\ section [%2d] '%s': cannot get section header for element %zu: %s\n"), - idx, section_name (ebl, ehdr, idx), cnt / elsize, + idx, section_name (ebl, idx), cnt / elsize, elf_errmsg (-1)); else { if (refshdr->sh_type == SHT_GROUP) ERROR (gettext ("\ section [%2d] '%s': section group contains another group [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), - val, section_name (ebl, ehdr, val)); + idx, section_name (ebl, idx), + val, section_name (ebl, val)); if ((refshdr->sh_flags & SHF_GROUP) == 0) ERROR (gettext ("\ section [%2d] '%s': element %Zu references section [%2d] '%s' without SHF_GROUP flag set\n"), - idx, section_name (ebl, ehdr, idx), cnt / elsize, - val, section_name (ebl, ehdr, val)); + idx, section_name (ebl, idx), cnt / elsize, + val, section_name (ebl, val)); } if (++scnref[val] == 2) ERROR (gettext ("\ section [%2d] '%s' is contained in more than one section group\n"), - val, section_name (ebl, ehdr, val)); + val, section_name (ebl, val)); } } } } -static bool has_loadable_segment; -static bool has_interp_segment; - -static const struct -{ - const char *name; - size_t namelen; - GElf_Word type; - enum { unused, exact, atleast } attrflag; - GElf_Word attr; - GElf_Word attr2; -} special_sections[] = - { - /* See figure 4-14 in the gABI. */ - { ".bss", 5, SHT_NOBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".comment", 8, SHT_PROGBITS, exact, 0, 0 }, - { ".data", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".data1", 7, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".debug", 7, SHT_PROGBITS, exact, 0, 0 }, - { ".dynamic", 9, SHT_DYNAMIC, atleast, SHF_ALLOC, SHF_WRITE }, - { ".dynstr", 8, SHT_STRTAB, exact, SHF_ALLOC, 0 }, - { ".dynsym", 8, SHT_DYNSYM, exact, SHF_ALLOC, 0 }, - { ".fini", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 }, - { ".fini_array", 12, SHT_FINI_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".got", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more info? - { ".hash", 6, SHT_HASH, exact, SHF_ALLOC, 0 }, - { ".init", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 }, - { ".init_array", 12, SHT_INIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".interp", 8, SHT_PROGBITS, atleast, 0, SHF_ALLOC }, // XXX more tests? - { ".line", 6, SHT_PROGBITS, exact, 0, 0 }, - { ".note", 6, SHT_NOTE, exact, 0, 0 }, - { ".plt", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more tests - { ".preinit_array", 15, SHT_PREINIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".rela", 5, SHT_RELA, atleast, 0, SHF_ALLOC }, // XXX more tests - { ".rel", 4, SHT_REL, atleast, 0, SHF_ALLOC }, // XXX more tests - { ".rodata", 8, SHT_PROGBITS, exact, SHF_ALLOC, 0 }, - { ".rodata1", 9, SHT_PROGBITS, exact, SHF_ALLOC, 0 }, - { ".shstrtab", 10, SHT_STRTAB, exact, 0, 0 }, - { ".strtab", 8, SHT_STRTAB, atleast, 0, SHF_ALLOC }, // XXX more tests - { ".symtab", 8, SHT_SYMTAB, atleast, 0, SHF_ALLOC }, // XXX more tests - { ".symtab_shndx", 14, SHT_SYMTAB_SHNDX, atleast, 0, SHF_ALLOC }, // XXX more tests - { ".tbss", 6, SHT_NOBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, - { ".tdata", 7, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, - { ".tdata1", 8, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, - { ".text", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 } - }; -#define nspecial_sections \ - (sizeof (special_sections) / sizeof (special_sections[0])) - - static const char * section_flags_string (GElf_Word flags, char *buf, size_t len) { + if (flags == 0) + return "none"; + static const struct { GElf_Word flag; @@ -1867,9 +2521,8 @@ section_flags_string (GElf_Word flags, char *buf, size_t len) const size_t nknown_flags = sizeof (known_flags) / sizeof (known_flags[0]); char *cp = buf; - size_t cnt; - for (cnt = 0; cnt < nknown_flags; ++cnt) + for (size_t cnt = 0; cnt < nknown_flags; ++cnt) if (flags & known_flags[cnt].flag) { if (cp != buf && len > 1) @@ -1894,14 +2547,126 @@ section_flags_string (GElf_Word flags, char *buf, size_t len) } +static int +has_copy_reloc (Ebl *ebl, unsigned int symscnndx, unsigned int symndx) +{ + /* First find the relocation section for the symbol table. */ + Elf_Scn *scn = NULL; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL + && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) + && shdr->sh_link == symscnndx) + /* Found the section. */ + break; + } + + if (scn == NULL) + return 0; + + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + return 0; + + if (shdr->sh_type == SHT_REL) + for (int i = 0; (size_t) i < shdr->sh_size / shdr->sh_entsize; ++i) + { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel (data, i, &rel_mem); + if (rel == NULL) + continue; + + if (GELF_R_SYM (rel->r_info) == symndx + && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rel->r_info))) + return 1; + } + else + for (int i = 0; (size_t) i < shdr->sh_size / shdr->sh_entsize; ++i) + { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (data, i, &rela_mem); + if (rela == NULL) + continue; + + if (GELF_R_SYM (rela->r_info) == symndx + && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rela->r_info))) + return 1; + } + + return 0; +} + + +static int +in_nobits_scn (Ebl *ebl, unsigned int shndx) +{ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, shndx), &shdr_mem); + return shdr != NULL && shdr->sh_type == SHT_NOBITS; +} + + +static struct version_namelist +{ + const char *objname; + const char *name; + GElf_Versym ndx; + enum { ver_def, ver_need } type; + struct version_namelist *next; +} *version_namelist; + + +static int +add_version (const char *objname, const char *name, GElf_Versym ndx, int type) +{ + /* Check that there are no duplications. */ + struct version_namelist *nlp = version_namelist; + while (nlp != NULL) + { + if (((nlp->objname == NULL && objname == NULL) + || (nlp->objname != NULL && objname != NULL + && strcmp (nlp->objname, objname) == 0)) + && strcmp (nlp->name, name) == 0) + return nlp->type == ver_def ? 1 : -1; + nlp = nlp->next; + } + + nlp = xmalloc (sizeof (*nlp)); + nlp->objname = objname; + nlp->name = name; + nlp->ndx = ndx; + nlp->type = type; + nlp->next = version_namelist; + version_namelist = nlp; + + return 0; +} + + static void -check_versym (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +check_versym (Ebl *ebl, int idx) { - /* The number of elements in the version symbol table must be the - same as the number of symbols. */ + Elf_Scn *scn = elf_getscn (ebl->elf, idx); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + /* The error has already been reported. */ + return; + + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + { + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), - &symshdr_mem); + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); if (symshdr == NULL) /* The error has already been reported. */ return; @@ -1910,33 +2675,693 @@ check_versym (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { ERROR (gettext ("\ section [%2d] '%s' refers in sh_link to section [%2d] '%s' which is no dynamic symbol table\n"), - idx, section_name (ebl, ehdr, idx), - shdr->sh_link, section_name (ebl, ehdr, shdr->sh_link)); + idx, section_name (ebl, idx), + shdr->sh_link, section_name (ebl, shdr->sh_link)); return; } + /* The number of elements in the version symbol table must be the + same as the number of symbols. */ if (shdr->sh_size / shdr->sh_entsize != symshdr->sh_size / symshdr->sh_entsize) ERROR (gettext ("\ section [%2d] '%s' has different number of entries than symbol table [%2d] '%s'\n"), - idx, section_name (ebl, ehdr, idx), - shdr->sh_link, section_name (ebl, ehdr, shdr->sh_link)); + idx, section_name (ebl, idx), + shdr->sh_link, section_name (ebl, shdr->sh_link)); + + Elf_Data *symdata = elf_getdata (symscn, NULL); + if (symdata == NULL) + /* The error has already been reported. */ + return; + + for (int cnt = 1; (size_t) cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) + { + GElf_Versym versym_mem; + GElf_Versym *versym = gelf_getversym (data, cnt, &versym_mem); + if (versym == NULL) + { + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: cannot read version data\n"), + idx, section_name (ebl, idx), cnt); + break; + } + + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symdata, cnt, &sym_mem); + if (sym == NULL) + /* Already reported elsewhere. */ + continue; - // XXX TODO A lot more tests - // check value of the fields. local symbols must have zero entries. - // nonlocal symbols refer to valid version. Check that version index - // in bound. + if (*versym == VER_NDX_GLOBAL) + { + /* Global symbol. Make sure it is not defined as local. */ + if (GELF_ST_BIND (sym->st_info) == STB_LOCAL) + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: local symbol with global scope\n"), + idx, section_name (ebl, idx), cnt); + } + else if (*versym != VER_NDX_LOCAL) + { + /* Versioned symbol. Make sure it is not defined as local. */ + if (!gnuld && GELF_ST_BIND (sym->st_info) == STB_LOCAL) + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: local symbol with version\n"), + idx, section_name (ebl, idx), cnt); + + /* Look through the list of defined versions and locate the + index we need for this symbol. */ + struct version_namelist *runp = version_namelist; + while (runp != NULL) + if (runp->ndx == (*versym & (GElf_Versym) 0x7fff)) + break; + else + runp = runp->next; + + if (runp == NULL) + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: invalid version index %d\n"), + idx, section_name (ebl, idx), cnt, (int) *versym); + else if (sym->st_shndx == SHN_UNDEF + && runp->type == ver_def) + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: version index %d is for defined version\n"), + idx, section_name (ebl, idx), cnt, (int) *versym); + else if (sym->st_shndx != SHN_UNDEF + && runp->type == ver_need) + { + /* Unless this symbol has a copy relocation associated + this must not happen. */ + if (!has_copy_reloc (ebl, shdr->sh_link, cnt) + && !in_nobits_scn (ebl, sym->st_shndx)) + ERROR (gettext ("\ +section [%2d] '%s': symbol %d: version index %d is for requested version\n"), + idx, section_name (ebl, idx), cnt, (int) *versym); + } + } + } } -static void -check_sections (Ebl *ebl, GElf_Ehdr *ehdr) +static int +unknown_dependency_p (Elf *elf, GElf_Ehdr *ehdr, const char *fname) { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = NULL; + + int i; + for (i = 0; i < ehdr->e_phnum; ++i) + if ((phdr = gelf_getphdr (elf, i, &phdr_mem)) != NULL + && phdr->p_type == PT_DYNAMIC) + break; + + if (i == ehdr->e_phnum) + return 1; + assert (phdr != NULL); + Elf_Scn *scn = gelf_offscn (elf, phdr->p_offset); GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - size_t cnt; - bool dot_interp_section = false; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + Elf_Data *data = elf_getdata (scn, NULL); + if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL) + for (size_t j = 0; j < shdr->sh_size / shdr->sh_entsize; ++j) + { + GElf_Dyn dyn_mem; + GElf_Dyn *dyn = gelf_getdyn (data, j, &dyn_mem); + if (dyn != NULL && dyn->d_tag == DT_NEEDED) + { + const char *str = elf_strptr (elf, shdr->sh_link, dyn->d_un.d_val); + if (str != NULL && strcmp (str, fname) == 0) + /* Found it. */ + return 0; + } + } + + return 1; +} + + +static unsigned int nverneed; + +static void +check_verneed (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +{ + if (++nverneed == 2) + ERROR (gettext ("more than one version reference section present\n")); + + GElf_Shdr strshdr_mem; + GElf_Shdr *strshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + &strshdr_mem); + if (strshdr == NULL) + return; + if (strshdr->sh_type != SHT_STRTAB) + ERROR (gettext ("\ +section [%2d] '%s': sh_link does not link to string table\n"), + idx, section_name (ebl, idx)); + + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); + if (data == NULL) + { + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + unsigned int offset = 0; + for (int cnt = shdr->sh_info; --cnt >= 0; ) + { + /* Get the data at the next offset. */ + GElf_Verneed needmem; + GElf_Verneed *need = gelf_getverneed (data, offset, &needmem); + if (need == NULL) + break; + + unsigned int auxoffset = offset + need->vn_aux; + + if (need->vn_version != EV_CURRENT) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong version %d\n"), + idx, section_name (ebl, idx), cnt, (int) need->vn_version); + + if (need->vn_cnt > 0 && need->vn_aux < gelf_fsize (ebl->elf, ELF_T_VNEED, + 1, EV_CURRENT)) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong offset of auxiliary data\n"), + idx, section_name (ebl, idx), cnt); + + const char *libname = elf_strptr (ebl->elf, shdr->sh_link, + need->vn_file); + if (libname == NULL) + { + ERROR (gettext ("\ +section [%2d] '%s': entry %d has invalid file reference\n"), + idx, section_name (ebl, idx), cnt); + goto next_need; + } + + /* Check that there is a DT_NEEDED entry for the referenced library. */ + if (unknown_dependency_p (ebl->elf, ehdr, libname)) + ERROR (gettext ("\ +section [%2d] '%s': entry %d references unknown dependency\n"), + idx, section_name (ebl, idx), cnt); + + for (int cnt2 = need->vn_cnt; --cnt2 >= 0; ) + { + GElf_Vernaux auxmem; + GElf_Vernaux *aux = gelf_getvernaux (data, auxoffset, &auxmem); + if (aux == NULL) + break; + + if ((aux->vna_flags & ~VER_FLG_WEAK) != 0) + ERROR (gettext ("\ +section [%2d] '%s': auxiliary entry %d of entry %d has unknown flag\n"), + idx, section_name (ebl, idx), need->vn_cnt - cnt2, cnt); + + const char *verstr = elf_strptr (ebl->elf, shdr->sh_link, + aux->vna_name); + if (verstr == NULL) + ERROR (gettext ("\ +section [%2d] '%s': auxiliary entry %d of entry %d has invalid name reference\n"), + idx, section_name (ebl, idx), need->vn_cnt - cnt2, cnt); + else + { + GElf_Word hashval = elf_hash (verstr); + if (hashval != aux->vna_hash) + ERROR (gettext ("\ +section [%2d] '%s': auxiliary entry %d of entry %d has wrong hash value: %#x, expected %#x\n"), + idx, section_name (ebl, idx), need->vn_cnt - cnt2, + cnt, (int) hashval, (int) aux->vna_hash); + + int res = add_version (libname, verstr, aux->vna_other, + ver_need); + if (unlikely (res !=0)) + { + assert (res > 0); + ERROR (gettext ("\ +section [%2d] '%s': auxiliary entry %d of entry %d has duplicate version name '%s'\n"), + idx, section_name (ebl, idx), need->vn_cnt - cnt2, + cnt, verstr); + } + } + + if ((aux->vna_next != 0 || cnt2 > 0) + && aux->vna_next < gelf_fsize (ebl->elf, ELF_T_VNAUX, 1, + EV_CURRENT)) + { + ERROR (gettext ("\ +section [%2d] '%s': auxiliary entry %d of entry %d has wrong next field\n"), + idx, section_name (ebl, idx), need->vn_cnt - cnt2, cnt); + break; + } + + auxoffset += MAX (aux->vna_next, + gelf_fsize (ebl->elf, ELF_T_VNAUX, 1, EV_CURRENT)); + } + + /* Find the next offset. */ + next_need: + offset += need->vn_next; + + if ((need->vn_next != 0 || cnt > 0) + && offset < auxoffset) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has invalid offset to next entry\n"), + idx, section_name (ebl, idx), cnt); + } +} + + +static unsigned int nverdef; + +static void +check_verdef (Ebl *ebl, GElf_Shdr *shdr, int idx) +{ + if (++nverdef == 2) + ERROR (gettext ("more than one version definition section present\n")); + + GElf_Shdr strshdr_mem; + GElf_Shdr *strshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + &strshdr_mem); + if (strshdr == NULL) + return; + if (strshdr->sh_type != SHT_STRTAB) + ERROR (gettext ("\ +section [%2d] '%s': sh_link does not link to string table\n"), + idx, section_name (ebl, idx)); + + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); + if (data == NULL) + { + no_data: + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + + /* Iterate over all version definition entries. We check that there + is a BASE entry and that each index is unique. To do the later + we collection the information in a list which is later + examined. */ + struct namelist + { + const char *name; + struct namelist *next; + } *namelist = NULL; + struct namelist *refnamelist = NULL; + + bool has_base = false; + unsigned int offset = 0; + for (int cnt = shdr->sh_info; --cnt >= 0; ) + { + /* Get the data at the next offset. */ + GElf_Verdef defmem; + GElf_Verdef *def = gelf_getverdef (data, offset, &defmem); + if (def == NULL) + goto no_data; + + if ((def->vd_flags & VER_FLG_BASE) != 0) + { + if (has_base) + ERROR (gettext ("\ +section [%2d] '%s': more than one BASE definition\n"), + idx, section_name (ebl, idx)); + if (def->vd_ndx != VER_NDX_GLOBAL) + ERROR (gettext ("\ +section [%2d] '%s': BASE definition must have index VER_NDX_GLOBAL\n"), + idx, section_name (ebl, idx)); + has_base = true; + } + if ((def->vd_flags & ~(VER_FLG_BASE|VER_FLG_WEAK)) != 0) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has unknown flag\n"), + idx, section_name (ebl, idx), cnt); + + if (def->vd_version != EV_CURRENT) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong version %d\n"), + idx, section_name (ebl, idx), cnt, (int) def->vd_version); + + if (def->vd_cnt > 0 && def->vd_aux < gelf_fsize (ebl->elf, ELF_T_VDEF, + 1, EV_CURRENT)) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong offset of auxiliary data\n"), + idx, section_name (ebl, idx), cnt); + + unsigned int auxoffset = offset + def->vd_aux; + GElf_Verdaux auxmem; + GElf_Verdaux *aux = gelf_getverdaux (data, auxoffset, &auxmem); + if (aux == NULL) + goto no_data; + + const char *name = elf_strptr (ebl->elf, shdr->sh_link, aux->vda_name); + if (name == NULL) + { + ERROR (gettext ("\ +section [%2d] '%s': entry %d has invalid name reference\n"), + idx, section_name (ebl, idx), cnt); + goto next_def; + } + GElf_Word hashval = elf_hash (name); + if (def->vd_hash != hashval) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong hash value: %#x, expected %#x\n"), + idx, section_name (ebl, idx), cnt, (int) hashval, + (int) def->vd_hash); + + int res = add_version (NULL, name, def->vd_ndx, ver_def); + if (unlikely (res !=0)) + { + assert (res > 0); + ERROR (gettext ("\ +section [%2d] '%s': entry %d has duplicate version name '%s'\n"), + idx, section_name (ebl, idx), cnt, name); + } + + struct namelist *newname = alloca (sizeof (*newname)); + newname->name = name; + newname->next = namelist; + namelist = newname; + + auxoffset += aux->vda_next; + for (int cnt2 = 1; cnt2 < def->vd_cnt; ++cnt2) + { + aux = gelf_getverdaux (data, auxoffset, &auxmem); + if (aux == NULL) + goto no_data; + + name = elf_strptr (ebl->elf, shdr->sh_link, aux->vda_name); + if (name == NULL) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has invalid name reference in auxiliary data\n"), + idx, section_name (ebl, idx), cnt); + else + { + newname = alloca (sizeof (*newname)); + newname->name = name; + newname->next = refnamelist; + refnamelist = newname; + } + + if ((aux->vda_next != 0 || cnt2 + 1 < def->vd_cnt) + && aux->vda_next < gelf_fsize (ebl->elf, ELF_T_VDAUX, 1, + EV_CURRENT)) + { + ERROR (gettext ("\ +section [%2d] '%s': entry %d has wrong next field in auxiliary data\n"), + idx, section_name (ebl, idx), cnt); + break; + } + + auxoffset += MAX (aux->vda_next, + gelf_fsize (ebl->elf, ELF_T_VDAUX, 1, EV_CURRENT)); + } + + /* Find the next offset. */ + next_def: + offset += def->vd_next; + + if ((def->vd_next != 0 || cnt > 0) + && offset < auxoffset) + ERROR (gettext ("\ +section [%2d] '%s': entry %d has invalid offset to next entry\n"), + idx, section_name (ebl, idx), cnt); + } + + if (!has_base) + ERROR (gettext ("section [%2d] '%s': no BASE definition\n"), + idx, section_name (ebl, idx)); + + /* Check whether the referenced names are available. */ + while (namelist != NULL) + { + struct version_namelist *runp = version_namelist; + while (runp != NULL) + { + if (runp->type == ver_def + && strcmp (runp->name, namelist->name) == 0) + break; + runp = runp->next; + } + + if (runp == NULL) + ERROR (gettext ("\ +section [%2d] '%s': unknown parent version '%s'\n"), + idx, section_name (ebl, idx), namelist->name); + + namelist = namelist->next; + } +} + +static void +check_attributes (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +{ + if (shdr->sh_size == 0) + { + ERROR (gettext ("section [%2d] '%s': empty object attributes section\n"), + idx, section_name (ebl, idx)); + return; + } + + Elf_Data *data = elf_rawdata (elf_getscn (ebl->elf, idx), NULL); + if (data == NULL || data->d_size == 0) + { + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + + inline size_t pos (const unsigned char *p) + { + return p - (const unsigned char *) data->d_buf; + } + + const unsigned char *p = data->d_buf; + if (*p++ != 'A') + { + ERROR (gettext ("section [%2d] '%s': unrecognized attribute format\n"), + idx, section_name (ebl, idx)); + return; + } + + inline size_t left (void) + { + return (const unsigned char *) data->d_buf + data->d_size - p; + } + + while (left () >= 4) + { + uint32_t len; + memcpy (&len, p, sizeof len); + + if (len == 0) + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: zero length field in attribute section\n"), + idx, section_name (ebl, idx), pos (p)); + + if (MY_ELFDATA != ehdr->e_ident[EI_DATA]) + CONVERT (len); + + if (len > left ()) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: invalid length in attribute section\n"), + idx, section_name (ebl, idx), pos (p)); + break; + } + + const unsigned char *name = p + sizeof len; + p += len; + + unsigned const char *q = memchr (name, '\0', len); + if (q == NULL) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: unterminated vendor name string\n"), + idx, section_name (ebl, idx), pos (p)); + continue; + } + ++q; + + if (q - name == sizeof "gnu" && !memcmp (name, "gnu", sizeof "gnu")) + while (q < p) + { + unsigned const char *chunk = q; + + unsigned int subsection_tag; + get_uleb128 (subsection_tag, q); + + if (q >= p) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: endless ULEB128 in attribute subsection tag\n"), + idx, section_name (ebl, idx), pos (chunk)); + break; + } + uint32_t subsection_len; + if (p - q < (ptrdiff_t) sizeof subsection_len) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: truncated attribute section\n"), + idx, section_name (ebl, idx), pos (q)); + break; + } + + memcpy (&subsection_len, q, sizeof subsection_len); + if (subsection_len == 0) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: zero length field in attribute subsection\n"), + idx, section_name (ebl, idx), pos (q)); + + q += sizeof subsection_len; + continue; + } + + if (MY_ELFDATA != ehdr->e_ident[EI_DATA]) + CONVERT (subsection_len); + + if (p - chunk < (ptrdiff_t) subsection_len) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: invalid length in attribute subsection\n"), + idx, section_name (ebl, idx), pos (q)); + break; + } + + const unsigned char *subsection_end = chunk + subsection_len; + chunk = q; + q = subsection_end; + + if (subsection_tag != 1) /* Tag_File */ + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: attribute subsection has unexpected tag %u\n"), + idx, section_name (ebl, idx), pos (chunk), subsection_tag); + else + { + chunk += sizeof subsection_len; + while (chunk < q) + { + unsigned int tag; + get_uleb128 (tag, chunk); + + uint64_t value = 0; + const unsigned char *r = chunk; + if (tag == 32 || (tag & 1) == 0) + { + get_uleb128 (value, r); + if (r > q) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: endless ULEB128 in attribute tag\n"), + idx, section_name (ebl, idx), pos (chunk)); + break; + } + } + if (tag == 32 || (tag & 1) != 0) + { + r = memchr (r, '\0', q - r); + if (r == NULL) + { + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: unterminated string in attribute\n"), + idx, section_name (ebl, idx), pos (chunk)); + break; + } + ++r; + } + + const char *tag_name = NULL; + const char *value_name = NULL; + if (!ebl_check_object_attribute (ebl, (const char *) name, + tag, value, + &tag_name, &value_name)) + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: unrecognized attribute tag %u\n"), + idx, section_name (ebl, idx), pos (chunk), tag); + else if ((tag & 1) == 0 && value_name == NULL) + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: unrecognized %s attribute value %" PRIu64 "\n"), + idx, section_name (ebl, idx), pos (chunk), + tag_name, value); + + chunk = r; + } + } + } + else + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: vendor '%s' unknown\n"), + idx, section_name (ebl, idx), pos (p), name); + } + + if (left () != 0) + ERROR (gettext ("\ +section [%2d] '%s': offset %zu: extra bytes after last attribute section\n"), + idx, section_name (ebl, idx), pos (p)); +} + +static bool has_loadable_segment; +static bool has_interp_segment; + +static const struct +{ + const char *name; + size_t namelen; + GElf_Word type; + enum { unused, exact, atleast, exact_or_gnuld } attrflag; + GElf_Word attr; + GElf_Word attr2; +} special_sections[] = + { + /* See figure 4-14 in the gABI. */ + { ".bss", 5, SHT_NOBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".comment", 8, SHT_PROGBITS, exact, 0, 0 }, + { ".data", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".data1", 7, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".debug_str", 11, SHT_PROGBITS, exact_or_gnuld, SHF_MERGE | SHF_STRINGS, 0 }, + { ".debug", 6, SHT_PROGBITS, exact, 0, 0 }, + { ".dynamic", 9, SHT_DYNAMIC, atleast, SHF_ALLOC, SHF_WRITE }, + { ".dynstr", 8, SHT_STRTAB, exact, SHF_ALLOC, 0 }, + { ".dynsym", 8, SHT_DYNSYM, exact, SHF_ALLOC, 0 }, + { ".fini", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 }, + { ".fini_array", 12, SHT_FINI_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".got", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more info? + { ".hash", 6, SHT_HASH, exact, SHF_ALLOC, 0 }, + { ".init", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 }, + { ".init_array", 12, SHT_INIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".interp", 8, SHT_PROGBITS, atleast, 0, SHF_ALLOC }, // XXX more tests? + { ".line", 6, SHT_PROGBITS, exact, 0, 0 }, + { ".note", 6, SHT_NOTE, atleast, 0, SHF_ALLOC }, + { ".plt", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more tests + { ".preinit_array", 15, SHT_PREINIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, + { ".rela", 5, SHT_RELA, atleast, 0, SHF_ALLOC }, // XXX more tests + { ".rel", 4, SHT_REL, atleast, 0, SHF_ALLOC }, // XXX more tests + { ".rodata", 8, SHT_PROGBITS, atleast, SHF_ALLOC, SHF_MERGE | SHF_STRINGS }, + { ".rodata1", 9, SHT_PROGBITS, atleast, SHF_ALLOC, SHF_MERGE | SHF_STRINGS }, + { ".shstrtab", 10, SHT_STRTAB, exact, 0, 0 }, + { ".strtab", 8, SHT_STRTAB, atleast, 0, SHF_ALLOC }, // XXX more tests + { ".symtab", 8, SHT_SYMTAB, atleast, 0, SHF_ALLOC }, // XXX more tests + { ".symtab_shndx", 14, SHT_SYMTAB_SHNDX, atleast, 0, SHF_ALLOC }, // XXX more tests + { ".tbss", 6, SHT_NOBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, + { ".tdata", 7, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, + { ".tdata1", 8, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE | SHF_TLS, 0 }, + { ".text", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_EXECINSTR, 0 }, + + /* The following are GNU extensions. */ + { ".gnu.version", 13, SHT_GNU_versym, exact, SHF_ALLOC, 0 }, + { ".gnu.version_d", 15, SHT_GNU_verdef, exact, SHF_ALLOC, 0 }, + { ".gnu.version_r", 15, SHT_GNU_verneed, exact, SHF_ALLOC, 0 }, + { ".gnu.attributes", 16, SHT_GNU_ATTRIBUTES, exact, 0, 0 }, + }; +#define nspecial_sections \ + (sizeof (special_sections) / sizeof (special_sections[0])) + +#define IS_KNOWN_SPECIAL(idx, string, prefix) \ + (special_sections[idx].namelen == sizeof string - (prefix ? 1 : 0) \ + && !memcmp (special_sections[idx].name, string, \ + sizeof string - (prefix ? 1 : 0))) + +static void +check_sections (Ebl *ebl, GElf_Ehdr *ehdr) +{ if (ehdr->e_shoff == 0) /* No section header. */ return; @@ -1947,7 +3372,8 @@ check_sections (Ebl *ebl, GElf_Ehdr *ehdr) /* Check the zeroth section first. It must not have any contents and the section header must contain nonzero value at most in the sh_size and sh_link fields. */ - shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); if (shdr == NULL) ERROR (gettext ("cannot get section header of zeroth section\n")); else @@ -1978,17 +3404,22 @@ zeroth section has nonzero size value while ELF header has nonzero shnum value\n zeroth section has nonzero link value while ELF header does not signal overflow in shstrndx\n")); } - for (cnt = 1; cnt < shnum; ++cnt) - { - Elf_Scn *scn; + int *segment_flags = xcalloc (ehdr->e_phnum, sizeof segment_flags[0]); - scn = elf_getscn (ebl->elf, cnt); - shdr = gelf_getshdr (scn, &shdr_mem); + bool dot_interp_section = false; + + size_t hash_idx = 0; + size_t gnu_hash_idx = 0; + + size_t versym_scnndx = 0; + for (size_t cnt = 1; cnt < shnum; ++cnt) + { + shdr = gelf_getshdr (elf_getscn (ebl->elf, cnt), &shdr_mem); if (shdr == NULL) { ERROR (gettext ("\ cannot get section header for section [%2zu] '%s': %s\n"), - cnt, section_name (ebl, ehdr, cnt), elf_errmsg (-1)); + cnt, section_name (ebl, cnt), elf_errmsg (-1)); continue; } @@ -2009,7 +3440,19 @@ cannot get section header for section [%2zu] '%s': %s\n"), char stbuf2[100]; char stbuf3[100]; - if (shdr->sh_type != special_sections[s].type) + GElf_Word good_type = special_sections[s].type; + if (IS_KNOWN_SPECIAL (s, ".plt", false) + && ebl_bss_plt_p (ebl, ehdr)) + good_type = SHT_NOBITS; + + /* In a debuginfo file, any normal section can be SHT_NOBITS. + This is only invalid for DWARF sections and .shstrtab. */ + if (shdr->sh_type != good_type + && (shdr->sh_type != SHT_NOBITS + || !is_debuginfo + || IS_KNOWN_SPECIAL (s, ".debug_str", false) + || IS_KNOWN_SPECIAL (s, ".debug", true) + || IS_KNOWN_SPECIAL (s, ".shstrtab", false))) ERROR (gettext ("\ section [%2d] '%s' has wrong type: expected %s, is %s\n"), (int) cnt, scnname, @@ -2018,12 +3461,14 @@ section [%2d] '%s' has wrong type: expected %s, is %s\n"), ebl_section_type_name (ebl, shdr->sh_type, stbuf2, sizeof (stbuf2))); - if (special_sections[s].attrflag == exact) + if (special_sections[s].attrflag == exact + || special_sections[s].attrflag == exact_or_gnuld) { /* Except for the link order and group bit all the other bits should match exactly. */ if ((shdr->sh_flags & ~(SHF_LINK_ORDER | SHF_GROUP)) - != special_sections[s].attr) + != special_sections[s].attr + && (special_sections[s].attrflag == exact || !gnuld)) ERROR (gettext ("\ section [%2zu] '%s' has wrong flags: expected %s, is %s\n"), cnt, scnname, @@ -2115,33 +3560,51 @@ section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable segments\n if (shdr->sh_entsize != 0 && shdr->sh_size % shdr->sh_entsize) ERROR (gettext ("\ section [%2zu] '%s': size not multiple of entry size\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); if (elf_strptr (ebl->elf, shstrndx, shdr->sh_name) == NULL) ERROR (gettext ("cannot get section header\n")); if (shdr->sh_type >= SHT_NUM + && shdr->sh_type != SHT_GNU_ATTRIBUTES && shdr->sh_type != SHT_GNU_LIBLIST && shdr->sh_type != SHT_CHECKSUM && shdr->sh_type != SHT_GNU_verdef && shdr->sh_type != SHT_GNU_verneed - && shdr->sh_type != SHT_GNU_versym) - ERROR (gettext ("unsupported section type %d\n"), (int) shdr->sh_type); + && shdr->sh_type != SHT_GNU_versym + && ebl_section_type_name (ebl, shdr->sh_type, NULL, 0) == NULL) + ERROR (gettext ("section [%2zu] '%s' has unsupported type %d\n"), + cnt, section_name (ebl, cnt), + (int) shdr->sh_type); #define ALL_SH_FLAGS (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR | SHF_MERGE \ | SHF_STRINGS | SHF_INFO_LINK | SHF_LINK_ORDER \ | SHF_OS_NONCONFORMING | SHF_GROUP | SHF_TLS) - if (shdr->sh_flags & ~ALL_SH_FLAGS) - ERROR (gettext ("section [%2zu] '%s' contain unknown flag(s) %d\n"), - cnt, section_name (ebl, ehdr, cnt), - (int) shdr->sh_flags & ~ALL_SH_FLAGS); - else if (shdr->sh_flags & SHF_TLS) + if (shdr->sh_flags & ~(GElf_Xword) ALL_SH_FLAGS) + { + GElf_Xword sh_flags = shdr->sh_flags & ~(GElf_Xword) ALL_SH_FLAGS; + if (sh_flags & SHF_MASKPROC) + { + if (!ebl_machine_section_flag_check (ebl, + sh_flags & SHF_MASKPROC)) + ERROR (gettext ("section [%2zu] '%s'" + " contains invalid processor-specific flag(s)" + " %#" PRIx64 "\n"), + cnt, section_name (ebl, cnt), sh_flags & SHF_MASKPROC); + sh_flags &= ~(GElf_Xword) SHF_MASKPROC; + } + if (sh_flags != 0) + ERROR (gettext ("section [%2zu] '%s' contains unknown flag(s)" + " %#" PRIx64 "\n"), + cnt, section_name (ebl, cnt), sh_flags); + } + if (shdr->sh_flags & SHF_TLS) { // XXX Correct? if (shdr->sh_addr != 0 && !gnuld) ERROR (gettext ("\ section [%2zu] '%s': thread-local data sections address not zero\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); // XXX TODO more tests!? } @@ -2149,27 +3612,52 @@ section [%2zu] '%s': thread-local data sections address not zero\n"), if (shdr->sh_link >= shnum) ERROR (gettext ("\ section [%2zu] '%s': invalid section reference in link value\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); if (SH_INFO_LINK_P (shdr) && shdr->sh_info >= shnum) ERROR (gettext ("\ section [%2zu] '%s': invalid section reference in info value\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); if ((shdr->sh_flags & SHF_MERGE) == 0 && (shdr->sh_flags & SHF_STRINGS) != 0 && be_strict) ERROR (gettext ("\ section [%2zu] '%s': strings flag set without merge flag\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); if ((shdr->sh_flags & SHF_MERGE) != 0 && shdr->sh_entsize == 0) ERROR (gettext ("\ section [%2zu] '%s': merge flag set but entry size is zero\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); if (shdr->sh_flags & SHF_GROUP) - check_scn_group (ebl, ehdr, cnt); + check_scn_group (ebl, cnt); + + if (shdr->sh_flags & SHF_EXECINSTR) + { + switch (shdr->sh_type) + { + case SHT_PROGBITS: + break; + + case SHT_NOBITS: + if (is_debuginfo) + break; + default: + ERROR (gettext ("\ +section [%2zu] '%s' has unexpected type %d for an executable section\n"), + cnt, section_name (ebl, cnt), shdr->sh_type); + break; + } + + if ((shdr->sh_flags & SHF_WRITE) + && !ebl_check_special_section (ebl, cnt, shdr, + section_name (ebl, cnt))) + ERROR (gettext ("\ +section [%2zu] '%s' is both executable and writable\n"), + cnt, section_name (ebl, cnt)); + } if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0) { @@ -2186,28 +3674,55 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"), || (phdr->p_type == PT_TLS && (shdr->sh_flags & SHF_TLS) != 0)) && phdr->p_offset <= shdr->sh_offset - && phdr->p_offset + phdr->p_memsz > shdr->sh_offset) + && (phdr->p_offset + phdr->p_filesz > shdr->sh_offset + || (phdr->p_offset + phdr->p_memsz > shdr->sh_offset + && shdr->sh_type == SHT_NOBITS))) { /* Found the segment. */ if (phdr->p_offset + phdr->p_memsz < shdr->sh_offset + shdr->sh_size) ERROR (gettext ("\ section [%2zu] '%s' not fully contained in segment of program header entry %d\n"), - cnt, section_name (ebl, ehdr, cnt), pcnt); + cnt, section_name (ebl, cnt), pcnt); if (shdr->sh_type == SHT_NOBITS) { - if (shdr->sh_offset < phdr->p_offset + phdr->p_filesz) + if (shdr->sh_offset < phdr->p_offset + phdr->p_filesz + && !is_debuginfo) ERROR (gettext ("\ section [%2zu] '%s' has type NOBITS but is read from the file in segment of program header entry %d\n"), - cnt, section_name (ebl, ehdr, cnt), pcnt); + cnt, section_name (ebl, cnt), pcnt); } else { - if (shdr->sh_offset >= phdr->p_offset + phdr->p_filesz) + const GElf_Off end = phdr->p_offset + phdr->p_filesz; + if (shdr->sh_offset > end || + (shdr->sh_offset == end && shdr->sh_size != 0)) ERROR (gettext ("\ section [%2zu] '%s' has not type NOBITS but is not read from the file in segment of program header entry %d\n"), - cnt, section_name (ebl, ehdr, cnt), pcnt); + cnt, section_name (ebl, cnt), pcnt); + } + + if (shdr->sh_type != SHT_NOBITS) + { + if ((shdr->sh_flags & SHF_EXECINSTR) != 0) + { + segment_flags[pcnt] |= PF_X; + if ((phdr->p_flags & PF_X) == 0) + ERROR (gettext ("\ +section [%2zu] '%s' is executable in nonexecutable segment %d\n"), + cnt, section_name (ebl, cnt), pcnt); + } + + if ((shdr->sh_flags & SHF_WRITE) != 0) + { + segment_flags[pcnt] |= PF_W; + if (0 /* XXX vdso images have this */ + && (phdr->p_flags & PF_W) == 0) + ERROR (gettext ("\ +section [%2zu] '%s' is writable in unwritable segment %d\n"), + cnt, section_name (ebl, cnt), pcnt); + } } break; @@ -2216,51 +3731,83 @@ section [%2zu] '%s' has not type NOBITS but is not read from the file in segment if (pcnt == ehdr->e_phnum) ERROR (gettext ("\ section [%2zu] '%s': alloc flag set but section not in any loaded segment\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); } if (cnt == shstrndx && shdr->sh_type != SHT_STRTAB) ERROR (gettext ("\ section [%2zu] '%s': ELF header says this is the section header string table but type is not SHT_TYPE\n"), - cnt, section_name (ebl, ehdr, cnt)); + cnt, section_name (ebl, cnt)); switch (shdr->sh_type) { - case SHT_SYMTAB: case SHT_DYNSYM: - check_symtab (ebl, ehdr, cnt); + if (ehdr->e_type == ET_REL) + ERROR (gettext ("\ +section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"), + cnt, section_name (ebl, cnt)); + /* FALLTHROUGH */ + case SHT_SYMTAB: + check_symtab (ebl, ehdr, shdr, cnt); break; case SHT_RELA: - check_rela (ebl, ehdr, cnt); + check_rela (ebl, ehdr, shdr, cnt); break; case SHT_REL: - check_rel (ebl, ehdr, cnt); + check_rel (ebl, ehdr, shdr, cnt); break; case SHT_DYNAMIC: - check_dynamic (ebl, ehdr, cnt); + check_dynamic (ebl, ehdr, shdr, cnt); break; case SHT_SYMTAB_SHNDX: - check_symtab_shndx (ebl, ehdr, cnt); + check_symtab_shndx (ebl, ehdr, shdr, cnt); break; case SHT_HASH: - check_hash (ebl, ehdr, cnt); + check_hash (shdr->sh_type, ebl, ehdr, shdr, cnt); + hash_idx = cnt; + break; + + case SHT_GNU_HASH: + check_hash (shdr->sh_type, ebl, ehdr, shdr, cnt); + gnu_hash_idx = cnt; break; case SHT_NULL: - check_null (ebl, ehdr, shdr, cnt); + check_null (ebl, shdr, cnt); break; case SHT_GROUP: check_group (ebl, ehdr, shdr, cnt); break; + case SHT_NOTE: + check_note_section (ebl, ehdr, shdr, cnt); + break; + case SHT_GNU_versym: - check_versym (ebl, ehdr, shdr, cnt); + /* We cannot process this section now since we have no guarantee + that the verneed and verdef sections have already been read. + Just remember the section index. */ + if (versym_scnndx != 0) + ERROR (gettext ("more than one version symbol table present\n")); + versym_scnndx = cnt; + break; + + case SHT_GNU_verneed: + check_verneed (ebl, ehdr, shdr, cnt); + break; + + case SHT_GNU_verdef: + check_verdef (ebl, shdr, cnt); + break; + + case SHT_GNU_ATTRIBUTES: + check_attributes (ebl, ehdr, shdr, cnt); break; default: @@ -2272,151 +3819,210 @@ section [%2zu] '%s': ELF header says this is the section header string table but if (has_interp_segment && !dot_interp_section) ERROR (gettext ("INTERP program header entry but no .interp section\n")); - free (scnref); -} - - -static void -check_note (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Phdr *phdr, int cnt) -{ - if (ehdr->e_type != ET_CORE && ehdr->e_type != ET_REL - && ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) - ERROR (gettext ("\ -phdr[%d]: no note entries defined for the type of file\n"), - cnt); + if (!is_debuginfo) + for (int pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); + if (phdr != NULL && (phdr->p_type == PT_LOAD || phdr->p_type == PT_TLS)) + { + if ((phdr->p_flags & PF_X) != 0 + && (segment_flags[pcnt] & PF_X) == 0) + ERROR (gettext ("\ +loadable segment [%u] is executable but contains no executable sections\n"), + pcnt); - char *notemem = gelf_rawchunk (ebl->elf, phdr->p_offset, phdr->p_filesz); + if ((phdr->p_flags & PF_W) != 0 + && (segment_flags[pcnt] & PF_W) == 0) + ERROR (gettext ("\ +loadable segment [%u] is writable but contains no writable sections\n"), + pcnt); + } + } - /* ELF64 files often use note section entries in the 32-bit format. - The p_align field is set to 8 in case the 64-bit format is used. - In case the p_align value is 0 or 4 the 32-bit format is - used. */ - GElf_Xword align = phdr->p_align == 0 || phdr->p_align == 4 ? 4 : 8; -#define ALIGNED_LEN(len) (((len) + align - 1) & ~(align - 1)) + free (segment_flags); - GElf_Xword idx = 0; - while (idx < phdr->p_filesz) + if (version_namelist != NULL) { - uint64_t namesz; - uint64_t descsz; - uint64_t type; - uint32_t namesz32; - uint32_t descsz32; + if (versym_scnndx == 0) + ERROR (gettext ("\ +no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section exist\n")); + else + check_versym (ebl, versym_scnndx); - if (align == 4) + /* Check for duplicate index numbers. */ + do { - uint32_t *ptr = (uint32_t *) (notemem + idx); - - if ((__BYTE_ORDER == __LITTLE_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2MSB) - || (__BYTE_ORDER == __BIG_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2LSB)) - { - namesz32 = namesz = bswap_32 (*ptr); - ++ptr; - descsz32 = descsz = bswap_32 (*ptr); - ++ptr; - type = bswap_32 (*ptr); - } - else + struct version_namelist *runp = version_namelist->next; + while (runp != NULL) { - namesz32 = namesz = *ptr++; - descsz32 = descsz = *ptr++; - type = *ptr; + if (version_namelist->ndx == runp->ndx) + { + ERROR (gettext ("duplicate version index %d\n"), + (int) version_namelist->ndx); + break; + } + runp = runp->next; } + + struct version_namelist *old = version_namelist; + version_namelist = version_namelist->next; + free (old); } - else - { - uint64_t *ptr = (uint64_t *) (notemem + idx); - uint32_t *ptr32 = (uint32_t *) (notemem + idx); + while (version_namelist != NULL); + } + else if (versym_scnndx != 0) + ERROR (gettext ("\ +.gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n")); - if ((__BYTE_ORDER == __LITTLE_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2MSB) - || (__BYTE_ORDER == __BIG_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2LSB)) - { - namesz = bswap_64 (*ptr); - ++ptr; - descsz = bswap_64 (*ptr); - ++ptr; - type = bswap_64 (*ptr); - - namesz32 = bswap_32 (*ptr32); - ++ptr32; - descsz32 = bswap_32 (*ptr32); - } - else - { - namesz = *ptr++; - descsz = *ptr++; - type = *ptr; + if (hash_idx != 0 && gnu_hash_idx != 0) + compare_hash_gnu_hash (ebl, ehdr, hash_idx, gnu_hash_idx); - namesz32 = *ptr32++; - descsz32 = *ptr32; - } - } + free (scnref); +} - if (idx + 3 * align > phdr->p_filesz - || (idx + 3 * align + ALIGNED_LEN (namesz) + ALIGNED_LEN (descsz) - > phdr->p_filesz)) - { - if (ehdr->e_ident[EI_CLASS] == ELFCLASS64 - && idx + 3 * 4 <= phdr->p_filesz - && (idx + 3 * 4 + ALIGNED_LEN (namesz32) + ALIGNED_LEN (descsz32) - <= phdr->p_filesz)) - ERROR (gettext ("\ -phdr[%d]: note entries probably in form of a 32-bit ELF file\n"), cnt); - else - ERROR (gettext ("phdr[%d]: extra %zu bytes after last note\n"), - cnt, (size_t) (phdr->p_filesz - idx)); - break; - } + +static GElf_Off +check_note_data (Ebl *ebl, const GElf_Ehdr *ehdr, + Elf_Data *data, int shndx, int phndx, GElf_Off start) +{ + size_t offset = 0; + size_t last_offset = 0; + GElf_Nhdr nhdr; + size_t name_offset; + size_t desc_offset; + while (offset < data->d_size + && (offset = gelf_getnote (data, offset, + &nhdr, &name_offset, &desc_offset)) > 0) + { + last_offset = offset; /* Make sure it is one of the note types we know about. */ if (ehdr->e_type == ET_CORE) - { - switch (type) - { - case NT_PRSTATUS: - case NT_FPREGSET: - case NT_PRPSINFO: - case NT_TASKSTRUCT: /* NT_PRXREG on Solaris. */ - case NT_PLATFORM: - case NT_AUXV: - case NT_GWINDOWS: - case NT_ASRS: - case NT_PSTATUS: - case NT_PSINFO: - case NT_PRCRED: - case NT_UTSNAME: - case NT_LWPSTATUS: - case NT_LWPSINFO: - case NT_PRFPXREG: - /* Known type. */ + switch (nhdr.n_type) + { + case NT_PRSTATUS: + case NT_FPREGSET: + case NT_PRPSINFO: + case NT_TASKSTRUCT: /* NT_PRXREG on Solaris. */ + case NT_PLATFORM: + case NT_AUXV: + case NT_GWINDOWS: + case NT_ASRS: + case NT_PSTATUS: + case NT_PSINFO: + case NT_PRCRED: + case NT_UTSNAME: + case NT_LWPSTATUS: + case NT_LWPSINFO: + case NT_PRFPXREG: + /* Known type. */ + break; + + default: + if (shndx == 0) + ERROR (gettext ("\ +phdr[%d]: unknown core file note type %" PRIu32 " at offset %" PRIu64 "\n"), + phndx, (uint32_t) nhdr.n_type, start + offset); + else + ERROR (gettext ("\ +section [%2d] '%s': unknown core file note type %" PRIu32 + " at offset %Zu\n"), + shndx, section_name (ebl, shndx), + (uint32_t) nhdr.n_type, offset); + } + else + switch (nhdr.n_type) + { + case NT_GNU_ABI_TAG: + case NT_GNU_HWCAP: + case NT_GNU_BUILD_ID: + break; + + case 0: + /* Linux vDSOs use a type 0 note for the kernel version word. */ + if (nhdr.n_namesz == sizeof "Linux" + && !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux")) break; - default: + default: + if (shndx == 0) ERROR (gettext ("\ -phdr[%d]: unknown core file note type %" PRIu64 " at offset %" PRIu64 "\n"), - cnt, type, idx); - } - } - else - { - if (type != NT_VERSION) - ERROR (gettext ("\ -phdr[%d]: unknown object file note type %" PRIu64 " at offset %" PRIu64 "\n"), - cnt, type, idx); - } +phdr[%d]: unknown object file note type %" PRIu32 " at offset %Zu\n"), + phndx, (uint32_t) nhdr.n_type, offset); + else + ERROR (gettext ("\ +section [%2d] '%s': unknown object file note type %" PRIu32 + " at offset %Zu\n"), + shndx, section_name (ebl, shndx), + (uint32_t) nhdr.n_type, offset); + } + } - /* Move to the next entry. */ - idx += 3 * align + ALIGNED_LEN (namesz) + ALIGNED_LEN (descsz); + return last_offset; +} - } +static void +check_note (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Phdr *phdr, int cnt) +{ + if (ehdr->e_type != ET_CORE && ehdr->e_type != ET_REL + && ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) + ERROR (gettext ("\ +phdr[%d]: no note entries defined for the type of file\n"), + cnt); + + if (is_debuginfo) + /* The p_offset values in a separate debug file are bogus. */ + return; - gelf_freechunk (ebl->elf, notemem); + if (phdr->p_filesz == 0) + return; + + GElf_Off notes_size = 0; + Elf_Data *data = elf_getdata_rawchunk (ebl->elf, + phdr->p_offset, phdr->p_filesz, + ELF_T_NHDR); + if (data != NULL) + notes_size = check_note_data (ebl, ehdr, data, 0, cnt, phdr->p_offset); + + if (notes_size == 0) + ERROR (gettext ("phdr[%d]: cannot get content of note section: %s\n"), + cnt, elf_errmsg (-1)); + else if (notes_size != phdr->p_filesz) + ERROR (gettext ("phdr[%d]: extra %" PRIu64 " bytes after last note\n"), + cnt, phdr->p_filesz - notes_size); } +static void +check_note_section (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +{ + if (shdr->sh_size == 0) + return; + + Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); + if (data == NULL) + { + ERROR (gettext ("section [%2d] '%s': cannot get section data\n"), + idx, section_name (ebl, idx)); + return; + } + + if (ehdr->e_type != ET_CORE && ehdr->e_type != ET_REL + && ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) + ERROR (gettext ("\ +section [%2d] '%s': no note entries defined for the type of file\n"), + idx, section_name (ebl, idx)); + + GElf_Off notes_size = check_note_data (ebl, ehdr, data, idx, 0, 0); + + if (notes_size == 0) + ERROR (gettext ("section [%2d] '%s': cannot get content of note section\n"), + idx, section_name (ebl, idx)); + else if (notes_size != shdr->sh_size) + ERROR (gettext ("section [%2d] '%s': extra %" PRIu64 + " bytes after last note\n"), + idx, section_name (ebl, idx), shdr->sh_size - notes_size); +} static void check_program_header (Ebl *ebl, GElf_Ehdr *ehdr) @@ -2447,10 +4053,12 @@ only executables, shared objects, and core files can have program headers\n")); } if (phdr->p_type >= PT_NUM && phdr->p_type != PT_GNU_EH_FRAME - && phdr->p_type != PT_GNU_STACK) + && phdr->p_type != PT_GNU_STACK && phdr->p_type != PT_GNU_RELRO + /* Check for a known machine-specific type. */ + && ebl_segment_type_name (ebl, phdr->p_type, NULL, 0) == NULL) ERROR (gettext ("\ -program header entry %d: unknown program header entry type\n"), - cnt); +program header entry %d: unknown program header entry type %#" PRIx64 "\n"), + cnt, (uint64_t) phdr->p_type); if (phdr->p_type == PT_LOAD) has_loadable_segment = true; @@ -2471,9 +4079,33 @@ more than one INTERP entry in program header\n")); } else if (phdr->p_type == PT_NOTE) check_note (ebl, ehdr, phdr, cnt); - else if (phdr->p_type == PT_DYNAMIC - && ehdr->e_type == ET_EXEC && ! has_interp_segment) - ERROR (gettext ("static executable cannot have dynamic sections\n")); + else if (phdr->p_type == PT_DYNAMIC) + { + if (ehdr->e_type == ET_EXEC && ! has_interp_segment) + ERROR (gettext ("\ +static executable cannot have dynamic sections\n")); + else + { + /* Check that the .dynamic section, if it exists, has + the same address. */ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC) + { + if (phdr->p_offset != shdr->sh_offset) + ERROR (gettext ("\ +dynamic section reference in program header has wrong offset\n")); + if (phdr->p_memsz != shdr->sh_size) + ERROR (gettext ("\ +dynamic section size mismatch in program and section header\n")); + break; + } + } + } + } else if (phdr->p_type == PT_GNU_RELRO) { if (++num_pt_relro == 2) @@ -2488,7 +4120,7 @@ more than one GNU_RELRO entry in program header\n")); GElf_Phdr phdr2_mem; GElf_Phdr *phdr2; - phdr2 = gelf_getphdr (ebl->elf, cnt, &phdr2_mem); + phdr2 = gelf_getphdr (ebl->elf, inner, &phdr2_mem); if (phdr2 == NULL) continue; @@ -2500,20 +4132,50 @@ more than one GNU_RELRO entry in program header\n")); if ((phdr2->p_flags & PF_W) == 0) ERROR (gettext ("\ loadable segment GNU_RELRO applies to is not writable\n")); - if ((phdr2->p_flags & PF_X) != 0) + if ((phdr2->p_flags &~ PF_W) != (phdr->p_flags &~ PF_W)) ERROR (gettext ("\ -loadable segment GNU_RELRO applies to is executable\n")); +loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), + cnt, inner); break; } } if (inner >= ehdr->e_phnum) ERROR (gettext ("\ -GNU_RELRO segment not contained in a loaded segment\n")); +%s segment not contained in a loaded segment\n"), "GNU_RELRO"); } } + else if (phdr->p_type == PT_PHDR) + { + /* Check that the region is in a writable segment. */ + int inner; + for (inner = 0; inner < ehdr->e_phnum; ++inner) + { + GElf_Phdr phdr2_mem; + GElf_Phdr *phdr2; + + phdr2 = gelf_getphdr (ebl->elf, inner, &phdr2_mem); + if (phdr2 != NULL + && phdr2->p_type == PT_LOAD + && phdr->p_vaddr >= phdr2->p_vaddr + && (phdr->p_vaddr + phdr->p_memsz + <= phdr2->p_vaddr + phdr2->p_memsz)) + break; + } - if (phdr->p_filesz > phdr->p_memsz) + if (inner >= ehdr->e_phnum) + ERROR (gettext ("\ +%s segment not contained in a loaded segment\n"), "PHDR"); + + /* Check that offset in segment corresponds to offset in ELF + header. */ + if (phdr->p_offset != ehdr->e_phoff) + ERROR (gettext ("\ +program header offset in ELF header and PHDR entry do not match")); + } + + if (phdr->p_filesz > phdr->p_memsz + && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE)) ERROR (gettext ("\ program header entry %d: file size greater than memory size\n"), cnt); @@ -2538,6 +4200,12 @@ process_elf_file (Elf *elf, const char *prefix, const char *suffix, { /* Reset variables. */ ndynamic = 0; + nverneed = 0; + nverdef = 0; + textrel = false; + needed_textrel = false; + has_loadable_segment = false; + has_interp_segment = false; GElf_Ehdr ehdr_mem; GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); @@ -2573,6 +4241,13 @@ process_elf_file (Elf *elf, const char *prefix, const char *suffix, headers at all. */ check_sections (ebl, ehdr); + /* Report if no relocation section needed the text relocation flag. */ + if (textrel && !needed_textrel) + ERROR (gettext ("text relocation flag set but not needed\n")); + /* Free the resources. */ ebl_closebackend (ebl); } + + +#include "debugpred.h" diff --git a/src/findtextrel.c b/src/findtextrel.c new file mode 100644 index 00000000..245db7fe --- /dev/null +++ b/src/findtextrel.c @@ -0,0 +1,611 @@ +/* Locate source files or functions which caused text relocations. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <libdw.h> +#include <libintl.h> +#include <locale.h> +#include <search.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +struct segments +{ + GElf_Addr from; + GElf_Addr to; +}; + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +/* Values for the parameters which have no short form. */ +#define OPT_DEBUGINFO 0x100 + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Input Selection:"), 0 }, + { "root", 'r', "PATH", 0, N_("Prepend PATH to all file names"), 0 }, + { "debuginfo", OPT_DEBUGINFO, "PATH", 0, + N_("Use PATH as root of debuginfo hierarchy"), 0 }, + + { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("\ +Locate source of text relocations in FILEs (a.out by default)."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[FILE...]"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + options, parse_opt, args_doc, doc, NULL, NULL, NULL +}; + + +/* Print symbols in file named FNAME. */ +static int process_file (const char *fname, bool more_than_one); + +/* Check for text relocations in the given file. The segment + information is known. */ +static void check_rel (size_t nsegments, struct segments segments[nsegments], + GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw, + const char *fname, bool more_than_one, + void **knownsrcs); + + + +/* User-provided root directory. */ +static const char *rootdir = "/"; + +/* Root of debuginfo directory hierarchy. */ +static const char *debuginfo_root; + + +int +main (int argc, char *argv[]) +{ + int remaining; + int result = 0; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + /* Tell the library which version we are expecting. */ + elf_version (EV_CURRENT); + + /* If the user has not specified the root directory for the + debuginfo hierarchy, we have to determine it ourselves. */ + if (debuginfo_root == NULL) + { + // XXX The runtime should provide this information. +#if defined __ia64__ || defined __alpha__ + debuginfo_root = "/usr/lib/debug"; +#else + debuginfo_root = (sizeof (long int) == 4 + ? "/usr/lib/debug" : "/usr/lib64/debug"); +#endif + } + + if (remaining == argc) + result = process_file ("a.out", false); + else + { + /* Process all the remaining files. */ + const bool more_than_one = remaining + 1 < argc; + + do + result |= process_file (argv[remaining], more_than_one); + while (++remaining < argc); + } + + return result; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "findtextrel (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case 'r': + rootdir = arg; + break; + + case OPT_DEBUGINFO: + debuginfo_root = arg; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +static void +noop (void *arg __attribute__ ((unused))) +{ +} + + +static int +process_file (const char *fname, bool more_than_one) +{ + int result = 0; + void *knownsrcs = NULL; + + size_t fname_len = strlen (fname); + size_t rootdir_len = strlen (rootdir); + const char *real_fname = fname; + if (fname[0] == '/' && (rootdir[0] != '/' || rootdir[1] != '\0')) + { + /* Prepend the user-provided root directory. */ + char *new_fname = alloca (rootdir_len + fname_len + 2); + *((char *) mempcpy (stpcpy (mempcpy (new_fname, rootdir, rootdir_len), + "/"), + fname, fname_len)) = '\0'; + real_fname = new_fname; + } + + int fd = open64 (real_fname, O_RDONLY); + if (fd == -1) + { + error (0, errno, gettext ("cannot open '%s'"), fname); + return 1; + } + + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf == NULL) + { + error (0, 0, gettext ("cannot create ELF descriptor for '%s': %s"), + fname, elf_errmsg (-1)); + goto err_close; + } + + /* Make sure the file is a DSO. */ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + error (0, 0, gettext ("cannot get ELF header '%s': %s"), + fname, elf_errmsg (-1)); + err_elf_close: + elf_end (elf); + err_close: + close (fd); + return 1; + } + + if (ehdr->e_type != ET_DYN) + { + error (0, 0, gettext ("'%s' is not a DSO or PIE"), fname); + goto err_elf_close; + } + + /* Determine whether the DSO has text relocations at all and locate + the symbol table. */ + Elf_Scn *symscn = NULL; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + /* Handle the section if it is a symbol table. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL) + { + error (0, 0, + gettext ("getting get section header of section %zu: %s"), + elf_ndxscn (scn), elf_errmsg (-1)); + goto err_elf_close; + } + + if (shdr->sh_type == SHT_DYNAMIC) + { + Elf_Data *data = elf_getdata (scn, NULL); + + for (size_t cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; + ++cnt) + { + GElf_Dyn dynmem; + GElf_Dyn *dyn; + + dyn = gelf_getdyn (data, cnt, &dynmem); + if (dyn == NULL) + { + error (0, 0, gettext ("cannot read dynamic section: %s"), + elf_errmsg (-1)); + goto err_elf_close; + } + + if (dyn->d_tag == DT_TEXTREL + || (dyn->d_tag == DT_FLAGS + && (dyn->d_un.d_val & DF_TEXTREL) != 0)) + goto have_textrel; + } + } + else if (shdr->sh_type == SHT_SYMTAB) + symscn = scn; + } + + error (0, 0, gettext ("no text relocations reported in '%s'"), fname); + return 1; + + have_textrel:; + int fd2 = -1; + Elf *elf2 = NULL; + /* Get the address ranges for the loaded segments. */ + size_t nsegments_max = 10; + size_t nsegments = 0; + struct segments *segments + = (struct segments *) malloc (nsegments_max * sizeof (segments[0])); + if (segments == NULL) + error (1, errno, gettext ("while reading ELF file")); + + for (int i = 0; i < ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); + if (phdr == NULL) + { + error (0, 0, + gettext ("cannot get program header index at offset %d: %s"), + i, elf_errmsg (-1)); + result = 1; + goto next; + } + + if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_W) == 0) + { + if (nsegments == nsegments_max) + { + nsegments_max *= 2; + segments + = (struct segments *) realloc (segments, + nsegments_max + * sizeof (segments[0])); + if (segments == NULL) + { + error (0, 0, gettext ("\ +cannot get program header index at offset %d: %s"), + i, elf_errmsg (-1)); + result = 1; + goto next; + } + } + + segments[nsegments].from = phdr->p_vaddr; + segments[nsegments].to = phdr->p_vaddr + phdr->p_memsz; + ++nsegments; + } + } + + if (nsegments > 0) + { + + Dwarf *dw = dwarf_begin_elf (elf, DWARF_C_READ, NULL); + /* Look for debuginfo files if the information is not the in + opened file itself. This makes only sense if the input file + is specified with an absolute path. */ + if (dw == NULL && fname[0] == '/') + { + size_t debuginfo_rootlen = strlen (debuginfo_root); + char *difname = (char *) alloca (rootdir_len + debuginfo_rootlen + + fname_len + 8); + strcpy (mempcpy (stpcpy (mempcpy (mempcpy (difname, rootdir, + rootdir_len), + debuginfo_root, + debuginfo_rootlen), + "/"), + fname, fname_len), + ".debug"); + + fd2 = open64 (difname, O_RDONLY); + if (fd2 != -1 + && (elf2 = elf_begin (fd2, ELF_C_READ_MMAP, NULL)) != NULL) + dw = dwarf_begin_elf (elf2, DWARF_C_READ, NULL); + } + + /* Look at all relocations and determine which modify + write-protected segments. */ + scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + /* Handle the section if it is a symbol table. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL) + { + error (0, 0, + gettext ("cannot get section header of section %Zu: %s"), + elf_ndxscn (scn), elf_errmsg (-1)); + result = 1; + goto next; + } + + if ((shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) + && symscn == NULL) + { + symscn = elf_getscn (elf, shdr->sh_link); + if (symscn == NULL) + { + error (0, 0, gettext ("\ +cannot get symbol table section %zu in '%s': %s"), + (size_t) shdr->sh_link, fname, elf_errmsg (-1)); + result = 1; + goto next; + } + } + + if (shdr->sh_type == SHT_REL) + { + Elf_Data *data = elf_getdata (scn, NULL); + + for (int cnt = 0; + (size_t) cnt < shdr->sh_size / shdr->sh_entsize; + ++cnt) + { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem); + if (rel == NULL) + { + error (0, 0, gettext ("\ +cannot get relocation at index %d in section %zu in '%s': %s"), + cnt, elf_ndxscn (scn), fname, elf_errmsg (-1)); + result = 1; + goto next; + } + + check_rel (nsegments, segments, rel->r_offset, elf, + symscn, dw, fname, more_than_one, &knownsrcs); + } + } + else if (shdr->sh_type == SHT_RELA) + { + Elf_Data *data = elf_getdata (scn, NULL); + + for (int cnt = 0; + (size_t) cnt < shdr->sh_size / shdr->sh_entsize; + ++cnt) + { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem); + if (rela == NULL) + { + error (0, 0, gettext ("\ +cannot get relocation at index %d in section %zu in '%s': %s"), + cnt, elf_ndxscn (scn), fname, elf_errmsg (-1)); + result = 1; + goto next; + } + + check_rel (nsegments, segments, rela->r_offset, elf, + symscn, dw, fname, more_than_one, &knownsrcs); + } + } + } + + dwarf_end (dw); + } + + next: + elf_end (elf); + elf_end (elf2); + close (fd); + if (fd2 != -1) + close (fd2); + + tdestroy (knownsrcs, noop); + + return result; +} + + +static int +ptrcompare (const void *p1, const void *p2) +{ + if ((uintptr_t) p1 < (uintptr_t) p2) + return -1; + if ((uintptr_t) p1 > (uintptr_t) p2) + return 1; + return 0; +} + + +static void +check_rel (size_t nsegments, struct segments segments[nsegments], + GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw, + const char *fname, bool more_than_one, void **knownsrcs) +{ + for (size_t cnt = 0; cnt < nsegments; ++cnt) + if (segments[cnt].from <= addr && segments[cnt].to > addr) + { + Dwarf_Die die_mem; + Dwarf_Die *die; + Dwarf_Line *line; + const char *src; + + if (more_than_one) + printf ("%s: ", fname); + + if ((die = dwarf_addrdie (dw, addr, &die_mem)) != NULL + && (line = dwarf_getsrc_die (die, addr)) != NULL + && (src = dwarf_linesrc (line, NULL, NULL)) != NULL) + { + /* There can be more than one relocation against one file. + Try to avoid multiple messages. And yes, the code uses + pointer comparison. */ + if (tfind (src, knownsrcs, ptrcompare) == NULL) + { + printf (gettext ("%s not compiled with -fpic/-fPIC\n"), src); + tsearch (src, knownsrcs, ptrcompare); + } + return; + } + else + { + /* At least look at the symbol table to see which function + the modified address is in. */ + Elf_Data *symdata = elf_getdata (symscn, NULL); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (symscn, &shdr_mem); + if (shdr != NULL) + { + GElf_Addr lowaddr = 0; + int lowidx = -1; + GElf_Addr highaddr = ~0ul; + int highidx = -1; + GElf_Sym sym_mem; + GElf_Sym *sym; + + for (int i = 0; (size_t) i < shdr->sh_size / shdr->sh_entsize; + ++i) + { + sym = gelf_getsym (symdata, i, &sym_mem); + if (sym == NULL) + continue; + + if (sym->st_value < addr && sym->st_value > lowaddr) + { + lowaddr = sym->st_value; + lowidx = i; + } + if (sym->st_value > addr && sym->st_value < highaddr) + { + highaddr = sym->st_value; + highidx = i; + } + } + + if (lowidx != -1) + { + sym = gelf_getsym (symdata, lowidx, &sym_mem); + assert (sym != NULL); + + const char *lowstr = elf_strptr (elf, shdr->sh_link, + sym->st_name); + + if (sym->st_value + sym->st_size > addr) + { + /* It is this function. */ + if (tfind (lowstr, knownsrcs, ptrcompare) == NULL) + { + printf (gettext ("\ +the file containing the function '%s' is not compiled with -fpic/-fPIC\n"), + lowstr); + tsearch (lowstr, knownsrcs, ptrcompare); + } + } + else if (highidx == -1) + printf (gettext ("\ +the file containing the function '%s' might not be compiled with -fpic/-fPIC\n"), + lowstr); + else + { + sym = gelf_getsym (symdata, highidx, &sym_mem); + assert (sym != NULL); + + printf (gettext ("\ +either the file containing the function '%s' or the file containing the function '%s' is not compiled with -fpic/-fPIC\n"), + lowstr, elf_strptr (elf, shdr->sh_link, + sym->st_name)); + } + return; + } + else if (highidx != -1) + { + sym = gelf_getsym (symdata, highidx, &sym_mem); + assert (sym != NULL); + + printf (gettext ("\ +the file containing the function '%s' might not be compiled with -fpic/-fPIC\n"), + elf_strptr (elf, shdr->sh_link, sym->st_name)); + return; + } + } + } + + printf (gettext ("\ +a relocation modifies memory at offset %llu in a write-protected segment\n"), + (unsigned long long int) addr); + break; + } +} + + +#include "debugpred.h" diff --git a/src/i386_ld.c b/src/i386_ld.c index 28304ca0..2702ef85 100644 --- a/src/i386_ld.c +++ b/src/i386_ld.c @@ -1,15 +1,27 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -38,8 +50,10 @@ static int (*old_open_outfile) (struct ld_state *, int, int, int); static int -elf_i386_open_outfile (struct ld_state *statep, int machine, int klass, - int data) +elf_i386_open_outfile (struct ld_state *statep, + int machine __attribute__ ((unused)), + int klass __attribute__ ((unused)), + int data __attribute__ ((unused))) { /* This backend only handles 32-bit object files. */ /* XXX For now just use the generic backend. */ @@ -50,15 +64,15 @@ elf_i386_open_outfile (struct ld_state *statep, int machine, int klass, /* Process relocations for the output in a relocatable file. This only means adjusting offset and symbol indices. */ static void -elf_i386_relocate_section (struct ld_state *statep, Elf_Scn *outscn, - struct scninfo *firstp, +elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)), + Elf_Scn *outscn, struct scninfo *firstp, const Elf32_Word *dblindirect) { struct scninfo *runp; Elf_Data *data; /* Iterate over all the input sections. Appropriate data buffers in the - output sections were already created. I get them iteratively, too. */ + output sections were already created. */ runp = firstp; data = NULL; do @@ -135,8 +149,8 @@ elf_i386_relocate_section (struct ld_state *statep, Elf_Scn *outscn, assert (xndx < SHN_LORESERVE || xndx > SHN_HIRESERVE); /* We fortunately don't have to do much. The relocations - mostly get only updates of the offset. Only is a - relocation referred to a section do we have to do + mostly get only updates of the offset. Only for a + relocation referring to a section do we have to do something. In this case the reference to the sections has no direct equivalent since the part the input section contributes need not start at the same offset as in the @@ -145,15 +159,13 @@ elf_i386_relocate_section (struct ld_state *statep, Elf_Scn *outscn, itself. */ if (XELF_ST_TYPE (sym->st_info) == STT_SECTION) { - Elf32_Word toadd; - - /* We expect here on R_386_32 relocations. */ + /* We expect here only R_386_32 relocations. */ assert (XELF_R_TYPE (rel->r_info) == R_386_32); /* Avoid writing to the section memory if this is effectively a no-op since it might save a copy-on-write operation. */ - toadd = file->scninfo[xndx].offset; + Elf32_Word toadd = file->scninfo[xndx].offset; if (toadd != 0) add_4ubyte_unaligned (reltgtdata->d_buf + rel->r_offset, toadd); @@ -202,8 +214,9 @@ elf_i386_initialize_plt (struct ld_state *statep, Elf_Scn *scn) relocation routines) and one for each function we call in a DSO. */ data->d_size = (1 + statep->nplt) * PLT_ENTRY_SIZE; data->d_buf = xcalloc (1, data->d_size); - data->d_align = 8; + assert (data->d_type == ELF_T_BYTE); data->d_off = 0; + data->d_align = 8; statep->nplt_used = 1; } @@ -220,9 +233,10 @@ elf_i386_initialize_pltrel (struct ld_state *statep, Elf_Scn *scn) elf_errmsg (-1)); /* One relocation per PLT entry. */ - data->d_size = statep->nplt * sizeof (Elf32_Rel); - data->d_buf = xcalloc (1, data->d_size); + size_t size = statep->nplt * sizeof (Elf32_Rel); + data->d_buf = xcalloc (1, size); data->d_type = ELF_T_REL; + data->d_size = size; data->d_align = 4; data->d_off = 0; } @@ -231,26 +245,45 @@ elf_i386_initialize_pltrel (struct ld_state *statep, Elf_Scn *scn) static void elf_i386_initialize_got (struct ld_state *statep, Elf_Scn *scn) { - Elf_Data *data; - - /* If we have no .plt we don't need the special entries we normally - create for it. The other contents is created later. */ - if (statep->ngot + statep->nplt == 0) - return; + /* If we come here we better need a GOT. */ + assert (statep->ngot != 0); - data = elf_newdata (scn); + Elf_Data *data = elf_newdata (scn); if (data == NULL) error (EXIT_FAILURE, 0, gettext ("cannot allocate GOT section: %s"), elf_errmsg (-1)); - /* We construct the .got section in pieces. Here we only add the data + /* Just a single word per GOT entry is needed. */ + size_t size = statep->ngot * sizeof (Elf32_Addr); + data->d_buf = xcalloc (1, size); + data->d_size = size; + data->d_type = ELF_T_WORD; + data->d_off = 0; + data->d_align = sizeof (Elf32_Addr); +} + + +static void +elf_i386_initialize_gotplt (struct ld_state *statep, Elf_Scn *scn) +{ + /* If we come here we better need a PLT. */ + assert (statep->nplt != 0); + + Elf_Data *data = elf_newdata (scn); + if (data == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot allocate GOTPLT section: %s"), + elf_errmsg (-1)); + + /* We construct the .got.plt section in pieces. Here we only add the data structures which are used by the PLT. This includes three reserved entries at the beginning (the first will contain a pointer to the .dynamic section), and one word for each PLT entry. */ - data->d_size = (3 + statep->ngot + statep->nplt) * sizeof (Elf32_Addr); - data->d_buf = xcalloc (1, data->d_size); - data->d_align = sizeof (Elf32_Addr); + size_t size = (3 + statep->nplt) * sizeof (Elf32_Addr); + data->d_buf = xcalloc (1, size); + data->d_type = ELF_T_WORD; + data->d_size = size; data->d_off = 0; + data->d_align = sizeof (Elf32_Addr); } @@ -262,7 +295,8 @@ static const unsigned char elf_i386_plt0_entry[PLT_ENTRY_SIZE] = 0, 0, 0, 0, /* replaced with address of .got + 4. */ 0xff, 0x25, /* jmp indirect */ 0, 0, 0, 0, /* replaced with address of .got + 8. */ - 0, 0, 0, 0 /* pad out to 16 bytes. */ + 0x0f, 0x0b, /* ud2a, to prevent further decoding. */ + 0, 0 /* pad out to 16 bytes. */ }; /* Type describing the first PLT entry in non-PIC. */ @@ -283,7 +317,8 @@ static const unsigned char elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] = { 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */ 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */ - 0, 0, 0, 0 /* pad out to 16 bytes. */ + 0x0f, 0x0b, /* ud2a, to prevent further decoding. */ + 0, 0 /* pad out to 16 bytes. */ }; /* Contents of all but the first PLT entry in executable. */ @@ -324,46 +359,48 @@ struct plt_entry static void -elf_i386_finalize_plt (struct ld_state *statep, size_t nsym, size_t nsym_dyn) +elf_i386_finalize_plt (struct ld_state *statep, size_t nsym, + size_t nsym_local, struct symbol **ndxtosym) { + if (unlikely (statep->nplt + statep->ngot == 0)) + /* Nothing to be done. */ + return; + Elf_Scn *scn; XElf_Shdr_vardef (shdr); Elf_Data *data; - Elf_Data *symdata = NULL; - Elf_Data *dynsymdata; - size_t cnt; const bool build_dso = statep->file_type == dso_file_type; - if (unlikely (statep->nplt + statep->ngot == 0)) - /* Nothing to be done. */ - return; - - /* Get the address of the got section. */ - scn = elf_getscn (statep->outelf, statep->gotscnidx); + /* Get the address of the .got.plt section. */ + scn = elf_getscn (statep->outelf, statep->gotpltscnidx); xelf_getshdr (scn, shdr); data = elf_getdata (scn, NULL); assert (shdr != NULL && data != NULL); + /* The address points to the .got.plt section, not the .got section. */ Elf32_Addr gotaddr = shdr->sh_addr; - /* Now create the initial values for the .got section. The first - word contains the address of the .dynamic section. */ + /* Now create the initial values for the .got.plt section. The + first word contains the address of the .dynamic section. The + second and third entry are left empty for use by the dynamic + linker. The following entries are pointers to the instructions + following the initial jmp instruction in the corresponding PLT + entry. */ xelf_getshdr (elf_getscn (statep->outelf, statep->dynamicscnidx), shdr); assert (shdr != NULL); ((Elf32_Word *) data->d_buf)[0] = shdr->sh_addr; - /* The second and third entry are left empty for use by the dynamic - linker. The following entries are pointers to the instructions - following the initial jmp instruction in the corresponding PLT - entry. Since the first PLT entry is special the first used one - has the index 1. */ + /* The PLT contains code which a user of a function jumps to. The first + PLT entry is special, so the first used one has the index 1. */ scn = elf_getscn (statep->outelf, statep->pltscnidx); - xelf_getshdr (scn, shdr); - assert (shdr != NULL); + XElf_Shdr_vardef (pltshdr); + xelf_getshdr (scn, pltshdr); + assert (pltshdr != NULL); - dynsymdata = elf_getdata (elf_getscn (statep->outelf, statep->dynsymscnidx), - NULL); + Elf_Data *dynsymdata = elf_getdata (elf_getscn (statep->outelf, + statep->dynsymscnidx), NULL); assert (dynsymdata != NULL); + Elf_Data *symdata = NULL; if (statep->symscnidx != 0) { symdata = elf_getdata (elf_getscn (statep->outelf, statep->symscnidx), @@ -371,43 +408,40 @@ elf_i386_finalize_plt (struct ld_state *statep, size_t nsym, size_t nsym_dyn) assert (symdata != NULL); } - for (cnt = 0; cnt < statep->nplt; ++cnt) - { - assert ((4 + cnt) * sizeof (Elf32_Word) <= data->d_size); - - /* Address in the PLT. */ - Elf32_Addr pltentryaddr = shdr->sh_addr + (1 + cnt) * PLT_ENTRY_SIZE; - - /* Point the GOT entry at the PLT entry, after the initial jmp. */ - ((Elf32_Word *) data->d_buf)[3 + cnt] = pltentryaddr + 6; - - /* The value of the symbol is the address of the corresponding PLT - entry. Store the address, also for the normal symbol table if - this is necessary. */ - ((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_value = pltentryaddr; - - if (symdata != NULL) - ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + cnt].st_value - = pltentryaddr; - } - /* Create the .plt section. */ scn = elf_getscn (statep->outelf, statep->pltscnidx); - data = elf_getdata (scn, NULL); - assert (data != NULL); + Elf_Data *pltdata = elf_getdata (scn, NULL); + assert (pltdata != NULL); - /* Create the first entry. */ - assert (data->d_size >= PLT_ENTRY_SIZE); + /* Also create the .rel.plt section data. It simply means relocations + addressing the corresponding entry in the .got.plt section. The + section name is misleading. */ + scn = elf_getscn (statep->outelf, statep->pltrelscnidx); + xelf_getshdr (scn, shdr); + Elf_Data *reldata = elf_getdata (scn, NULL); + assert (shdr != NULL && reldata != NULL); + + /* Update the sh_link to point to the section being modified. We + point it here (correctly) to the .got.plt section. Some linkers + (e.g., the GNU binutils linker) point to the .plt section. This + is wrong since the .plt section isn't modified even though the + name .rel.plt suggests that this is correct. */ + shdr->sh_link = statep->dynsymscnidx; + shdr->sh_info = statep->gotpltscnidx; + (void) xelf_update_shdr (scn, shdr); + + /* Create the first entry of the .plt section. */ + assert (pltdata->d_size >= PLT_ENTRY_SIZE); if (build_dso) /* Copy the entry. It's complete, no relocation needed. */ - memcpy (data->d_buf, elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE); + memcpy (pltdata->d_buf, elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE); else { /* Copy the skeleton. */ - memcpy (data->d_buf, elf_i386_plt0_entry, PLT_ENTRY_SIZE); + memcpy (pltdata->d_buf, elf_i386_plt0_entry, PLT_ENTRY_SIZE); /* And fill in the addresses. */ - struct plt0_entry *addr = (struct plt0_entry *) data->d_buf; + struct plt0_entry *addr = (struct plt0_entry *) pltdata->d_buf; addr->gotp4_addr = target_bswap_32 (gotaddr + 4); addr->gotp8_addr = target_bswap_32 (gotaddr + 8); } @@ -419,54 +453,68 @@ elf_i386_finalize_plt (struct ld_state *statep, size_t nsym, size_t nsym_dyn) const unsigned char *plt_template = build_dso ? elf_i386_pic_plt_entry : elf_i386_plt_entry; - for (cnt = 0; cnt < statep->nplt; ++cnt) + for (size_t idx = nsym_local; idx < nsym; ++idx) { - struct plt_entry *addr; + struct symbol *symbol = ndxtosym[idx]; + if (symbol == NULL || symbol->type != STT_FUNC + || ndxtosym[idx]->outdynsymidx == 0 + // XXX is the following test correct? + || ! ndxtosym[idx]->in_dso) + continue; + + size_t pltidx = symbol->merge.value; - /* Copy the template. */ - assert (data->d_size >= (2 + cnt) * PLT_ENTRY_SIZE); - addr = (struct plt_entry *) ((char *) data->d_buf - + (1 + cnt) * PLT_ENTRY_SIZE); + assert (pltidx > 0); + assert ((3 + pltidx) * sizeof (Elf32_Word) <= data->d_size); + + /* Address in the PLT. */ + Elf32_Addr pltentryaddr = (pltshdr->sh_addr + pltidx * PLT_ENTRY_SIZE); + + /* Point the GOT entry at the PLT entry, after the initial jmp. */ + ((Elf32_Word *) data->d_buf)[2 + pltidx] = pltentryaddr + 6; + + /* If the symbol is defined, adjust the address. */ + if (((Elf32_Sym *) dynsymdata->d_buf)[ndxtosym[idx]->outdynsymidx].st_shndx != SHN_UNDEF) + { + /* The value of the symbol is the address of the corresponding PLT + entry. Store the address, also for the normal symbol table if + this is necessary. */ + ((Elf32_Sym *) dynsymdata->d_buf)[pltidx].st_value = pltentryaddr; + + if (symdata != NULL) + { + assert(nsym - statep->nplt + (pltidx - 1) == idx); + ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + + (pltidx - 1)].st_value + = pltentryaddr; + } + } + + /* Copy the PLT entry template. */ + assert (pltdata->d_size >= (1 + pltidx) * PLT_ENTRY_SIZE); + struct plt_entry *addr = (struct plt_entry *) ((char *) pltdata->d_buf + + (pltidx + * PLT_ENTRY_SIZE)); memcpy (addr, plt_template, PLT_ENTRY_SIZE); /* And once more, fill in the addresses. First the address of this symbol in .got. */ addr->offset_got = target_bswap_32 (gotaddr_off - + (3 + cnt) * sizeof (Elf32_Addr)); + + (2 + pltidx) * sizeof (Elf32_Addr)); /* Offset into relocation table. */ - addr->push_imm = target_bswap_32 (cnt * sizeof (Elf32_Rel)); + addr->push_imm = target_bswap_32 ((pltidx - 1) * sizeof (Elf32_Rel)); /* Offset to start of .plt. */ - addr->plt0_offset = target_bswap_32 (-(2 + cnt) * PLT_ENTRY_SIZE); - } + addr->plt0_offset = target_bswap_32 (-(1 + pltidx) * PLT_ENTRY_SIZE); - /* Create the .rel.plt section data. It simply means relocations - addressing the corresponding entry in the .got section. The - section name is misleading. */ - scn = elf_getscn (statep->outelf, statep->pltrelscnidx); - xelf_getshdr (scn, shdr); - data = elf_getdata (scn, NULL); - assert (shdr != NULL && data != NULL); - - /* Update the sh_link to point to the section being modified. We - point it here (correctly) to the .got section. Some linkers - (e.g., the GNU binutils linker) point to the .plt section. This - is wrong since the .plt section isn't modified even though the - name .rel.plt suggests that this is correct. */ - shdr->sh_link = statep->dynsymscnidx; - shdr->sh_info = statep->gotscnidx; - (void) xelf_update_shdr (scn, shdr); - for (cnt = 0; cnt < statep->nplt; ++cnt) - { XElf_Rel_vardef (rel); - - assert ((1 + cnt) * sizeof (Elf32_Rel) <= data->d_size); - xelf_getrel_ptr (data, cnt, rel); - rel->r_offset = gotaddr + (3 + cnt) * sizeof (Elf32_Addr); + assert (pltidx * sizeof (Elf32_Rel) <= reldata->d_size); + xelf_getrel_ptr (reldata, pltidx - 1, rel); + rel->r_offset = gotaddr + (2 + pltidx) * sizeof (Elf32_Addr); /* The symbol table entries for the functions from DSOs are at - the end of the symbol table. */ - rel->r_info = XELF_R_INFO (1 + cnt, R_386_JMP_SLOT); - (void) xelf_update_rel (data, cnt, rel); + the beginning of the symbol table. */ + rel->r_info = XELF_R_INFO (ndxtosym[idx]->outdynsymidx, R_386_JMP_SLOT); + (void) xelf_update_rel (reldata, pltidx - 1, rel); } } @@ -503,18 +551,28 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) /* XXX Should we complain about failing accesses? */ if (rel != NULL) { - int r_sym = XELF_R_SYM (rel->r_info); + Elf32_Word r_sym = XELF_R_SYM (rel->r_info); + + /* Symbols in COMDAT group sections which are discarded do + not have to be relocated. */ + if (r_sym >= scninfo->fileinfo->nlocalsymbols + && unlikely (scninfo->fileinfo->symref[r_sym] == NULL)) + continue; switch (XELF_R_TYPE (rel->r_info)) { case R_386_GOT32: - if (! scninfo->fileinfo->symref[r_sym]->defined) - relsize += sizeof (Elf32_Rel); + if (! scninfo->fileinfo->symref[r_sym]->defined + || scninfo->fileinfo->symref[r_sym]->in_dso + || statep->file_type == dso_file_type) + { + relsize += sizeof (Elf32_Rel); + ++statep->nrel_got; + } - /* This relocation is not emitted in the output file but - requires a GOT entry. */ + /* Even if this relocation is not emitted in the output + file it requires a GOT entry. */ ++statep->ngot; - ++statep->nrel_got; /* FALLTHROUGH */ @@ -531,6 +589,8 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) if (statep->file_type == dso_file_type) { relsize += sizeof (Elf32_Rel); + // XXX Do we have to check whether the target + // XXX section is read-only first? statep->dt_flags |= DF_TEXTREL; } else @@ -550,10 +610,9 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) } } else if (statep->file_type == dso_file_type - && r_sym >= SCNINFO_SHDR (scninfo->fileinfo->scninfo[shdr->sh_link].shdr).sh_info - && scninfo->fileinfo->symref[r_sym]->outdynsymidx != 0 && XELF_R_TYPE (rel->r_info) == R_386_32) relsize += sizeof (Elf32_Rel); + break; case R_386_PLT32: @@ -566,10 +625,9 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) If the symbol is not defined and we are not creating a statically linked binary, then we need in any case a PLT entry. */ - if (! scninfo->fileinfo->symref[r_sym]->defined) + if (! scninfo->fileinfo->symref[r_sym]->defined + && !statep->statically) { - assert (!statep->statically); - sym = scninfo->fileinfo->symref[r_sym]; sym->type = STT_FUNC; sym->in_dso = 1; @@ -588,7 +646,36 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) } break; + case R_386_TLS_LDO_32: + if (statep->file_type != executable_file_type) + abort (); + /* We do not need a relocation in the output file. */ + break; + + case R_386_TLS_LE: + /* We never need a relocation in the output file. */ + break; + + case R_386_TLS_IE: + if (statep->file_type == dso_file_type) + error (EXIT_FAILURE, 0, gettext ("initial-executable TLS relocation cannot be used ")); + if (!scninfo->fileinfo->symref[r_sym]->defined + || scninfo->fileinfo->symref[r_sym]->in_dso) + { + abort (); + } + break; + case R_386_TLS_GD: + if (statep->file_type != executable_file_type + || !scninfo->fileinfo->symref[r_sym]->defined + || scninfo->fileinfo->symref[r_sym]->in_dso) + { + abort (); + } + break; + + case R_386_TLS_GOTIE: case R_386_TLS_LDM: case R_386_TLS_GD_32: case R_386_TLS_GD_PUSH: @@ -598,7 +685,6 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) case R_386_TLS_LDM_PUSH: case R_386_TLS_LDM_CALL: case R_386_TLS_LDM_POP: - case R_386_TLS_LDO_32: case R_386_TLS_IE_32: case R_386_TLS_LE_32: /* XXX */ @@ -631,7 +717,7 @@ elf_i386_count_relocations (struct ld_state *statep, struct scninfo *scninfo) static void elf_i386_create_relocations (struct ld_state *statep, - const Elf32_Word *dblindirect) + const Elf32_Word *dblindirect __attribute__ ((unused))) { /* Get the address of the got section. */ Elf_Scn *pltscn = elf_getscn (statep->outelf, statep->pltscnidx); @@ -640,15 +726,25 @@ elf_i386_create_relocations (struct ld_state *statep, Elf32_Addr pltaddr = shdr->sh_addr; Elf_Scn *gotscn = elf_getscn (statep->outelf, statep->gotscnidx); - shdr = elf32_getshdr (gotscn); + // XXX Adjust the address, if necessary, for relro + Elf_Data *gotdata = NULL; + if (statep->need_got) + { + gotdata = elf_getdata (gotscn, NULL); + assert (gotdata != NULL); + } + + Elf_Scn *gotpltscn = elf_getscn (statep->outelf, statep->gotpltscnidx); + shdr = elf32_getshdr (gotpltscn); assert (shdr != NULL); Elf32_Addr gotaddr = shdr->sh_addr; Elf_Scn *reldynscn = elf_getscn (statep->outelf, statep->reldynscnidx); Elf_Data *reldyndata = elf_getdata (reldynscn, NULL); + assert (reldyndata != NULL); size_t nreldyn = 0; -#define ngot_used (3 + statep->nplt + nreldyn) + size_t ngotconst = statep->nrel_got; struct scninfo *first = statep->rellist->next; struct scninfo *runp = first; @@ -658,7 +754,7 @@ elf_i386_create_relocations (struct ld_state *statep, Elf_Data *reldata = elf_getdata (runp->scn, NULL); int nrels = rshdr->sh_size / rshdr->sh_entsize; - /* We will need the following vlaues a couple of times. Help + /* We will need the following values a couple of times. Help the compiler and improve readability. */ struct symbol **symref = runp->fileinfo->symref; struct scninfo *scninfo = runp->fileinfo->scninfo; @@ -677,8 +773,7 @@ elf_i386_create_relocations (struct ld_state *statep, /* Cache the access to the symbol table data. */ Elf_Data *symdata = elf_getdata (scninfo[rshdr->sh_link].scn, NULL); - int cnt; - for (cnt = 0; cnt < nrels; ++cnt) + for (int cnt = 0; cnt < nrels; ++cnt) { XElf_Rel_vardef (rel); XElf_Rel *rel2; @@ -693,24 +788,30 @@ elf_i386_create_relocations (struct ld_state *statep, XElf_Sym_vardef (sym); xelf_getsym (symdata, idx, sym); - /* The value just depends on the position of the referenced + /* The value only depends on the position of the referenced section in the output file and the addend. */ value = scninfo[sym->st_shndx].offset + sym->st_value; } - else if (symref[idx]->in_dso) + else { - /* MERGE.VALUE contains the PLT index. We have to add 1 since - there is this one special PLT entry at the beginning. */ - assert (symref[idx]->merge.value != 0 - || symref[idx]->type != STT_FUNC); - value = pltaddr + symref[idx]->merge.value * PLT_ENTRY_SIZE; + if (symref[idx] == NULL) + /* Symbol in ignored COMDAT group section. */ + continue; + + value = symref[idx]->merge.value; + if (symref[idx]->in_dso) + { + /* MERGE.VALUE contains the PLT index. If this is not for + a function the actual value will be computed later. */ + assert (value != 0 || symref[idx]->type != STT_FUNC); + value = pltaddr + value * PLT_ENTRY_SIZE; + } } - else - value = symref[idx]->merge.value; /* Address of the relocated memory in the data buffer. */ - void *relloc = (char *) data->d_buf + rel->r_offset; + unsigned char *relloc = (unsigned char *) data->d_buf + rel->r_offset; + uint32_t thisgotidx; switch (XELF_R_TYPE (rel->r_info)) { /* These three cases can be handled together since the @@ -746,6 +847,7 @@ elf_i386_create_relocations (struct ld_state *statep, = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_COPY); (void) xelf_update_rel (reldyndata, nreldyn, rel2); ++nreldyn; + assert (nreldyn <= statep->nrel_got); /* Update the symbol table record for the new address. */ @@ -779,8 +881,7 @@ elf_i386_create_relocations (struct ld_state *statep, } } else if (statep->file_type == dso_file_type - && idx >= SCNINFO_SHDR (scninfo[rshdr->sh_link].shdr).sh_info - && symref[idx]->outdynsymidx != 0) + && XELF_R_TYPE (rel->r_info) == R_386_32) { #if NATIVE_ELF != 0 xelf_getrel_ptr (reldyndata, nreldyn, rel2); @@ -788,10 +889,18 @@ elf_i386_create_relocations (struct ld_state *statep, rel2 = &rel_mem; #endif rel2->r_offset = value; - rel2->r_info - = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_32); + + /* For symbols we do not export we generate a relative + relocation. */ + if (idx < SCNINFO_SHDR (scninfo[rshdr->sh_link].shdr).sh_info + || symref[idx]->outdynsymidx == 0) + rel2->r_info = XELF_R_INFO (0, R_386_RELATIVE); + else + rel2->r_info + = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_32); (void) xelf_update_rel (reldyndata, nreldyn, rel2); ++nreldyn; + assert (nreldyn <= statep->nrel_got); value = 0; } @@ -799,31 +908,142 @@ elf_i386_create_relocations (struct ld_state *statep, break; case R_386_GOT32: - store_4ubyte_unaligned (relloc, ngot_used * sizeof (Elf32_Addr)); + if (! symref[idx]->defined || symref[idx]->in_dso) + { + thisgotidx = nreldyn++; + assert (thisgotidx < statep->nrel_got); - /* Add a relocation to initialize the GOT entry. */ + /* Add a relocation to initialize the GOT entry. */ #if NATIVE_ELF != 0 - xelf_getrel_ptr (reldyndata, nreldyn, rel2); + xelf_getrel_ptr (reldyndata, thisgotidx, rel2); #else - rel2 = &rel_mem; + rel2 = &rel_mem; #endif - rel2->r_offset = gotaddr + ngot_used * sizeof (Elf32_Addr); - rel2->r_info - = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_GLOB_DAT); - (void) xelf_update_rel (reldyndata, nreldyn, rel2); - ++nreldyn; + rel2->r_offset = gotaddr + ((thisgotidx - statep->ngot) + * sizeof (Elf32_Addr)); + rel2->r_info + = XELF_R_INFO (symref[idx]->outdynsymidx, R_386_GLOB_DAT); + (void) xelf_update_rel (reldyndata, thisgotidx, rel2); + } + else if (statep->file_type != dso_file_type) + { + thisgotidx = ngotconst++; + assert (thisgotidx < statep->ngot); + + /* We have to use a GOT since the generated code + requires it but we know the address and therefore + do not need a relocation. */ + ((uint32_t *) gotdata->d_buf)[thisgotidx] = value; + } + else + { + thisgotidx = nreldyn++; + assert (thisgotidx < statep->nrel_got); + + // XXX generate a relative relocation. + abort (); + } + + store_4ubyte_unaligned (relloc, + (thisgotidx - statep->ngot) + * sizeof (Elf32_Addr)); break; case R_386_GOTOFF: add_4ubyte_unaligned (relloc, value - gotaddr); break; + case R_386_TLS_LE: + value = symref[idx]->merge.value - ld_state.tls_tcb; + store_4ubyte_unaligned (relloc, value); + break; + + case R_386_TLS_IE: + if (symref[idx]->defined && !symref[idx]->in_dso) + { + /* The symbol is defined in the executable. + Perform the IE->LE optimization. + There are multiple versions, though. + + First version: mov ADDR,REG. */ + if (relloc[-2] == 0x8b + && ((relloc[-1] & 0xc7) == 0x05)) + { + relloc[-2] = 0xc7; + relloc[-1] = 0xc0 | ((relloc[-1] >> 3) & 7); + store_4ubyte_unaligned (relloc, (symref[idx]->merge.value + - ld_state.tls_tcb)); + } + else + { + abort (); + } + } + else + { + abort (); + } + break; + + case R_386_TLS_LDO_32: + value = symref[idx]->merge.value - ld_state.tls_start; + store_4ubyte_unaligned (relloc, value); + break; + + case R_386_TLS_GD: + if (ld_state.file_type == executable_file_type) + { + if (symref[idx]->defined && !symref[idx]->in_dso) + { + /* The symbol is defined in the executable. + Perform the GD->LE optimization. */ + static const char gd_to_le[] = + { + /* mov %gs:0x0,%eax */ + 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, + /* sub $OFFSET,%eax */ + 0x81, 0xe8 + }; +#ifndef NDEBUG + static const char gd_text[] = + { + /* lea 0x0(,%ebx,1),%eax */ + 0x8d, 0x04, 0x1d, 0x00, 0x00, 0x00, 0x00, + /* call ___tls_get_addr */ + 0xe8 + }; + assert (memcmp (relloc - 3, gd_text, sizeof (gd_text)) + == 0); +#endif + relloc = mempcpy (relloc - 3, gd_to_le, + sizeof (gd_to_le)); + value = ld_state.tls_tcb- symref[idx]->merge.value; + store_4ubyte_unaligned (relloc, value); + + /* We have to skip over the next relocation which is + the matching R_i386_PLT32 for __tls_get_addr. */ + ++cnt; +#ifndef NDEBUG + assert (cnt < nrels); + XElf_Off old_offset = rel->r_offset; + xelf_getrel (reldata, cnt, rel); + assert (rel != NULL); + assert (XELF_R_TYPE (rel->r_info) == R_386_PLT32); + idx = XELF_R_SYM (rel->r_info); + assert (strcmp (symref[idx]->name, "___tls_get_addr") + == 0); + assert (old_offset + 5 == rel->r_offset); +#endif + + break; + } + } + abort (); + break; + case R_386_32PLT: case R_386_TLS_TPOFF: - case R_386_TLS_IE: case R_386_TLS_GOTIE: - case R_386_TLS_LE: - case R_386_TLS_GD: case R_386_TLS_LDM: case R_386_16: case R_386_PC16: @@ -837,11 +1057,9 @@ elf_i386_create_relocations (struct ld_state *statep, case R_386_TLS_LDM_PUSH: case R_386_TLS_LDM_CALL: case R_386_TLS_LDM_POP: - case R_386_TLS_LDO_32: case R_386_TLS_IE_32: case R_386_TLS_LE_32: // XXX For now fall through - printf("ignored relocation %d\n", (int) XELF_R_TYPE (rel->r_info)); break; case R_386_NONE: @@ -878,6 +1096,7 @@ elf_i386_ld_init (struct ld_state *statep) statep->callbacks.initialize_pltrel = elf_i386_initialize_pltrel; statep->callbacks.initialize_got = elf_i386_initialize_got; + statep->callbacks.initialize_gotplt = elf_i386_initialize_gotplt; statep->callbacks.finalize_plt = elf_i386_finalize_plt; @@ -1,15 +1,27 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -38,6 +50,9 @@ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + /* Values for the various options. */ enum @@ -47,7 +62,6 @@ enum ARGP_static, ARGP_dynamic, ARGP_pagesize, - ARGP_rpath, ARGP_rpath_link, ARGP_runpath, ARGP_runpath_link, @@ -56,6 +70,11 @@ enum ARGP_no_gc_sections, ARGP_no_undefined, ARGP_conserve, + ARGP_as_needed, + ARGP_no_as_needed, + ARGP_eh_frame_hdr, + ARGP_hash_style, + ARGP_build_id, #if YYDEBUG ARGP_yydebug, #endif @@ -65,119 +84,113 @@ enum /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - /* XXX This list will be reordered and section names will be added. - Just not right now. */ + { NULL, 0, NULL, 0, N_("Input File Control:"), 0 }, { "whole-archive", ARGP_whole_archive, NULL, 0, - N_("Include whole archives in the output from now on.") }, + N_("Include whole archives in the output from now on."), 0 }, { "no-whole-archive", ARGP_no_whole_archive, NULL, 0, - N_("Stop including the whole arhives in the output.") }, - - { "output", 'o', N_("FILE"), 0, N_("Place output in FILE.") }, - - { NULL, 'O', N_("LEVEL"), OPTION_ARG_OPTIONAL, - N_("Set optimization level to LEVEL.") }, - - { "verbose", 'v', NULL, 0, N_("Verbose messages.") }, - { "trace", 't', NULL, 0, N_("Trace file opens.") }, - { "conserve-memory", ARGP_conserve, NULL, 0, - N_("Trade speed for less memory usage") }, - - { NULL, 'z', "KEYWORD", OPTION_HIDDEN, NULL }, + N_("Stop including the whole arhives in the output."), 0 }, + { NULL, 'l', N_("FILE"), OPTION_HIDDEN, NULL, 0 }, + { "start-group", '(', NULL, 0, N_("Start a group."), 0 }, + { "end-group", ')', NULL, 0, N_("End a group."), 0 }, + { NULL, 'L', N_("PATH"), 0, + N_("Add PATH to list of directories files are searched in."), 0 }, + { "as-needed", ARGP_as_needed, NULL, 0, + N_("Only set DT_NEEDED for following dynamic libs if actually used"), 0 }, + { "no-as-needed", ARGP_no_as_needed, NULL, 0, + N_("Always set DT_NEEDED for following dynamic libs"), 0 }, + { "rpath-link", ARGP_rpath_link, "PATH", OPTION_HIDDEN, NULL, 0 }, + { NULL, 'i', NULL, 0, N_("Ignore LD_LIBRARY_PATH environment variable."), + 0 }, + + { NULL, 0, NULL, 0, N_("Output File Control:"), 0 }, + { "output", 'o', N_("FILE"), 0, N_("Place output in FILE."), 0 }, + { NULL, 'z', "KEYWORD", OPTION_HIDDEN, NULL, 0 }, { "-z nodefaultlib", '\0', NULL, OPTION_DOC, - N_("Object is marked to not use default search path at runtime.") }, + N_("Object is marked to not use default search path at runtime."), 0 }, { "-z allextract", '\0', NULL, OPTION_DOC, - N_("Same as --whole-archive.") }, + N_("Same as --whole-archive."), 0 }, { "-z defaultextract", '\0', NULL, OPTION_DOC, N_("\ -Default rules of extracting from archive; weak references are not enough.") }, +Default rules of extracting from archive; weak references are not enough."), + 0 }, { "-z weakextract", '\0', NULL, OPTION_DOC, - N_("Weak references cause extraction from archive.") }, + N_("Weak references cause extraction from archive."), 0 }, { "-z muldefs", '\0', NULL, OPTION_DOC, - N_("Allow multiple definitions; first is used.") }, + N_("Allow multiple definitions; first is used."), 0 }, { "-z defs | nodefs", '\0', NULL, OPTION_DOC, - N_("Disallow/allow undefined symbols in DSOs.") }, - { "no-undefined", ARGP_no_undefined, NULL, OPTION_HIDDEN, NULL }, + N_("Disallow/allow undefined symbols in DSOs."), 0 }, + { "no-undefined", ARGP_no_undefined, NULL, OPTION_HIDDEN, NULL, 0 }, { "-z origin", '\0', NULL, OPTION_DOC, - N_("Object requires immediate handling of $ORIGIN.") }, + N_("Object requires immediate handling of $ORIGIN."), 0 }, { "-z now", '\0', NULL, OPTION_DOC, - N_("Relocation will not be processed lazily.") }, + N_("Relocation will not be processed lazily."), 0 }, { "-z nodelete", '\0', NULL, OPTION_DOC, - N_("Object cannot be unloaded at runtime.") }, + N_("Object cannot be unloaded at runtime."), 0 }, { "-z initfirst", '\0', NULL, OPTION_DOC, - N_("Mark object to be initialized first.") }, + N_("Mark object to be initialized first."), 0 }, { "-z lazyload | nolazyload", '\0', NULL, OPTION_DOC, - N_("Enable/disable lazy-loading flag for following dependencies.") }, + N_("Enable/disable lazy-loading flag for following dependencies."), 0 }, { "-z nodlopen", '\0', NULL, OPTION_DOC, - N_("Mark object as not loadable with 'dlopen'.") }, + N_("Mark object as not loadable with 'dlopen'."), 0 }, { "-z ignore | record", '\0', NULL, OPTION_DOC, - N_("Ignore/record dependencies on unused DSOs.") }, + N_("Ignore/record dependencies on unused DSOs."), 0 }, { "-z systemlibrary", '\0', NULL, OPTION_DOC, - N_("Generated DSO will be a system library.") }, - - { NULL, 'l', N_("FILE"), OPTION_HIDDEN, NULL }, - - { NULL, '(', NULL, 0, N_("Start a group.") }, - { NULL, ')', NULL, 0, N_("End a group.") }, - - { NULL, 'L', N_("PATH"), 0, - N_("Add PATH to list of directories files are searched in.") }, - - { NULL, 'c', N_("FILE"), 0, N_("Use linker script in FILE.") }, - - { "entry", 'e', N_("ADDRESS"), 0, N_("Set entry point address.") }, - - { "static", ARGP_static, NULL, OPTION_HIDDEN, NULL }, + N_("Generated DSO will be a system library."), 0 }, + { "entry", 'e', N_("ADDRESS"), 0, N_("Set entry point address."), 0 }, + { "static", ARGP_static, NULL, OPTION_HIDDEN, NULL, 0 }, { "-B static", ARGP_static, NULL, OPTION_DOC, - N_("Do not link against shared libraries.") }, - { "dynamic", ARGP_dynamic, NULL, OPTION_HIDDEN, NULL }, + N_("Do not link against shared libraries."), 0 }, + { "dynamic", ARGP_dynamic, NULL, OPTION_HIDDEN, NULL, 0 }, { "-B dynamic", ARGP_dynamic, NULL, OPTION_DOC, - N_("Prefer linking against shared libraries.") }, - - { "export-dynamic", 'E', NULL, 0, N_("Export all dynamic symbols.") }, - - { "strip-all", 's', NULL, 0, N_("Strip all symbols.") }, - { "strip-debug", 'S', NULL, 0, N_("Strip debugging symbols.") }, - + N_("Prefer linking against shared libraries."), 0 }, + { "export-dynamic", 'E', NULL, 0, N_("Export all dynamic symbols."), 0 }, + { "strip-all", 's', NULL, 0, N_("Strip all symbols."), 0 }, + { "strip-debug", 'S', NULL, 0, N_("Strip debugging symbols."), 0 }, { "pagesize", ARGP_pagesize, "SIZE", 0, - N_("Assume pagesize for the target system to be SIZE.") }, - - { "rpath", ARGP_rpath, "PATH", OPTION_HIDDEN, NULL }, - { "rpath-link", ARGP_rpath_link, "PATH", OPTION_HIDDEN, NULL }, - - { "runpath", ARGP_runpath, "PATH", 0, N_("Set runtime DSO search path.") }, + N_("Assume pagesize for the target system to be SIZE."), 0 }, + { "rpath", 'R', "PATH", OPTION_HIDDEN, NULL, 0 }, + { "runpath", ARGP_runpath, "PATH", 0, N_("Set runtime DSO search path."), + 0 }, { "runpath-link", ARGP_runpath_link, "PATH", 0, - N_("Set link time DSO search path.") }, - - { NULL, 'i', NULL, 0, N_("Ignore LD_LIBRARY_PATH environment variable.") }, - - { "version-script", ARGP_version_script, "FILE", 0, - N_("Read version information from FILE.") }, - - { "emulation", 'm', "NAME", 0, N_("Set emulation to NAME.") }, - - { "shared", 'G', NULL, 0, N_("Generate dynamic shared object.") }, - { NULL, 'r', NULL, 0L, N_("Generate relocatable object.") }, - - { NULL, 'B', "KEYWORD", OPTION_HIDDEN, "" }, + N_("Set link time DSO search path."), 0 }, + { "shared", 'G', NULL, 0, N_("Generate dynamic shared object."), 0 }, + { NULL, 'r', NULL, 0L, N_("Generate relocatable object."), 0 }, + { NULL, 'B', "KEYWORD", OPTION_HIDDEN, "", 0 }, { "-B local", 'B', NULL, OPTION_DOC, - N_("Causes symbol not assigned to a version be reduced to local.") }, - - { "gc-sections", ARGP_gc_sections, NULL, 0, N_("Remove unused sections.") }, + N_("Causes symbol not assigned to a version be reduced to local."), 0 }, + { "gc-sections", ARGP_gc_sections, NULL, 0, N_("Remove unused sections."), + 0 }, { "no-gc-sections", ARGP_no_gc_sections, NULL, 0, - N_("Don't remove unused sections.") }, - - { "soname", 'h', "NAME", 0, N_("Set soname of shared object.") }, - { "dynamic-linker", 'I', "NAME", 0, N_("Set the dynamic linker name.") }, - - { NULL, 'Q', "YN", OPTION_HIDDEN, NULL }, + N_("Don't remove unused sections."), 0 }, + { "soname", 'h', "NAME", 0, N_("Set soname of shared object."), 0 }, + { "dynamic-linker", 'I', "NAME", 0, N_("Set the dynamic linker name."), 0 }, + { NULL, 'Q', "YN", OPTION_HIDDEN, NULL, 0 }, { "-Q y | n", 'Q', NULL, OPTION_DOC, - N_("Add/suppress addition indentifying link-editor to .comment section") }, - + N_("Add/suppress addition indentifying link-editor to .comment section."), + 0 }, + { "eh-frame-hdr", ARGP_eh_frame_hdr, NULL, 0, + N_("Create .eh_frame_hdr section"), 0 }, + { "hash-style", ARGP_hash_style, "STYLE", 0, + N_("Set hash style to sysv, gnu or both."), 0 }, + { "build-id", ARGP_build_id, "STYLE", OPTION_ARG_OPTIONAL, + N_("Generate build ID note (md5, sha1 (default), uuid)."), 0 }, + + { NULL, 0, NULL, 0, N_("Linker Operation Control:"), 0 }, + { "verbose", 'v', NULL, 0, N_("Verbose messages."), 0 }, + { "trace", 't', NULL, 0, N_("Trace file opens."), 0 }, + { "conserve-memory", ARGP_conserve, NULL, 0, + N_("Trade speed for less memory usage"), 0 }, + { NULL, 'O', N_("LEVEL"), OPTION_ARG_OPTIONAL, + N_("Set optimization level to LEVEL."), 0 }, + { NULL, 'c', N_("FILE"), 0, N_("Use linker script in FILE."), 0 }, #if YYDEBUG { "yydebug", ARGP_yydebug, NULL, 0, - N_("Select to get parser debug information") }, + N_("Select to get parser debug information"), 0 }, #endif + { "version-script", ARGP_version_script, "FILE", 0, + N_("Read version information from FILE."), 0 }, + { "emulation", 'm', "NAME", 0, N_("Set emulation to NAME."), 0 }, - { NULL, 0, NULL, 0, NULL } + { NULL, 0, NULL, 0, NULL, 0 } }; /* Short description of program. */ @@ -187,20 +200,18 @@ static const char doc[] = N_("Combine object and archive files."); static const char args_doc[] = N_("[FILE]..."); /* Prototype for option handler. */ +static void replace_args (int argc, char *argv[]); static error_t parse_opt_1st (int key, char *arg, struct argp_state *state); static error_t parse_opt_2nd (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp_1st = { - options, parse_opt_1st, args_doc, doc, NULL, more_help + options, parse_opt_1st, args_doc, doc, NULL, NULL, NULL }; static struct argp argp_2nd = { - options, parse_opt_2nd, args_doc, doc, NULL, more_help + options, parse_opt_2nd, args_doc, doc, NULL, NULL, NULL }; @@ -292,10 +303,10 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); /* Make sure the message catalog can be found. */ - bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); /* Initialize the message catalog. */ - textdomain (PACKAGE); + textdomain (PACKAGE_TARNAME); /* Before we start tell the ELF library which version we are using. */ elf_version (EV_CURRENT); @@ -309,6 +320,9 @@ main (int argc, char *argv[]) #define obstack_chunk_free free obstack_init (&ld_state.smem); + /* Recognize old-style parameters for compatibility. */ + replace_args (argc, argv); + /* One quick pass over the parameters which allows us to scan for options with global effect which influence the rest of the processing. */ argp_parse (&argp_1st, argc, argv, ARGP_IN_ORDER, &remaining, NULL); @@ -324,6 +338,11 @@ main (int argc, char *argv[]) /* Determine which ELF backend to use. */ determine_output_format (); + /* If no hash style was specific default to the oldand slow SysV + method. */ + if (unlikely (ld_state.hash_style == hash_style_none)) + ld_state.hash_style = hash_style_sysv; + /* Prepare state. */ err = ld_prepare_state (emulation); if (err != 0) @@ -334,7 +353,7 @@ main (int argc, char *argv[]) statements in the script. This simply must not happen. */ ldin = fopen (linker_script, "r"); if (ldin == NULL) - error (EXIT_FAILURE, errno, gettext ("cannot open linker script \"%s\""), + error (EXIT_FAILURE, errno, gettext ("cannot open linker script '%s'"), linker_script); /* No need for locking. */ __fsetlocking (ldin, FSETLOCKING_BYCALLER); @@ -478,30 +497,60 @@ main (int argc, char *argv[]) } -static char * -more_help (int key, const char *text, void *input) +static void +replace_args (int argc, char *argv[]) { - char *buf; + static const struct + { + const char *from; + const char *to; + } args[] = + { + { "-export-dynamic", "--export-dynamic" }, + { "-dynamic-linker", "--dynamic-linker" }, + { "-static", "--static" }, + }; + const size_t nargs = sizeof (args) / sizeof (args[0]); + + for (int i = 1; i < argc; ++i) + if (argv[i][0] == '-' && islower (argv[i][1]) && argv[i][2] != '\0') + for (size_t j = 0; j < nargs; ++j) + if (strcmp (argv[i], args[j].from) == 0) + { + argv[i] = (char *) args[j].to; + break; + } +} - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - default: - break; +static int +valid_hexarg (const char *arg) +{ + if (strncasecmp (arg, "0x", 2) != 0) + return 0; + + arg += 2; + do + { + if (isxdigit (arg[0]) && isxdigit (arg[1])) + { + arg += 2; + if (arg[0] == '-' || arg[0] == ':') + ++arg; + } + else + return 0; } - return (char *) text; + while (*arg != '\0'); + + return 1; } /* Quick scan of the parameter list for options with global effect. */ static error_t -parse_opt_1st (int key, char *arg, struct argp_state *state) +parse_opt_1st (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) { switch (key) { @@ -594,7 +643,7 @@ parse_opt_1st (int key, char *arg, struct argp_state *state) else { error (0, 0, - gettext ("invalid page size value \"%s\": ignored"), + gettext ("invalid page size value '%s': ignored"), arg); ld_state.pagesize = 0; } @@ -602,7 +651,7 @@ parse_opt_1st (int key, char *arg, struct argp_state *state) } break; - case ARGP_rpath: + case 'R': add_rxxpath (&ld_state.rpath, arg); break; @@ -623,6 +672,33 @@ parse_opt_1st (int key, char *arg, struct argp_state *state) ld_state.gc_sections = key == ARGP_gc_sections; break; + case ARGP_eh_frame_hdr: + ld_state.eh_frame_hdr = true; + break; + + case ARGP_hash_style: + if (strcmp (arg, "gnu") == 0) + ld_state.hash_style = hash_style_gnu; + else if (strcmp (arg, "both") == 0) + ld_state.hash_style = hash_style_gnu | hash_style_sysv; + else if (strcmp (arg, "sysv") == 0) + ld_state.hash_style = hash_style_sysv; + else + error (EXIT_FAILURE, 0, gettext ("invalid hash style '%s'"), arg); + break; + + case ARGP_build_id: + if (arg == NULL) + ld_state.build_id = "sha1"; + else if (strcmp (arg, "uuid") != 0 + && strcmp (arg, "md5") != 0 + && strcmp (arg, "sha1") != 0 + && !valid_hexarg (arg)) + error (EXIT_FAILURE, 0, gettext ("invalid build-ID style '%s'"), arg); + else + ld_state.build_id = arg; + break; + case 's': if (arg == NULL) { @@ -639,6 +715,8 @@ parse_opt_1st (int key, char *arg, struct argp_state *state) case 'O': case ARGP_whole_archive: case ARGP_no_whole_archive: + case ARGP_as_needed: + case ARGP_no_as_needed: case 'L': case '(': case ')': @@ -685,7 +763,8 @@ parse_opt_1st (int key, char *arg, struct argp_state *state) /* Handle program arguments for real. */ static error_t -parse_opt_2nd (int key, char *arg, struct argp_state *state) +parse_opt_2nd (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) { static bool group_start_requested; static bool group_end_requested; @@ -734,6 +813,13 @@ parse_opt_2nd (int key, char *arg, struct argp_state *state) ld_state.extract_rule = defaultextract; break; + case ARGP_as_needed: + ld_state.as_needed = true; + break; + case ARGP_no_as_needed: + ld_state.as_needed = false; + break; + case ARGP_static: case ARGP_dynamic: /* Enable/disable use for DSOs. */ @@ -865,14 +951,14 @@ load_needed (void) /* Print the version information. */ static void -print_version (FILE *stream, struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "ld (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "ld (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -911,17 +997,19 @@ parse_z_option (const char *arg) /* This is only meaningful if we create a DSO. */ && ld_state.file_type == dso_file_type) ld_state.dt_flags_1 |= DF_1_NOOPEN; - else if (strcmp (arg, "ignore") == 0) - ld_state.ignore_unused_dsos = true; - else if (strcmp (arg, "record") == 0) - ld_state.ignore_unused_dsos = false; else if (strcmp (arg, "systemlibrary") == 0) ld_state.is_system_library = true; + else if (strcmp (arg, "execstack") == 0) + ld_state.execstack = execstack_true; + else if (strcmp (arg, "noexecstack") == 0) + ld_state.execstack = execstack_false_force; else if (strcmp (arg, "allextract") != 0 && strcmp (arg, "defaultextract") != 0 && strcmp (arg, "weakextract") != 0 && strcmp (arg, "lazyload") != 0 - && strcmp (arg, "nolazyload") != 0) + && strcmp (arg, "nolazyload") != 0 + && strcmp (arg, "ignore") != 0 + && strcmp (arg, "record") != 0) error (0, 0, gettext ("unknown option `-%c %s'"), 'z', arg); } @@ -939,6 +1027,10 @@ parse_z_option_2 (const char *arg) ld_state.lazyload = true; else if (strcmp (arg, "nolazyload") == 0) ld_state.lazyload = false; + else if (strcmp (arg, "ignore") == 0) + ld_state.as_needed = true; + else if (strcmp (arg, "record") == 0) + ld_state.as_needed = false; } @@ -1109,6 +1201,7 @@ ld_new_inputfile (const char *fname, enum file_type type) newfile->soname = newfile->fname = newfile->rfname = fname; newfile->file_type = type; newfile->extract_rule = ld_state.extract_rule; + newfile->as_needed = ld_state.as_needed; newfile->lazyload = ld_state.lazyload; newfile->status = not_opened; @@ -1349,7 +1442,7 @@ read_version_script (const char *fname) or absolute) path. No search along a path will be performed. */ ldin = fopen (fname, "r"); if (ldin == NULL) - error (EXIT_FAILURE, errno, gettext ("cannot read version script \"%s\""), + error (EXIT_FAILURE, errno, gettext ("cannot read version script '%s'"), fname); /* No need for locking. */ __fsetlocking (ldin, FSETLOCKING_BYCALLER); @@ -1514,7 +1607,12 @@ create_special_section_symbol (struct symbol **symp, const char *name) abort (); (*symp)->defined = 1; + (*symp)->local = 1; + (*symp)->hidden = 1; (*symp)->type = STT_OBJECT; ++ld_state.nsymtab; } + + +#include "debugpred.h" @@ -1,15 +1,27 @@ -/* Copyright (C) 2001, 2002, 2003 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2005, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef LD_H #define LD_H 1 @@ -103,6 +115,10 @@ struct usedfiles used in a reference. */ bool used; + /* True when file should be added to DT_NEEDED list only when + directly referenced. */ + bool as_needed; + /* If nonzero this is the archive sequence number which can be used to determine whether back refernces from -( -) or GROUP statements have to be followed. */ @@ -158,11 +174,16 @@ struct usedfiles Elf32_Word allsectionsidx; /* True if the section is used. */ bool used; + /* True if section is an unused COMDAT section. */ + bool unused_comdat; + /* True if this is a COMDAT group section. */ + bool comdat_group; /* Section group number. This is the index of the SHT_GROUP section. */ Elf32_Word grpid; /* Pointer back to the containing file information structure. */ struct usedfiles *fileinfo; - /* List of symbols in this section (set only for merge-able sections). */ + /* List of symbols in this section (set only for merge-able sections + and group sections). */ struct symbol *symbols; /* Size of relocations in this section. Only used for relocation sections. */ @@ -379,15 +400,21 @@ struct callbacks DL_CALL_FCT ((state)->callbacks.initialize_pltrel, (state, scn)) /* Finalize the .plt section the what belongs to them. */ - void (*finalize_plt) (struct ld_state *, size_t, size_t); -#define FINALIZE_PLT(state, nsym, nsym_dyn) \ - DL_CALL_FCT ((state)->callbacks.finalize_plt, (state, nsym, nsym_dyn)) + void (*finalize_plt) (struct ld_state *, size_t, size_t, struct symbol **); +#define FINALIZE_PLT(state, nsym, nsym_dyn, ndxtosym) \ + DL_CALL_FCT ((state)->callbacks.finalize_plt, (state, nsym, nsym_dyn, \ + ndxtosym)) /* Create the data structures for the .got section and initialize it. */ void (*initialize_got) (struct ld_state *, Elf_Scn *scn); #define INITIALIZE_GOT(state, scn) \ DL_CALL_FCT ((state)->callbacks.initialize_got, (state, scn)) + /* Create the data structures for the .got.plt section and initialize it. */ + void (*initialize_gotplt) (struct ld_state *, Elf_Scn *scn); +#define INITIALIZE_GOTPLT(state, scn) \ + DL_CALL_FCT ((state)->callbacks.initialize_gotplt, (state, scn)) + /* Return the tag corresponding to the native relocation type for the platform. */ int (*rel_type) (struct ld_state *); @@ -428,6 +455,8 @@ struct symbol unsigned int weak:1; unsigned int added:1; unsigned int merged:1; + unsigned int local:1; + unsigned int hidden:1; /* Nonzero if the symbol is on the from_dso list. */ unsigned int on_dsolist:1; /* Nonzero if symbol needs copy relocation, reset when the @@ -464,6 +493,7 @@ struct filename_list struct filename_list *next; bool group_start; bool group_end; + bool as_needed; }; @@ -649,15 +679,18 @@ struct scnhead scn_normal, /* Section from the input file(s). */ scn_dot_interp, /* Generated .interp section. */ scn_dot_got, /* Generated .got section. */ + scn_dot_gotplt, /* Generated .got.plt section. */ scn_dot_dynrel, /* Generated .rel.dyn section. */ scn_dot_dynamic, /* Generated .dynamic section. */ scn_dot_dynsym, /* Generated .dynsym section. */ scn_dot_dynstr, /* Generated .dynstr section. */ scn_dot_hash, /* Generated .hash section. */ + scn_dot_gnu_hash, /* Generated .gnu.hash section. */ scn_dot_plt, /* Generated .plt section. */ scn_dot_pltrel, /* Generated .rel.plt section. */ scn_dot_version, /* Generated .gnu.version section. */ - scn_dot_version_r /* Generated .gnu.version_r section. */ + scn_dot_version_r, /* Generated .gnu.version_r section. */ + scn_dot_note_gnu_build_id /* Generated .note.gnu.build-id section. */ } kind; /* True is the section is used in the output. */ @@ -778,6 +811,10 @@ struct ld_state /* If true static linking is requested. */ bool statically; + /* If true, add DT_NEEDED entries for following files if they are + needed. */ + bool as_needed; + /* How to extract elements from archives. */ enum extract_rule extract_rule; @@ -900,8 +937,9 @@ struct ld_state Elf32_Word dynsymscnidx; /* Dynamic symbol string table section. */ Elf32_Word dynstrscnidx; - /* Dynamic symbol hash table. */ + /* Dynamic symbol hash tables. */ size_t hashscnidx; + size_t gnuhashscnidx; /* Procedure linkage table section. */ Elf32_Word pltscnidx; @@ -912,6 +950,8 @@ struct ld_state /* Global offset table section. */ Elf32_Word gotscnidx; + /* And the part of the PLT. */ + Elf32_Word gotpltscnidx; /* This section will hole all non-PLT relocations. */ Elf32_Word reldynscnidx; @@ -927,6 +967,11 @@ struct ld_state /* Index of next version. */ int nextveridx; + /* TLS segment. */ + bool need_tls; + XElf_Addr tls_start; + XElf_Addr tls_tcb; + /* Hash table for version symbol strings. Only strings without special characters are hashed here. */ ld_version_str_tab version_str_tab; @@ -935,6 +980,14 @@ struct ld_state bool default_bind_local; bool default_bind_global; + /* Execuatable stack selection. */ + enum execstack + { + execstack_false = 0, + execstack_true, + execstack_false_force + } execstack; + /* True if only used sections are used. */ bool gc_sections; @@ -978,15 +1031,29 @@ struct ld_state /* Lazy-loading state for dependencies. */ bool lazyload; - /* True is DSOs which are not used in the linking process are not - recorded. */ - bool ignore_unused_dsos; + /* True if an .eh_frame_hdr section should be generated. */ + bool eh_frame_hdr; + + /* What hash style to generate. */ + enum + { + hash_style_none = 0, + hash_style_sysv = 1, +#define GENERATE_SYSV_HASH ((ld_state.hash_style & hash_style_sysv) != 0) + hash_style_gnu = 2 +#define GENERATE_GNU_HASH ((ld_state.hash_style & hash_style_gnu) != 0) + } + hash_style; /* True if in executables all global symbols should be exported in the dynamic symbol table. */ bool export_all_dynamic; + /* Build-ID style. NULL is none. */ + const char *build_id; + Elf32_Word buildidscnidx; + /* If DSO is generated, this is the SONAME. */ const char *soname; @@ -1054,9 +1121,12 @@ extern bool dynamically_linked_p (void); /* Helper functions for the architecture specific code. */ /* Checked whether the symbol is undefined and referenced from a DSO. */ -extern bool linked_from_dso_p (struct scninfo *scninfo, int symidx); +extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx); +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif extern inline bool -linked_from_dso_p (struct scninfo *scninfo, int symidx) +linked_from_dso_p (struct scninfo *scninfo, size_t symidx) { struct usedfiles *file = scninfo->fileinfo; diff --git a/src/ldgeneric.c b/src/ldgeneric.c index a33e9fcc..8df2a57e 100644 --- a/src/ldgeneric.c +++ b/src/ldgeneric.c @@ -1,21 +1,34 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <assert.h> +#include <ctype.h> #include <dlfcn.h> #include <errno.h> #include <error.h> @@ -32,9 +45,23 @@ #include <sys/param.h> #include <sys/stat.h> -#include <system.h> +#include <elf-knowledge.h> #include "ld.h" #include "list.h" +#include <md5.h> +#include <sha1.h> +#include <system.h> + + +/* Header of .eh_frame_hdr section. */ +struct unw_eh_frame_hdr +{ + unsigned char version; + unsigned char eh_frame_ptr_enc; + unsigned char fde_count_enc; + unsigned char table_enc; +}; +#define EH_FRAME_HDR_VERSION 1 /* Prototypes for local functions. */ @@ -65,8 +92,11 @@ static void ld_generic_initialize_plt (struct ld_state *statep, Elf_Scn *scn); static void ld_generic_initialize_pltrel (struct ld_state *statep, Elf_Scn *scn); static void ld_generic_initialize_got (struct ld_state *statep, Elf_Scn *scn); +static void ld_generic_initialize_gotplt (struct ld_state *statep, + Elf_Scn *scn); static void ld_generic_finalize_plt (struct ld_state *statep, size_t nsym, - size_t nsym_dyn); + size_t nsym_dyn, + struct symbol **ndxtosymp); static int ld_generic_rel_type (struct ld_state *statep); static void ld_generic_count_relocations (struct ld_state *statep, struct scninfo *scninfo); @@ -137,7 +167,7 @@ dynamically_linked_p (void) bool -linked_from_dso_p (struct scninfo *scninfo, int symidx) +linked_from_dso_p (struct scninfo *scninfo, size_t symidx) { struct usedfiles *file = scninfo->fileinfo; @@ -197,6 +227,7 @@ ld_prepare_state (const char *emulation) ld_state.callbacks.initialize_plt = ld_generic_initialize_plt; ld_state.callbacks.initialize_pltrel = ld_generic_initialize_pltrel; ld_state.callbacks.initialize_got = ld_generic_initialize_got; + ld_state.callbacks.initialize_gotplt = ld_generic_initialize_gotplt; ld_state.callbacks.finalize_plt = ld_generic_finalize_plt; ld_state.callbacks.rel_type = ld_generic_rel_type; ld_state.callbacks.count_relocations = ld_generic_count_relocations; @@ -491,6 +522,38 @@ open_along_path (struct usedfiles *fileinfo) } +static int +matching_group_comdat_scn (const XElf_Sym *sym, size_t shndx, + struct usedfiles *fileinfo, struct symbol *oldp) +{ + if ((shndx >= SHN_LORESERVE && shndx <= SHN_HIRESERVE) + || (oldp->scndx >= SHN_LORESERVE && oldp->scndx <= SHN_HIRESERVE)) + /* Cannot be a group COMDAT section. */ + return 0; + + size_t newgrpid = fileinfo->scninfo[shndx].grpid; + size_t oldgrpid = oldp->file->scninfo[oldp->scndx].grpid; + if (newgrpid == 0 || oldgrpid == 0) + return 0; + + assert (SCNINFO_SHDR (fileinfo->scninfo[newgrpid].shdr).sh_type + == SHT_GROUP); + assert (SCNINFO_SHDR (oldp->file->scninfo[oldgrpid].shdr).sh_type + == SHT_GROUP); + + if (! fileinfo->scninfo[newgrpid].comdat_group + || ! oldp->file->scninfo[oldgrpid].comdat_group) + return 0; + + if (strcmp (fileinfo->scninfo[newgrpid].symbols->name, + oldp->file->scninfo[oldgrpid].symbols->name) != 0) + return 0; + + /* This is a matching, duplicate COMDAT group section. Ignore it. */ + return 1; +} + + static void check_type_and_size (const XElf_Sym *sym, struct usedfiles *fileinfo, struct symbol *oldp) @@ -528,7 +591,7 @@ Warning: size of `%s' changed from %" PRIu64 " in %s to %" PRIu64 " in %s"), static int -check_definition (const XElf_Sym *sym, size_t symidx, +check_definition (const XElf_Sym *sym, size_t shndx, size_t symidx, struct usedfiles *fileinfo, struct symbol *oldp) { int result = 0; @@ -536,9 +599,9 @@ check_definition (const XElf_Sym *sym, size_t symidx, bool new_in_dso = FILEINFO_EHDR (fileinfo->ehdr).e_type == ET_DYN; bool use_new_def = false; - if (sym->st_shndx != SHN_UNDEF + if (shndx != SHN_UNDEF && (! oldp->defined - || (sym->st_shndx != SHN_COMMON && oldp->common && ! new_in_dso) + || (shndx != SHN_COMMON && oldp->common && ! new_in_dso) || (old_in_dso && ! new_in_dso))) { /* We found a definition for a previously undefined symbol or a @@ -568,10 +631,17 @@ check_definition (const XElf_Sym *sym, size_t symidx, /* Use the values of the definition from now on. */ use_new_def = true; } - else if (sym->st_shndx != SHN_UNDEF + else if (shndx != SHN_UNDEF + && oldp->defined + && matching_group_comdat_scn (sym, shndx, fileinfo, oldp)) + /* The duplicate symbol is in a group COMDAT section with the same + signature as the one containing the original definition. + Just ignore the second definition. */ + /* nothing */; + else if (shndx != SHN_UNDEF && unlikely (! oldp->common) && oldp->defined - && sym->st_shndx != SHN_COMMON + && shndx != SHN_COMMON /* Multiple definitions are no fatal errors if the -z muldefs flag is used. We don't warn about the multiple definition unless we are told to be verbose. */ @@ -584,7 +654,6 @@ check_definition (const XElf_Sym *sym, size_t symidx, struct usedfiles *oldfile; const char *scnname; Elf32_Word xndx; - size_t shndx; size_t shnum; if (elf_getshnum (fileinfo->elf, &shnum) < 0) @@ -593,15 +662,14 @@ check_definition (const XElf_Sym *sym, size_t symidx, elf_errmsg (-1)); /* XXX Use only ebl_section_name. */ - if (sym->st_shndx < SHN_LORESERVE // || sym->st_shndx > SHN_HIRESERVE - && sym->st_shndx < shnum) + if (shndx < SHN_LORESERVE || (shndx > SHN_HIRESERVE && shndx < shnum)) scnname = elf_strptr (fileinfo->elf, fileinfo->shstrndx, - SCNINFO_SHDR (fileinfo->scninfo[sym->st_shndx].shdr).sh_name); + SCNINFO_SHDR (fileinfo->scninfo[shndx].shdr).sh_name); else // XXX extended section - scnname = ebl_section_name (ld_state.ebl, sym->st_shndx, 0, - buf, sizeof (buf), NULL, shnum); + scnname = ebl_section_name (ld_state.ebl, shndx, 0, buf, sizeof (buf), + NULL, shnum); /* XXX Print source file and line number. */ print_file_name (stderr, fileinfo, 1, 0); @@ -616,23 +684,16 @@ check_definition (const XElf_Sym *sym, size_t symidx, oldfile = oldp->file; xelf_getsymshndx (oldfile->symtabdata, oldfile->xndxdata, oldp->symidx, oldsym, xndx); - if (oldsym == NULL) - /* This should never happen since the same call - succeeded before. */ - abort (); - - shndx = oldsym->st_shndx; - if (unlikely (oldsym->st_shndx == SHN_XINDEX)) - shndx = xndx; + assert (oldsym != NULL); /* XXX Use only ebl_section_name. */ - if (shndx < SHN_LORESERVE || shndx > SHN_HIRESERVE) + if (oldp->scndx < SHN_LORESERVE || oldp->scndx > SHN_HIRESERVE) scnname = elf_strptr (oldfile->elf, oldfile->shstrndx, SCNINFO_SHDR (oldfile->scninfo[shndx].shdr).sh_name); else - scnname = ebl_section_name (ld_state.ebl, oldsym->st_shndx, shndx, buf, - sizeof (buf), NULL, shnum); + scnname = ebl_section_name (ld_state.ebl, oldp->scndx, oldp->scndx, + buf, sizeof (buf), NULL, shnum); /* XXX Print source file and line number. */ print_file_name (stderr, oldfile, 1, 0); @@ -643,7 +704,7 @@ check_definition (const XElf_Sym *sym, size_t symidx, result = 1; } else if (old_in_dso && fileinfo->file_type == relocatable_file_type - && sym->st_shndx != SHN_UNDEF) + && shndx != SHN_UNDEF) /* We use the definition from a normal relocatable file over the definition in a DSO. This is what the dynamic linker would do, too. */ @@ -662,7 +723,7 @@ check_definition (const XElf_Sym *sym, size_t symidx, oldp->on_dsolist = 1; } - else if (oldp->common && sym->st_shndx == SHN_COMMON) + else if (oldp->common && shndx == SHN_COMMON) { /* The symbol size is the largest of all common definitions. */ oldp->size = MAX (oldp->size, sym->st_size); @@ -691,23 +752,23 @@ check_definition (const XElf_Sym *sym, size_t symidx, oldp->size = sym->st_size; oldp->type = XELF_ST_TYPE (sym->st_info); oldp->symidx = symidx; - oldp->scndx = sym->st_shndx; + oldp->scndx = shndx; //oldp->symscndx = THESYMSCNDX must be passed; oldp->file = fileinfo; oldp->defined = 1; oldp->in_dso = new_in_dso; - oldp->common = sym->st_shndx == SHN_COMMON; + oldp->common = shndx == SHN_COMMON; if (likely (fileinfo->file_type == relocatable_file_type)) { /* If the definition comes from a DSO we pertain the weak flag and it's indicating whether the reference is weak or not. */ oldp->weak = XELF_ST_BIND (sym->st_info) == STB_WEAK; - if (sym->st_shndx != SHN_COMMON) + // XXX Really exclude SHN_ABS? + if (shndx != SHN_COMMON && shndx != SHN_ABS) { struct scninfo *ignore; - mark_section_used (&fileinfo->scninfo[sym->st_shndx], - sym->st_shndx, &ignore); + mark_section_used (&fileinfo->scninfo[shndx], shndx, &ignore); } } @@ -726,7 +787,7 @@ check_definition (const XElf_Sym *sym, size_t symidx, oldp->on_dsolist = 1; } - else if (sym->st_shndx == SHN_COMMON) + else if (shndx == SHN_COMMON) { /* Store the alignment. */ oldp->merge.value = sym->st_value; @@ -820,14 +881,12 @@ mark_section_group (struct usedfiles *fileinfo, Elf32_Word shndx, Elf32_Word idx = grpref[--cnt]; XElf_Shdr *shdr = &SCNINFO_SHDR (fileinfo->scninfo[idx].shdr); - if (fileinfo->scninfo[idx].grpid != 0) + if (fileinfo->scninfo[idx].grpid != grpscn->grpid) error (EXIT_FAILURE, 0, gettext ("\ -%s: section [%2d] '%s' is in more than one section group"), +%s: section [%2d] '%s' is not in the correct section group"), fileinfo->fname, (int) idx, elf_strptr (fileinfo->elf, fileinfo->shstrndx, shdr->sh_name)); - fileinfo->scninfo[idx].grpid = grpscn->grpid; - if (ld_state.strip == strip_none /* If we are stripping, remove debug sections. */ || (!ebl_debugscn_p (ld_state.ebl, @@ -968,7 +1027,36 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo) } /* XXX Possibly unaligned memory access. */ - is_comdat = ((Elf32_Word *) grpscndata->d_buf)[0] & GRP_COMDAT; + if ((((Elf32_Word *) grpscndata->d_buf)[0] & GRP_COMDAT) != 0) + { + /* We have to compare the group signatures. There might + be sections with the same name but belonging to + groups with different signatures. This means we have + to compare the new group signature with all those + already collected. There might also be some + non-group sections in the mix. */ + struct scninfo *runp = queued->last; + do + { + if (SCNINFO_SHDR (runp->shdr).sh_flags & SHF_GROUP) + { + struct scninfo *grpscn2 + = find_section_group (runp->fileinfo, + elf_ndxscn (runp->scn), + &grpscndata); + + if (strcmp (grpscn->symbols->name, + grpscn2->symbols->name) == 0) + { + scninfo->unused_comdat = is_comdat = true; + break; + } + } + + runp = runp->next; + } + while (runp != queued->last); + } } if (!is_comdat) @@ -977,7 +1065,8 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo) scninfo->next = queued->last->next; queued->last = queued->last->next = scninfo; - queued->flags = SH_FLAGS_COMBINE (queued->flags, shdr->sh_flags); + queued->flags = ebl_sh_flags_combine (ld_state.ebl, queued->flags, + shdr->sh_flags); queued->align = MAX (queued->align, shdr->sh_addralign); } } @@ -996,6 +1085,9 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo) queued->segment_nr = ~0; queued->last = scninfo->next = scninfo; + /* Check whether we need a TLS segment. */ + ld_state.need_tls |= (shdr->sh_flags & SHF_TLS) != 0; + /* Add to the hash table and possibly overwrite existing value. */ ld_section_tab_insert (&ld_state.section_tab, hval, queued); } @@ -1003,7 +1095,7 @@ add_section (struct usedfiles *fileinfo, struct scninfo *scninfo) static int -add_relocatable_file (struct usedfiles *fileinfo, int secttype) +add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype) { size_t scncnt; size_t cnt; @@ -1016,6 +1108,10 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) size_t nsymbols = 0; size_t nlocalsymbols = 0; bool has_merge_sections = false; + bool has_tls_symbols = false; + /* Unless we have different information we assume the code needs + an executable stack. */ + enum execstack execstack = execstack_true; /* Prerequisites. */ assert (fileinfo->elf != NULL); @@ -1069,6 +1165,7 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) /* Check whether this section is marked as merge-able. */ has_merge_sections |= (shdr->sh_flags & SHF_MERGE) != 0; + has_tls_symbols |= (shdr->sh_flags & SHF_TLS) != 0; /* Get the ELF section header and data. */ /* Make the file structure available. */ @@ -1166,6 +1263,7 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) symscn = elf_getscn (fileinfo->elf, shdr->sh_link); xelf_getshdr (symscn, symshdr); symdata = elf_getdata (symscn, NULL); + if (symshdr != NULL) { XElf_Sym_vardef (sym); @@ -1177,9 +1275,26 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) { struct symbol *symbol = fileinfo->scninfo[cnt].symbols; - symbol->name = elf_strptr (fileinfo->elf, symshdr->sh_link, - sym->st_name); - symbol->symidx = shdr->sh_info; +#ifndef NO_HACKS + if (XELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + XElf_Shdr_vardef (buggyshdr); + xelf_getshdr (elf_getscn (fileinfo->elf, sym->st_shndx), + buggyshdr); + + symbol->name = elf_strptr (fileinfo->elf, + FILEINFO_EHDR (fileinfo->ehdr).e_shstrndx, + buggyshdr->sh_name); + symbol->symidx = -1; + } + else +#endif + { + symbol->name = elf_strptr (fileinfo->elf, + symshdr->sh_link, + sym->st_name); + symbol->symidx = shdr->sh_info; + } symbol->file = fileinfo; } } @@ -1192,6 +1307,35 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) shdr->sh_name), elf_errmsg (-1)); + + /* For all the sections which are part of this group, add + the reference. */ + if (data == NULL) + error (EXIT_FAILURE, 0, gettext ("\ +%s: cannot get content of section group [%2zd] '%s': %s'"), + fileinfo->fname, elf_ndxscn (fileinfo->scninfo[cnt].scn), + elf_strptr (fileinfo->elf, fileinfo->shstrndx, + shdr->sh_name), + elf_errmsg (-1)); + + Elf32_Word *grpdata = (Elf32_Word *) data->d_buf; + if (grpdata[0] & GRP_COMDAT) + fileinfo->scninfo[cnt].comdat_group = true; + for (size_t inner = 1; inner < data->d_size / sizeof (Elf32_Word); + ++inner) + { + if (grpdata[inner] >= scncnt) + error (EXIT_FAILURE, 0, gettext ("\ +%s: group member %zu of section group [%2zd] '%s' has too high index: %" PRIu32), + fileinfo->fname, + inner, elf_ndxscn (fileinfo->scninfo[cnt].scn), + elf_strptr (fileinfo->elf, fileinfo->shstrndx, + shdr->sh_name), + grpdata[inner]); + + fileinfo->scninfo[grpdata[inner]].grpid = cnt; + } + /* The 'used' flag is used to indicate when the information in the section group is used to mark all other sections as used. So it must not be true yet. */ @@ -1222,9 +1366,26 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) || shdr->sh_type == SHT_INIT_ARRAY || shdr->sh_type == SHT_FINI_ARRAY || shdr->sh_type == SHT_PREINIT_ARRAY)) - add_section (fileinfo, &fileinfo->scninfo[cnt]); + { + /* Check whether the section needs to be executable. */ + if (shdr->sh_type == SHT_PROGBITS + && (shdr->sh_flags & SHF_EXECINSTR) == 0 + && strcmp (elf_strptr (fileinfo->elf, fileinfo->shstrndx, + shdr->sh_name), + ".note.GNU-stack") == 0) + execstack = execstack_false; + + add_section (fileinfo, &fileinfo->scninfo[cnt]); + } } + /* Now we know more about the requirements for an executable stack + of the result. */ + if (fileinfo->file_type == relocatable_file_type + && execstack == execstack_true + && ld_state.execstack != execstack_false_force) + ld_state.execstack = execstack_true; + /* Handle the symbols. Record defined and undefined symbols in the hash table. In theory there can be a file without any symbol table. */ @@ -1233,7 +1394,7 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) /* In case this file contains merge-able sections we have to locate the symbols which are in these sections. */ fileinfo->has_merge_sections = has_merge_sections; - if (likely (has_merge_sections)) + if (likely (has_merge_sections || has_tls_symbols)) { fileinfo->symref = (struct symbol **) obstack_calloc (&ld_state.smem, @@ -1265,8 +1426,9 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) if (XELF_ST_TYPE (sym->st_info) != STT_SECTION && (shndx < SHN_LORESERVE || shndx > SHN_HIRESERVE) - && (SCNINFO_SHDR (fileinfo->scninfo[shndx].shdr).sh_flags - & SHF_MERGE)) + && ((SCNINFO_SHDR (fileinfo->scninfo[shndx].shdr).sh_flags + & SHF_MERGE) + || XELF_ST_TYPE (sym->st_info) == STT_TLS)) { /* Create a symbol record for this symbol and add it to the list for this section. */ @@ -1278,6 +1440,7 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) newp->symidx = cnt; newp->scndx = shndx; newp->file = fileinfo; + newp->defined = 1; fileinfo->symref[cnt] = newp; if (fileinfo->scninfo[shndx].symbols == NULL) @@ -1334,8 +1497,13 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) if (unlikely (shndx == SHN_ABS) && secttype == SHT_DYNSYM) continue; - /* If the DSO uses symbols determine whether this is the default - version. Otherwise we'll ignore the symbol. */ + if ((shndx < SHN_LORESERVE || shndx > SHN_HIRESERVE) + && fileinfo->scninfo[shndx].unused_comdat) + /* The symbol is not used. */ + continue; + + /* If the DSO uses symbol versions determine whether this is + the default version. Otherwise we'll ignore the symbol. */ if (versymdata != NULL) { XElf_Versym versym; @@ -1358,9 +1526,9 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) _GLOBAL_OFFSET_TABLE_, _DYNAMIC. */ // XXX This loop is hot and the following tests hardly ever match. // XXX Maybe move the tests somewhere they are executed less often. - if (((unlikely (hval == 165832675) + if (((unlikely (hval == 165832675ul) && strcmp (search.name, "_DYNAMIC") == 0) - || (unlikely (hval == 102264335) + || (unlikely (hval == 102264335ul) && strcmp (search.name, "_GLOBAL_OFFSET_TABLE_") == 0)) && sym->st_shndx != SHN_UNDEF /* If somebody defines such a variable in a relocatable we @@ -1373,7 +1541,7 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) struct symbol *newp; if (likely (oldp == NULL)) { - /* No symbol of this name know. Add it. */ + /* No symbol of this name known. Add it. */ newp = (struct symbol *) obstack_alloc (&ld_state.smem, sizeof (*newp)); newp->name = search.name; @@ -1389,6 +1557,8 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) newp->weak = XELF_ST_BIND (sym->st_info) == STB_WEAK; newp->added = 0; newp->merged = 0; + newp->local = 0; + newp->hidden = 0; newp->need_copy = 0; newp->on_dsolist = 0; newp->in_dso = secttype == SHT_DYNSYM; @@ -1431,7 +1601,8 @@ add_relocatable_file (struct usedfiles *fileinfo, int secttype) else if (hval == 6672457 && strcmp (newp->name, "_fini") == 0) ld_state.fini_symbol = newp; } - else if (unlikely (check_definition (sym, cnt, fileinfo, oldp) != 0)) + else if (unlikely (check_definition (sym, shndx, cnt, fileinfo, oldp) + != 0)) /* A fatal error (multiple definition of a symbol) occurred, no need to continue. */ return 1; @@ -1522,8 +1693,11 @@ ld_handle_filename_list (struct filename_list *fnames) curp = runp->real = ld_new_inputfile (runp->name, relocatable_file_type); /* Set flags for group handling. */ - runp->real->group_start = runp->group_start; - runp->real->group_end = runp->group_end; + curp->group_start = runp->group_start; + curp->group_end = runp->group_end; + + /* Set as-needed flag from the file, not the command line. */ + curp->as_needed = runp->as_needed; /* Read the file and everything else which comes up, including handling groups. */ @@ -1590,7 +1764,7 @@ open_elf (struct usedfiles *fileinfo, Elf *elf) __fsetlocking (ldin, FSETLOCKING_BYCALLER); if (ldin == NULL) - error (EXIT_FAILURE, errno, gettext ("cannot open \"%s\""), + error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"), fileinfo->rfname); /* Parse the file. If it is a linker script no problems will be @@ -1702,15 +1876,16 @@ extract_from_archive (struct usedfiles *fileinfo) static int archive_seq; int res = 0; - /* This is an archive we are not using completely. Give it a - unique number. */ - fileinfo->archive_seq = ++archive_seq; + if (fileinfo->archive_seq == 0) + /* This is an archive we are not using completely. Give it a + unique number. */ + fileinfo->archive_seq = ++archive_seq; /* If there are no unresolved symbols don't do anything. */ + assert (ld_state.extract_rule == defaultextract + || ld_state.extract_rule == weakextract); if ((likely (ld_state.extract_rule == defaultextract) - && ld_state.nunresolved_nonweak == 0) - || (unlikely (ld_state.extract_rule == weakextract) - && ld_state.nunresolved == 0)) + ? ld_state.nunresolved_nonweak : ld_state.nunresolved) == 0) return 0; Elf_Arsym *syms; @@ -1735,7 +1910,6 @@ extract_from_archive (struct usedfiles *fileinfo) the first definition. */ // XXX Is this a compatible behavior? bool any_used; - int nround = 0; do { any_used = false; @@ -1793,7 +1967,7 @@ extract_from_archive (struct usedfiles *fileinfo) } } - if (++nround == 1) + if (any_used) { /* This is an archive therefore it must have a number. */ assert (fileinfo->archive_seq != 0); @@ -1851,6 +2025,18 @@ file_process2 (struct usedfiles *fileinfo) return 1; } + /* Make sure the file type matches the backend. */ + if (FILEINFO_EHDR (fileinfo->ehdr).e_machine + != ebl_get_elfmachine (ld_state.ebl)) + { + fprintf (stderr, gettext ("\ +%s: input file incompatible with ELF machine type %s\n"), + fileinfo->rfname, + ebl_backend_name (ld_state.ebl)); + fileinfo->status = closed; + return 1; + } + /* Determine the section header string table section index. */ if (unlikely (elf_getshstrndx (fileinfo->elf, &fileinfo->shstrndx) < 0)) @@ -1974,9 +2160,22 @@ cannot use DSO '%s' when generating relocatable object file"), res = 0; } else - /* Extract only the members from the archive which are - currently referenced by unresolved symbols. */ - res = extract_from_archive (fileinfo); + { + if (ld_state.group_start_requested + && ld_state.group_start_archive == NULL) + ld_state.group_start_archive = fileinfo; + + if (ld_state.archives == NULL) + ld_state.archives = fileinfo; + + if (ld_state.tailarchives != NULL) + ld_state.tailarchives->next = fileinfo; + ld_state.tailarchives = fileinfo; + + /* Extract only the members from the archive which are + currently referenced by unresolved symbols. */ + res = extract_from_archive (fileinfo); + } } else /* This should never happen, we know about no other types. */ @@ -2032,7 +2231,7 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo, /* We found the file. Now test whether it is a file type we can handle. - XXX Do we have to have the ability to start from a given + XXX Do we need to have the ability to start from a given position in the search path again to look for another file if the one found has not the right type? */ res = open_elf (fileinfo, elf_begin (fileinfo->fd, @@ -2075,19 +2274,24 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo, runp = runp->next; } while (runp != fileinfo->next); + + /* Do not do this again. */ + ld_state.archives = NULL; + + /* Do not move on to the next archive. */ + *nextp = fileinfo->next = NULL; } } else if (unlikely (fileinfo->group_end)) { - /* This is the end of a group. We possibly of to go back. + /* This is the end of a group. We possibly have to go back. Determine which file we would go back to and see whether it makes sense. If there has not been an archive we don't have to do anything. */ - if (!ld_state.group_start_requested) + if (ld_state.group_start_requested) { if (ld_state.group_start_archive != ld_state.tailarchives) - /* The loop would include more than one archive, add the - pointer. */ + /* The loop includes more than one archive, add the pointer. */ { *nextp = ld_state.tailarchives->group_backref = ld_state.group_start_archive; @@ -2106,6 +2310,7 @@ ld_generic_file_process (int fd, struct usedfiles *fileinfo, /* Clear the flags. */ ld_state.group_start_requested = false; + ld_state.group_start_archive = NULL; fileinfo->group_end = false; } @@ -2238,6 +2443,11 @@ ld_generic_generate_sections (struct ld_state *statep) /* The relocation section type. */ int rel_type = REL_TYPE (&ld_state) == DT_REL ? SHT_REL : SHT_RELA; + /* When requested, every output file will have a build ID section. */ + if (statep->build_id != NULL) + new_generated_scn (scn_dot_note_gnu_build_id, ".note.gnu.build-id", + SHT_NOTE, SHF_ALLOC, 0, 4); + /* When building dynamically linked object we have to include a section containing a string describing the interpreter. This should be at the very beginning of the file together with the @@ -2249,15 +2459,15 @@ ld_generic_generate_sections (struct ld_state *statep) program header. */ if (dynamically_linked_p ()) { - int ndt_needed; /* Use any versioning (defined or required)? */ bool use_versioning = false; /* Use version requirements? */ bool need_version = false; /* First the .interp section. */ - new_generated_scn (scn_dot_interp, ".interp", SHT_PROGBITS, SHF_ALLOC, - 0, 1); + if (ld_state.interp != NULL || ld_state.file_type != dso_file_type) + new_generated_scn (scn_dot_interp, ".interp", SHT_PROGBITS, SHF_ALLOC, + 0, 1); /* Now the .dynamic section. */ new_generated_scn (scn_dot_dynamic, ".dynamic", SHT_DYNAMIC, @@ -2277,13 +2487,13 @@ ld_generic_generate_sections (struct ld_state *statep) 0, 1); /* And a hashing table. */ // XXX For Linux/Alpha we need other sizes unless they change... - new_generated_scn (scn_dot_hash, ".hash", SHT_HASH, SHF_ALLOC, - sizeof (Elf32_Word), sizeof (Elf32_Word)); - - /* By default we add all DSOs provided on the command line. If - the user added '-z ignore' to the command line we only add - those which are actually used. */ - ndt_needed = ld_state.ignore_unused_dsos ? 0 : ld_state.ndsofiles; + if (GENERATE_SYSV_HASH) + new_generated_scn (scn_dot_hash, ".hash", SHT_HASH, SHF_ALLOC, + sizeof (Elf32_Word), sizeof (Elf32_Word)); + if (GENERATE_GNU_HASH) + new_generated_scn (scn_dot_gnu_hash, ".gnu.hash", SHT_GNU_HASH, + SHF_ALLOC, sizeof (Elf32_Word), + sizeof (Elf32_Word)); /* Create the section associated with the PLT if necessary. */ if (ld_state.nplt > 0) @@ -2304,8 +2514,11 @@ ld_generic_generate_sections (struct ld_state *statep) : xelf_fsize (ld_state.outelf, ELF_T_RELA, 1), xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1)); - /* This means we will also need the .got section. */ - ld_state.need_got = true; + /* XXX We might need a function which returns the section flags. */ + new_generated_scn (scn_dot_gotplt, ".got.plt", SHT_PROGBITS, + SHF_ALLOC | SHF_WRITE, + xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1), + xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1)); /* Mark all used DSOs as used. Determine whether any referenced object uses symbol versioning. */ @@ -2359,29 +2572,29 @@ ld_generic_generate_sections (struct ld_state *statep) new_generated_scn (scn_dot_version_r, ".gnu.version_r", SHT_GNU_verneed, SHF_ALLOC, 0, xelf_fsize (ld_state.outelf, ELF_T_WORD, 1)); + } - /* Now count the used DSOs since this is what the user - wants. */ - ndt_needed = 0; - if (ld_state.ndsofiles > 0) - { - struct usedfiles *frunp = ld_state.dsofiles; + /* Now count the used DSOs since this is what the user + wants. */ + int ndt_needed = 0; + if (ld_state.ndsofiles > 0) + { + struct usedfiles *frunp = ld_state.dsofiles; - do - if (! ld_state.ignore_unused_dsos || frunp->used) - { - ++ndt_needed; - if (frunp->lazyload) - /* We have to create another dynamic section - entry for the DT_POSFLAG_1 entry. - - XXX Once more functionality than the - lazyloading flag are suppported the test - must be extended. */ - ++ndt_needed; - } - while ((frunp = frunp->next) != ld_state.dsofiles); - } + do + if (! frunp->as_needed || frunp->used) + { + ++ndt_needed; + if (frunp->lazyload) + /* We have to create another dynamic section + entry for the DT_POSFLAG_1 entry. + + XXX Once more functionality than the lazyloading + flag are suppported the test must be + extended. */ + ++ndt_needed; + } + while ((frunp = frunp->next) != ld_state.dsofiles); } if (use_versioning) @@ -2459,7 +2672,7 @@ ld_generic_open_outfile (struct ld_state *statep, int machine, int klass, { strcpy (mempcpy (tempfname, ld_state.outfname, outfname_len), ".XXXXXX"); - /* The useof mktemp() here is fine. We do not want to use + /* The use of mktemp() here is fine. We do not want to use mkstemp() since then the umask isn't used. And the output file will have these permissions anyhow. Any intruder could change the file later if it would be possible now. */ @@ -2654,7 +2867,7 @@ match_section (const char *osectname, struct filemask_section_name *sectmask, const char *brfname = basename (runp->fileinfo->rfname); /* If the section isn't used, the name doesn't match the positive - inclusion list or the name does match the negative inclusion + inclusion list, or the name does match the negative inclusion list, ignore the section. */ if (!runp->used || (sectmask->filemask != NULL @@ -2699,7 +2912,9 @@ match_section (const char *osectname, struct filemask_section_name *sectmask, newp->kind = scn_normal; newp->name = osectname; newp->type = SCNINFO_SHDR (found->shdr).sh_type; - newp->flags = SCNINFO_SHDR (found->shdr).sh_flags; + /* Executable or DSO do not have section groups. Drop that + information. */ + newp->flags = SCNINFO_SHDR (found->shdr).sh_flags & ~SHF_GROUP; newp->segment_nr = segment_nr; newp->last = found->next = found; newp->used = true; @@ -2730,9 +2945,12 @@ match_section (const char *osectname, struct filemask_section_name *sectmask, /* XXX Any better choice? */ queued->type = SHT_PROGBITS; if (queued->flags != SCNINFO_SHDR (found->shdr).sh_flags) + /* Executable or DSO do not have section groups. Drop that + information. */ queued->flags = ebl_sh_flags_combine (ld_state.ebl, queued->flags, - SCNINFO_SHDR (found->shdr).sh_flags); + SCNINFO_SHDR (found->shdr).sh_flags + & ~SHF_GROUP); /* Accumulate the relocation section size. */ queued->relsize += found->relsize; @@ -2765,7 +2983,7 @@ sort_sections_lscript (void) renaming the containing section in the output file. */ ld_state.nallsections = 0; size_t segment_nr; - size_t last_writable = ~0; + size_t last_writable = ~0ul; for (segment_nr = 0; segment != NULL; segment = segment->next, ++segment_nr) { struct output_rule *orule; @@ -2801,7 +3019,7 @@ sort_sections_lscript (void) This is why it is important to get the last block. */ if (ld_state.ncopy > 0 || ld_state.common_syms != NULL) { - if (last_writable == ~0) + if (last_writable == ~0ul) error (EXIT_FAILURE, 0, "no writable segment"); if (ld_state.allsections[last_writable]->type != SHT_NOBITS) @@ -3161,7 +3379,7 @@ reduce_symbol_p (XElf_Sym *sym, struct Ebl_Strent *strent) { search.id = strndupa (str, version - str); if (*++version == VER_CHR) - /* Skip the second '@' signalling a default definition. */ + /* Skip the second '@' signaling a default definition. */ ++version; } else @@ -3332,7 +3550,8 @@ optimal_bucket_size (Elf32_Word *hashcodes, size_t maxcnt, int optlevel) memset (counts, '\0', (maxcnt + 1) * sizeof (uint32_t)); /* Determine how often each hash bucket is used. */ - for (inner = 0; inner < maxcnt; ++inner) + assert (hashcodes[0] == 0); + for (inner = 1; inner < maxcnt; ++inner) ++lengths[hashcodes[inner] % size]; /* Determine the lengths. */ @@ -3393,6 +3612,17 @@ optimal_bucket_size (Elf32_Word *hashcodes, size_t maxcnt, int optlevel) } +static void +optimal_gnu_hash_size (Elf32_Word *hashcodes, size_t maxcnt, int optlevel, + size_t *bitmask_nwords, size_t *shift, size_t *nbuckets) +{ + // XXX Implement something real + *bitmask_nwords = 256; + *shift = 6; + *nbuckets = 3 * maxcnt / 2; +} + + static XElf_Addr find_entry_point (void) { @@ -3452,7 +3682,7 @@ find_entry_point (void) { if (ld_state.entry != NULL) error (0, 0, gettext ("\ -cannot find entry symbol \"%s\": defaulting to %#0*" PRIx64), +cannot find entry symbol '%s': defaulting to %#0*" PRIx64), ld_state.entry, xelf_getclass (ld_state.outelf) == ELFCLASS32 ? 10 : 18, (uint64_t) result); @@ -3479,9 +3709,9 @@ fillin_special_symbol (struct symbol *symst, size_t scnidx, size_t nsym, /* The name offset will be filled in later. */ sym->st_name = 0; /* Traditionally: globally visible. */ - sym->st_info = XELF_ST_INFO (STB_GLOBAL, symst->type); - /* No special visibility or so. */ - sym->st_other = 0; + sym->st_info = XELF_ST_INFO (symst->local ? STB_LOCAL : STB_GLOBAL, + symst->type); + sym->st_other = symst->hidden ? STV_HIDDEN : STV_DEFAULT; /* Reference to the GOT or dynamic section. Since the GOT and dynamic section are only created for executables and DSOs it cannot be that the section index is too large. */ @@ -3490,6 +3720,8 @@ fillin_special_symbol (struct symbol *symst, size_t scnidx, size_t nsym, sym->st_shndx = scnidx; /* We want the beginning of the section. */ sym->st_value = 0; + // XXX What size? + sym->st_size = 0; /* Determine the size of the section. */ if (scnidx != SHN_ABS) @@ -3568,66 +3800,491 @@ allocate_version_names (struct usedfiles *runp, struct Ebl_Strtab *dynstrtab) } -XElf_Off +static XElf_Off create_verneed_data (XElf_Off offset, Elf_Data *verneeddata, struct usedfiles *runp, int *ntotal) { - size_t verneed_size = xelf_fsize (ld_state.outelf, ELF_T_VNEED, 1); - size_t vernaux_size = xelf_fsize (ld_state.outelf, ELF_T_VNAUX, 1); - int need_offset; - bool filled = false; - GElf_Verneed verneed; - GElf_Vernaux vernaux; - int ndef = 0; -size_t cnt; - - /* If this DSO has no versions skip it. */ - if (runp->nverdefused == 0) - return offset; - - /* We fill in the Verneed record last. Remember the - offset. */ - need_offset = offset; - offset += verneed_size; - - for (cnt = 2; cnt <= runp->nverdef; ++cnt) - if (runp->verdefused[cnt] != 0) - { - assert (runp->verdefent[cnt] != NULL); + size_t verneed_size = xelf_fsize (ld_state.outelf, ELF_T_VNEED, 1); + size_t vernaux_size = xelf_fsize (ld_state.outelf, ELF_T_VNAUX, 1); + int need_offset; + bool filled = false; + GElf_Verneed verneed; + GElf_Vernaux vernaux; + int ndef = 0; + size_t cnt; - if (filled) - { - vernaux.vna_next = vernaux_size; - (void) gelf_update_vernaux (verneeddata, offset, - &vernaux); - offset += vernaux_size; - } + /* If this DSO has no versions skip it. */ + if (runp->nverdefused == 0) + return offset; - vernaux.vna_hash - = elf_hash (ebl_string (runp->verdefent[cnt])); - vernaux.vna_flags = 0; - vernaux.vna_other = runp->verdefused[cnt]; - vernaux.vna_name = ebl_strtaboffset (runp->verdefent[cnt]); - filled = true; - ++ndef; - } + /* We fill in the Verneed record last. Remember the offset. */ + need_offset = offset; + offset += verneed_size; + + for (cnt = 2; cnt <= runp->nverdef; ++cnt) + if (runp->verdefused[cnt] != 0) + { + assert (runp->verdefent[cnt] != NULL); + + if (filled) + { + vernaux.vna_next = vernaux_size; + (void) gelf_update_vernaux (verneeddata, offset, &vernaux); + offset += vernaux_size; + } + + vernaux.vna_hash = elf_hash (ebl_string (runp->verdefent[cnt])); + vernaux.vna_flags = 0; + vernaux.vna_other = runp->verdefused[cnt]; + vernaux.vna_name = ebl_strtaboffset (runp->verdefent[cnt]); + filled = true; + ++ndef; + } + + assert (filled); + vernaux.vna_next = 0; + (void) gelf_update_vernaux (verneeddata, offset, &vernaux); + offset += vernaux_size; + + verneed.vn_version = VER_NEED_CURRENT; + verneed.vn_cnt = ndef; + verneed.vn_file = ebl_strtaboffset (runp->verdefent[1]); + /* The first auxiliary entry is always found directly + after the verneed entry. */ + verneed.vn_aux = verneed_size; + verneed.vn_next = --*ntotal > 0 ? offset - need_offset : 0; + (void) gelf_update_verneed (verneeddata, need_offset, &verneed); + + return offset; +} + + +/* Callback for qsort to sort dynamic string table. */ +static Elf32_Word *global_hashcodes; +static size_t global_nbuckets; +static int +sortfct_hashval (const void *p1, const void *p2) +{ + size_t idx1 = *(size_t *) p1; + size_t idx2 = *(size_t *) p2; + + int def1 = ndxtosym[idx1]->defined && !ndxtosym[idx1]->in_dso; + int def2 = ndxtosym[idx2]->defined && !ndxtosym[idx2]->in_dso; + + if (! def1 && def2) + return -1; + if (def1 && !def2) + return 1; + if (! def1) + return 0; + + Elf32_Word hval1 = (global_hashcodes[ndxtosym[idx1]->outdynsymidx] + % global_nbuckets); + Elf32_Word hval2 = (global_hashcodes[ndxtosym[idx2]->outdynsymidx] + % global_nbuckets); + + if (hval1 < hval2) + return -1; + if (hval1 > hval2) + return 1; + return 0; +} + + +/* Sort the dynamic symbol table. The GNU hash table lookup assumes + that all symbols with the same hash value module the bucket table + size follow one another. This avoids the extra hash chain table. + There is no need (and no way) to perform this operation if we do + not use the new hash table format. */ +static void +create_gnu_hash (size_t nsym_local, size_t nsym, size_t nsym_dyn, + Elf32_Word *gnuhashcodes) +{ + size_t gnu_bitmask_nwords = 0; + size_t gnu_shift = 0; + size_t gnu_nbuckets = 0; + Elf32_Word *gnu_bitmask = NULL; + Elf32_Word *gnu_buckets = NULL; + Elf32_Word *gnu_chain = NULL; + XElf_Shdr_vardef (shdr); + + /* Determine the "optimal" bucket size. */ + optimal_gnu_hash_size (gnuhashcodes, nsym_dyn, ld_state.optlevel, + &gnu_bitmask_nwords, &gnu_shift, &gnu_nbuckets); + + /* Create the .gnu.hash section data structures. */ + Elf_Scn *hashscn = elf_getscn (ld_state.outelf, ld_state.gnuhashscnidx); + xelf_getshdr (hashscn, shdr); + Elf_Data *hashdata = elf_newdata (hashscn); + if (shdr == NULL || hashdata == NULL) + error (EXIT_FAILURE, 0, gettext ("\ +cannot create GNU hash table section for output file: %s"), + elf_errmsg (-1)); + + shdr->sh_link = ld_state.dynsymscnidx; + (void) xelf_update_shdr (hashscn, shdr); + + hashdata->d_size = (xelf_fsize (ld_state.outelf, ELF_T_ADDR, + gnu_bitmask_nwords) + + (4 + gnu_nbuckets + nsym_dyn) * sizeof (Elf32_Word)); + hashdata->d_buf = xcalloc (1, hashdata->d_size); + hashdata->d_align = sizeof (Elf32_Word); + hashdata->d_type = ELF_T_WORD; + hashdata->d_off = 0; + + ((Elf32_Word *) hashdata->d_buf)[0] = gnu_nbuckets; + ((Elf32_Word *) hashdata->d_buf)[2] = gnu_bitmask_nwords; + ((Elf32_Word *) hashdata->d_buf)[3] = gnu_shift; + gnu_bitmask = &((Elf32_Word *) hashdata->d_buf)[4]; + gnu_buckets = &gnu_bitmask[xelf_fsize (ld_state.outelf, ELF_T_ADDR, + gnu_bitmask_nwords) + / sizeof (*gnu_buckets)]; + gnu_chain = &gnu_buckets[gnu_nbuckets]; +#ifndef NDEBUG + void *endp = &gnu_chain[nsym_dyn]; +#endif + assert (endp == (void *) ((char *) hashdata->d_buf + hashdata->d_size)); + + + size_t *remap = xmalloc (nsym_dyn * sizeof (size_t)); +#ifndef NDEBUG + size_t nsym_dyn_cnt = 1; +#endif + for (size_t cnt = nsym_local; cnt < nsym; ++cnt) + if (symstrent[cnt] != NULL) + { + assert (ndxtosym[cnt]->outdynsymidx > 0); + assert (ndxtosym[cnt]->outdynsymidx < nsym_dyn); + remap[ndxtosym[cnt]->outdynsymidx] = cnt; +#ifndef NDEBUG + ++nsym_dyn_cnt; +#endif + } + assert (nsym_dyn_cnt == nsym_dyn); + + // XXX Until we can rely on qsort_r use global variables. + global_hashcodes = gnuhashcodes; + global_nbuckets = gnu_nbuckets; + qsort (remap + 1, nsym_dyn - 1, sizeof (size_t), sortfct_hashval); + + bool bm32 = (xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1) + == sizeof (Elf32_Word)); + + size_t first_defined = 0; + Elf64_Word bitmask_idxbits = gnu_bitmask_nwords - 1; + Elf32_Word last_bucket = 0; + for (size_t cnt = 1; cnt < nsym_dyn; ++cnt) + { + if (first_defined == 0) + { + if (! ndxtosym[remap[cnt]]->defined + || ndxtosym[remap[cnt]]->in_dso) + goto next; + + ((Elf32_Word *) hashdata->d_buf)[1] = first_defined = cnt; + } + + Elf32_Word hval = gnuhashcodes[ndxtosym[remap[cnt]]->outdynsymidx]; + + if (bm32) + { + Elf32_Word *bsw = &gnu_bitmask[(hval / 32) & bitmask_idxbits]; + assert ((void *) gnu_bitmask <= (void *) bsw); + assert ((void *) bsw < (void *) gnu_buckets); + *bsw |= 1 << (hval & 31); + *bsw |= 1 << ((hval >> gnu_shift) & 31); + } + else + { + Elf64_Word *bsw = &((Elf64_Word *) gnu_bitmask)[(hval / 64) + & bitmask_idxbits]; + assert ((void *) gnu_bitmask <= (void *) bsw); + assert ((void *) bsw < (void *) gnu_buckets); + *bsw |= 1 << (hval & 63); + *bsw |= 1 << ((hval >> gnu_shift) & 63); + } + + size_t this_bucket = hval % gnu_nbuckets; + if (cnt == first_defined || this_bucket != last_bucket) + { + if (cnt != first_defined) + { + /* Terminate the previous chain. */ + assert ((void *) &gnu_chain[cnt - first_defined - 1] < endp); + gnu_chain[cnt - first_defined - 1] |= 1; + } + + assert (this_bucket < gnu_nbuckets); + gnu_buckets[this_bucket] = cnt; + last_bucket = this_bucket; + } + + assert (cnt >= first_defined); + assert (cnt - first_defined < nsym_dyn); + gnu_chain[cnt - first_defined] = hval & ~1u; + + next: + ndxtosym[remap[cnt]]->outdynsymidx = cnt; + } + + /* Terminate the last chain. */ + if (first_defined != 0) + { + assert (nsym_dyn > first_defined); + assert (nsym_dyn - first_defined - 1 < nsym_dyn); + gnu_chain[nsym_dyn - first_defined - 1] |= 1; + + hashdata->d_size -= first_defined * sizeof (Elf32_Word); + } + else + /* We do not need any hash table. */ + // XXX + do { } while (0); + + free (remap); +} + + +/* Create the SysV-style hash table. */ +static void +create_hash (size_t nsym_local, size_t nsym, size_t nsym_dyn, + Elf32_Word *hashcodes) +{ + size_t nbucket = 0; + Elf32_Word *bucket = NULL; + Elf32_Word *chain = NULL; + XElf_Shdr_vardef (shdr); + + /* Determine the "optimal" bucket size. If we also generate the + new-style hash function there is no need to waste effort and + space on the old one which should not be used. Make it as small + as possible. */ + if (GENERATE_GNU_HASH) + nbucket = 1; + else + nbucket = optimal_bucket_size (hashcodes, nsym_dyn, ld_state.optlevel); + /* Create the .hash section data structures. */ + Elf_Scn *hashscn = elf_getscn (ld_state.outelf, ld_state.hashscnidx); + xelf_getshdr (hashscn, shdr); + Elf_Data *hashdata = elf_newdata (hashscn); + if (shdr == NULL || hashdata == NULL) + error (EXIT_FAILURE, 0, gettext ("\ +cannot create hash table section for output file: %s"), + elf_errmsg (-1)); + + shdr->sh_link = ld_state.dynsymscnidx; + (void) xelf_update_shdr (hashscn, shdr); + + hashdata->d_size = (2 + nsym_dyn + nbucket) * sizeof (Elf32_Word); + hashdata->d_buf = xcalloc (1, hashdata->d_size); + hashdata->d_align = sizeof (Elf32_Word); + hashdata->d_type = ELF_T_WORD; + hashdata->d_off = 0; + + ((Elf32_Word *) hashdata->d_buf)[0] = nbucket; + ((Elf32_Word *) hashdata->d_buf)[1] = nsym_dyn; + bucket = &((Elf32_Word *) hashdata->d_buf)[2]; + chain = &((Elf32_Word *) hashdata->d_buf)[2 + nbucket]; + + for (size_t cnt = nsym_local; cnt < nsym; ++cnt) + if (symstrent[cnt] != NULL) + { + size_t dynidx = ndxtosym[cnt]->outdynsymidx; + size_t hashidx = hashcodes[dynidx] % nbucket; + if (bucket[hashidx] == 0) + bucket[hashidx] = dynidx; + else + { + hashidx = bucket[hashidx]; + while (chain[hashidx] != 0) + hashidx = chain[hashidx]; - assert (filled); - vernaux.vna_next = 0; - (void) gelf_update_vernaux (verneeddata, offset, &vernaux); - offset += vernaux_size; - - verneed.vn_version = VER_NEED_CURRENT; - verneed.vn_cnt = ndef; - verneed.vn_file = ebl_strtaboffset (runp->verdefent[1]); - /* The first auxiliary entry is always found directly - after the verneed entry. */ - verneed.vn_aux = verneed_size; - verneed.vn_next = --*ntotal > 0 ? offset - need_offset : 0; - (void) gelf_update_verneed (verneeddata, need_offset, - &verneed); - - return offset; + chain[hashidx] = dynidx; + } + } +} + + +static void +create_build_id_section (Elf_Scn *scn) +{ + /* We know how large the section will be so we can create it now. */ + Elf_Data *d = elf_newdata (scn); + if (d == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot create build ID section: %s"), + elf_errmsg (-1)); + + d->d_type = ELF_T_BYTE; + d->d_version = EV_CURRENT; + + /* The note section header. */ + assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr)); + d->d_size = sizeof (GElf_Nhdr); + /* The string is four bytes long. */ + d->d_size += sizeof (ELF_NOTE_GNU); + assert (d->d_size % 4 == 0); + + if (strcmp (ld_state.build_id, "md5") == 0 + || strcmp (ld_state.build_id, "uuid") == 0) + d->d_size += 16; + else if (strcmp (ld_state.build_id, "sha1") == 0) + d->d_size += 20; + else + { + assert (ld_state.build_id[0] == '0' && ld_state.build_id[1] == 'x'); + /* Use an upper limit of the possible number of bytes generated + from the string. */ + d->d_size += strlen (ld_state.build_id) / 2; + } + + d->d_buf = xcalloc (d->d_size, 1); + d->d_off = 0; + d->d_align = 0; +} + + +static void +compute_hash_sum (void (*hashfct) (const void *, size_t, void *), void *ctx) +{ + /* The call cannot fail. */ + size_t shstrndx; + (void) elf_getshstrndx (ld_state.outelf, &shstrndx); + + const char *ident = elf_getident (ld_state.outelf, NULL); + bool same_byte_order = ((ident[EI_DATA] == ELFDATA2LSB + && __BYTE_ORDER == __LITTLE_ENDIAN) + || (ident[EI_DATA] == ELFDATA2MSB + && __BYTE_ORDER == __BIG_ENDIAN)); + + /* Iterate over all sections to find those which are not strippable. */ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ld_state.outelf, scn)) != NULL) + { + /* Get the section header. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + assert (shdr != NULL); + + if (SECTION_STRIP_P (shdr, elf_strptr (ld_state.outelf, shstrndx, + shdr->sh_name), true)) + /* The section can be stripped. Don't use it. */ + continue; + + /* Do not look at NOBITS sections. */ + if (shdr->sh_type == SHT_NOBITS) + continue; + + /* Iterate through the list of data blocks. */ + Elf_Data *data = NULL; + while ((data = INTUSE(elf_getdata) (scn, data)) != NULL) + /* If the file byte order is the same as the host byte order + process the buffer directly. If the data is just a stream + of bytes which the library will not convert we can use it + as well. */ + if (likely (same_byte_order) || data->d_type == ELF_T_BYTE) + hashfct (data->d_buf, data->d_size, ctx); + else + { + /* Convert the data to file byte order. */ + if (gelf_xlatetof (ld_state.outelf, data, data, ident[EI_DATA]) + == NULL) + error (EXIT_FAILURE, 0, gettext ("\ +cannot convert section data to file format: %s"), + elf_errmsg (-1)); + + hashfct (data->d_buf, data->d_size, ctx); + + /* And convert it back. */ + if (gelf_xlatetom (ld_state.outelf, data, data, ident[EI_DATA]) + == NULL) + error (EXIT_FAILURE, 0, gettext ("\ +cannot convert section data to memory format: %s"), + elf_errmsg (-1)); + } + } +} + + +/* Iterate over the sections */ +static void +compute_build_id (void) +{ + Elf_Data *d = elf_getdata (elf_getscn (ld_state.outelf, + ld_state.buildidscnidx), NULL); + assert (d != NULL); + + GElf_Nhdr *hdr = d->d_buf; + hdr->n_namesz = sizeof (ELF_NOTE_GNU); + hdr->n_type = NT_GNU_BUILD_ID; + char *dp = mempcpy (hdr + 1, ELF_NOTE_GNU, sizeof (ELF_NOTE_GNU)); + + if (strcmp (ld_state.build_id, "sha1") == 0) + { + /* Compute the SHA1 sum of various parts of the generated file. + We compute the hash sum over the external representation. */ + struct sha1_ctx ctx; + sha1_init_ctx (&ctx); + + /* Compute the hash sum by running over all sections. */ + compute_hash_sum ((void (*) (const void *, size_t, void *)) sha1_process_bytes, + &ctx); + + /* We are done computing the checksum. */ + (void) sha1_finish_ctx (&ctx, dp); + + hdr->n_descsz = SHA1_DIGEST_SIZE; + } + else if (strcmp (ld_state.build_id, "md5") == 0) + { + /* Compute the MD5 sum of various parts of the generated file. + We compute the hash sum over the external representation. */ + struct md5_ctx ctx; + md5_init_ctx (&ctx); + + /* Compute the hash sum by running over all sections. */ + compute_hash_sum ((void (*) (const void *, size_t, void *)) md5_process_bytes, + &ctx); + + /* We are done computing the checksum. */ + (void) md5_finish_ctx (&ctx, dp); + + hdr->n_descsz = MD5_DIGEST_SIZE; + } + else if (strcmp (ld_state.build_id, "uuid") == 0) + { + int fd = open ("/dev/urandom", O_RDONLY); + if (fd == -1) + error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"), + "/dev/urandom"); + + if (TEMP_FAILURE_RETRY (read (fd, dp, 16)) != 16) + error (EXIT_FAILURE, 0, gettext ("cannot read enough data for UUID")); + + close (fd); + + hdr->n_descsz = 16; + } + else + { + const char *cp = ld_state.build_id + 2; + + /* The form of the string has been verified before so here we can + simplify the scanning. */ + do + { + if (isxdigit (cp[0])) + { + char ch1 = tolower (cp[0]); + char ch2 = tolower (cp[1]); + + *dp++ = (((isdigit (ch1) ? ch1 - '0' : ch1 - 'a' + 10) << 4) + | (isdigit (ch2) ? ch2 - '0' : ch2 - 'a' + 10)); + } + else + ++cp; + } + while (*cp != '\0'); + } } @@ -3642,7 +4299,7 @@ size_t cnt; For executables (shared or not) we have to create the program header, additional sections like the .interp, eventually (in addition) create a dynamic symbol table and a dynamic section. Also the relocations -have to be processed differently. */ + have to be processed differently. */ static int ld_generic_create_outfile (struct ld_state *statep) { @@ -3684,6 +4341,7 @@ ld_generic_create_outfile (struct ld_state *statep) Elf_Data *dynsymdata = NULL; Elf_Data *dynstrdata = NULL; Elf32_Word *hashcodes = NULL; + Elf32_Word *gnuhashcodes = NULL; size_t nsym_dyn_allocated = 0; Elf_Scn *versymscn = NULL; Elf_Data *versymdata = NULL; @@ -3827,6 +4485,17 @@ ld_generic_create_outfile (struct ld_state *statep) continue; } + if (unlikely (head->kind == scn_dot_gotplt)) + { + /* Remember the index of this section. */ + ld_state.gotpltscnidx = elf_ndxscn (scn); + + /* Give the backend the change to initialize the section. */ + INITIALIZE_GOTPLT (&ld_state, scn); + + continue; + } + if (unlikely (head->kind == scn_dot_dynrel)) { Elf_Data *outdata; @@ -3908,7 +4577,7 @@ ld_generic_create_outfile (struct ld_state *statep) struct usedfiles *frunp = ld_state.dsofiles; do - if (! ld_state.ignore_unused_dsos || frunp->used) + if (! frunp->as_needed || frunp->used) frunp->sonameent = ebl_strtabadd (dynstrtab, frunp->soname, 0); while ((frunp = frunp->next) != ld_state.dsofiles); @@ -3969,6 +4638,14 @@ ld_generic_create_outfile (struct ld_state *statep) continue; } + if (unlikely (head->kind == scn_dot_gnu_hash)) + { + /* Remember the index of this section. */ + ld_state.gnuhashscnidx = elf_ndxscn (scn); + + continue; + } + if (unlikely (head->kind == scn_dot_plt)) { /* Remember the index of this section. */ @@ -4007,6 +4684,16 @@ ld_generic_create_outfile (struct ld_state *statep) continue; } + if (unlikely (head->kind == scn_dot_note_gnu_build_id)) + { + /* Remember the index of this section. */ + ld_state.buildidscnidx = elf_ndxscn (scn); + + create_build_id_section (scn); + + continue; + } + /* If we come here we must be handling a normal section. */ assert (head->kind == scn_normal); @@ -4444,7 +5131,7 @@ ld_generic_create_outfile (struct ld_state *statep) gettext ("cannot create section for output file: %s"), elf_errmsg (-1)); - outdata->d_buf = (void *) "\0ld (Red Hat " PACKAGE ") " VERSION; + outdata->d_buf = (void *) "\0ld (" PACKAGE_NAME ") " PACKAGE_VERSION; outdata->d_size = strlen ((char *) outdata->d_buf + 1) + 2; outdata->d_off = offset; outdata->d_type = ELF_T_BYTE; @@ -4481,7 +5168,8 @@ ld_generic_create_outfile (struct ld_state *statep) if (ld_state.got_symbol != NULL) { assert (nsym < nsym_allocated); - fillin_special_symbol (ld_state.got_symbol, ld_state.gotscnidx, + // XXX Fix so that it works even if no PLT is needed. + fillin_special_symbol (ld_state.got_symbol, ld_state.gotpltscnidx, nsym++, symdata, strtab); } @@ -4510,6 +5198,7 @@ ld_generic_create_outfile (struct ld_state *statep) file = ld_state.relfiles->next; symdata = elf_getdata (elf_getscn (ld_state.outelf, ld_state.symscnidx), NULL); + do { size_t maxcnt; @@ -4568,11 +5257,11 @@ ld_generic_create_outfile (struct ld_state *statep) continue; #if NATIVE_ELF != 0 - /* Copy old data. */ - XElf_Sym *sym2 = sym; - assert (nsym < nsym_allocated); - xelf_getsym (symdata, nsym, sym); - *sym = *sym2; + /* Copy old data. We create a temporary copy because the + symbol might still be discarded. */ + XElf_Sym sym_mem; + sym_mem = *sym; + sym = &sym_mem; #endif if (sym->st_shndx != SHN_UNDEF @@ -4677,6 +5366,7 @@ section index too large in dynamic symbol table")); /* Once we know the name this field will get the correct offset. For now set it to zero which means no name associated. */ + GElf_Word st_name = sym->st_name; sym->st_name = 0; /* If we had to merge sections we have a completely new @@ -4687,7 +5377,7 @@ section index too large in dynamic symbol table")); /* Create the record in the output sections. */ assert (nsym < nsym_allocated); - xelf_update_symshndx (symdata, xndxdata, nsym, sym, xndx, 0); + xelf_update_symshndx (symdata, xndxdata, nsym, sym, xndx, 1); /* Add the reference to the symbol record in case we need it. Find the symbol if this has not happened yet. We do @@ -4695,12 +5385,33 @@ section index too large in dynamic symbol table")); if (defp == NULL && cnt >= file->nlocalsymbols) { defp = file->symref[cnt]; - assert (defp != NULL); + + if (defp == NULL) + { + /* This is a symbol in a discarded COMDAT section. + Find the definition we actually use. */ + // XXX The question is: do we have to do this here + // XXX or can we do it earlier when we discard the + // XXX section. + struct symbol search; + search.name = elf_strptr (file->elf, file->symstridx, + st_name); + struct symbol *realp + = ld_symbol_tab_find (&ld_state.symbol_tab, + elf_hash (search.name), &search); + if (realp == NULL) + // XXX What to do here? + error (EXIT_FAILURE, 0, + "couldn't find symbol from COMDAT section"); + + file->symref[cnt] = realp; + + continue; + } } - /* Store the reference to the symbol record. The - sorting code will have to keep this array in the - correct order, too. */ + /* Store the reference to the symbol record. The sorting + code will have to keep this array in the correct order, too. */ ndxtosym[nsym] = defp; /* One more entry finished. */ @@ -4717,7 +5428,6 @@ section index too large in dynamic symbol table")); nothing. */ assert (xndxdata == NULL || need_xndx); - /* Create the version related sections. */ if (ld_state.verneedscnidx != 0) { @@ -4760,6 +5470,10 @@ section index too large in dynamic symbol table")); if (reduce_symbol_p (sym, symstrent[cnt])) { + // XXX Check whether this is correct... + assert (ndxtosym[cnt]->outdynsymidx != 0); + ndxtosym[cnt]->outdynsymidx = 0; + sym->st_info = XELF_ST_INFO (STB_LOCAL, XELF_ST_TYPE (sym->st_info)); (void) xelf_update_sym (symdata, cnt, sym); @@ -5077,7 +5791,7 @@ section index too large in dynamic symbol table")); gelf_getversym (symp->file->versymdata, symp->symidx, &versym); - (void) gelf_update_versym (versymdata, nsym_dyn, + (void) gelf_update_versym (versymdata, symp->outdynsymidx, &symp->file->verdefused[versym]); } } @@ -5116,16 +5830,16 @@ cannot create dynamic symbol table for output file: %s"), /* We need one more array which contains the hash codes of the symbol names. */ - hashcodes = (Elf32_Word *) xcalloc (nsym_dyn_allocated, + hashcodes = (Elf32_Word *) xcalloc (__builtin_popcount ((int) ld_state.hash_style) + * nsym_dyn_allocated, sizeof (Elf32_Word)); + gnuhashcodes = hashcodes; + if (GENERATE_SYSV_HASH) + gnuhashcodes += nsym_dyn_allocated; /* We have and empty entry at the beginning. */ nsym_dyn = 1; - /* We don't mix PLT symbols and others. */ - size_t plt_idx = 1; - size_t obj_idx = 1 + ld_state.nplt; - /* Populate the table. */ for (cnt = nsym_local; cnt < nsym; ++cnt) { @@ -5150,59 +5864,73 @@ section index too large in dynamic symbol table")); if (XELF_ST_TYPE (sym->st_info) == STT_FILE || XELF_ST_VISIBILITY (sym->st_other) == STV_INTERNAL || XELF_ST_VISIBILITY (sym->st_other) == STV_HIDDEN - || (!ndxtosym[cnt]->in_dso && ndxtosym[cnt]->defined)) + || (!ld_state.export_all_dynamic + && !ndxtosym[cnt]->in_dso && ndxtosym[cnt]->defined)) { symstrent[cnt] = NULL; continue; } - size_t idx; - if (ndxtosym[cnt]->in_dso && ndxtosym[cnt]->type == STT_FUNC) - { - idx = plt_idx++; - assert (idx < 1 + ld_state.nplt); - } - else - { - idx = obj_idx++; - assert (idx < nsym_dyn_allocated); - } + /* Store the index of the symbol in the dynamic symbol + table. This is a preliminary value in case we use the + GNU-style hash table. */ + ndxtosym[cnt]->outdynsymidx = nsym_dyn; + + /* Create a new string table entry. */ + const char *str = ndxtosym[cnt]->name; + symstrent[cnt] = ebl_strtabadd (dynstrtab, str, 0); + if (GENERATE_SYSV_HASH) + hashcodes[nsym_dyn] = elf_hash (str); + if (GENERATE_GNU_HASH) + gnuhashcodes[nsym_dyn] = elf_gnu_hash (str); + ++nsym_dyn; + } + + if (ld_state.file_type != relocatable_file_type) + { + /* Finalize the dynamic string table. */ + ebl_strtabfinalize (dynstrtab, dynstrdata); + + assert (ld_state.hashscnidx != 0 || ld_state.gnuhashscnidx != 0); + + /* Create the GNU-style hash table. */ + if (GENERATE_GNU_HASH) + create_gnu_hash (nsym_local, nsym, nsym_dyn, gnuhashcodes); + + /* Create the SysV-style hash table. This has to happen + after the GNU-style table is created since + CREATE-GNU-HASH might reorder the dynamic symbol table. */ + if (GENERATE_SYSV_HASH) + create_hash (nsym_local, nsym, nsym_dyn, hashcodes); + } /* Add the version information. */ - if (versymdata != NULL) + if (versymdata != NULL) + for (cnt = nsym_local; cnt < nsym; ++cnt) + if (symstrent[cnt] != NULL) { struct symbol *symp = ndxtosym[cnt]; - if (symp->file->verdefdata != NULL) + /* Synthetic symbols (i.e., those with no file attached) + have no version information. */ + if (symp->file != NULL && symp->file->verdefdata != NULL) { GElf_Versym versym; gelf_getversym (symp->file->versymdata, symp->symidx, &versym); - (void) gelf_update_versym (versymdata, idx, + (void) gelf_update_versym (versymdata, symp->outdynsymidx, &symp->file->verdefused[versym]); } else { /* XXX Add support for version definitions. */ GElf_Versym global = VER_NDX_GLOBAL; - (void) gelf_update_versym (versymdata, idx, &global); + (void) gelf_update_versym (versymdata, nsym_dyn, &global); } } - /* Store the index of the symbol in the dynamic symbol table. */ - ndxtosym[cnt]->outdynsymidx = idx; - - /* Create a new string table entry. */ - const char *str = ndxtosym[cnt]->name; - symstrent[cnt] = ebl_strtabadd (dynstrtab, str, 0); - hashcodes[idx] = elf_hash (str); - ++nsym_dyn; - } - assert (nsym_dyn == obj_idx); - assert (ld_state.nplt + 1 == plt_idx); - /* Update the information about the symbol section. */ if (versymdata != NULL) { @@ -5223,52 +5951,11 @@ section index too large in dynamic symbol table")); if (ld_state.file_type != relocatable_file_type) { - size_t nbucket; - Elf32_Word *bucket; - Elf32_Word *chain; - size_t nchain; - Elf_Scn *hashscn; - Elf_Data *hashdata; - - /* Finalize the dynamic string table. */ - ebl_strtabfinalize (dynstrtab, dynstrdata); - - /* Determine the "optimal" bucket size. */ - nbucket = optimal_bucket_size (hashcodes, nsym_dyn, ld_state.optlevel); - - /* Create the .hash section data structures. */ - assert (ld_state.hashscnidx != 0); - hashscn = elf_getscn (ld_state.outelf, ld_state.hashscnidx); - xelf_getshdr (hashscn, shdr); - hashdata = elf_newdata (hashscn); - if (shdr == NULL || hashdata == NULL) - error (EXIT_FAILURE, 0, gettext ("\ -cannot create hash table section for output file: %s"), - elf_errmsg (-1)); - - shdr->sh_link = ld_state.dynsymscnidx; - (void) xelf_update_shdr (hashscn, shdr); - - hashdata->d_size = (2 + nsym_dyn + nbucket) * sizeof (Elf32_Word); - hashdata->d_buf = xcalloc (1, hashdata->d_size); - hashdata->d_align = sizeof (Elf32_Word); - hashdata->d_type = ELF_T_WORD; - hashdata->d_off = 0; - - ((Elf32_Word *) hashdata->d_buf)[0] = nbucket; - ((Elf32_Word *) hashdata->d_buf)[1] = nsym_dyn; - bucket = &((Elf32_Word *) hashdata->d_buf)[2]; - chain = &((Elf32_Word *) hashdata->d_buf)[2 + nbucket]; - - /* Haven't yet filled in any chain value. */ - nchain = 0; - /* Now put the names in. */ for (cnt = nsym_local; cnt < nsym; ++cnt) if (symstrent[cnt] != NULL) { XElf_Sym_vardef (sym); - size_t hashidx; size_t dynidx = ndxtosym[cnt]->outdynsymidx; #if NATIVE_ELF != 0 @@ -5284,27 +5971,10 @@ cannot create hash table section for output file: %s"), sym->st_name = ebl_strtaboffset (symstrent[cnt]); (void) xelf_update_sym (dynsymdata, dynidx, sym); - - /* Add to the hash table. */ - hashidx = hashcodes[dynidx] % nbucket; - if (bucket[hashidx] == 0) - bucket[hashidx] = dynidx; - else - { - hashidx = bucket[hashidx]; - while (chain[hashidx] != 0) - hashidx = chain[hashidx]; - - chain[hashidx] = dynidx; - } } free (hashcodes); - /* We don't need the map from the symbol table index to the symbol - structure anymore. */ - free (ndxtosym); - /* Create the required version section. */ if (ld_state.verneedscnidx != 0) { @@ -5377,10 +6047,6 @@ cannot create hash table section for output file: %s"), /* Write the updated info back. */ (void) xelf_update_shdr (dynsymscn, shdr); } - else - /* We don't need the map from the symbol table index to the symbol - structure anymore. */ - free (ndxtosym); /* We don't need the string table anymore. */ free (symstrent); @@ -5413,7 +6079,7 @@ cannot create hash table section for output file: %s"), strtab_ent = ebl_strtabadd (ld_state.shstrtab, ".strtab", 8); /* At this point we would have to test for failures in the allocation. But we skip this. First, the problem will be caught - latter when doing more allocations for the section header table. + later when doing more allocations for the section header table. Even if this would not be the case all that would happen is that the section names are empty. The binary would still be usable if it is an executable or a DSO. Not adding the test here saves @@ -5518,11 +6184,7 @@ cannot create hash table section for output file: %s"), groups = ld_state.groups; while (groups != NULL) { - Elf_Scn *scn; - struct scngroup *oldp; - Elf32_Word si; - - scn = elf_getscn (ld_state.outelf, groups->outscnidx); + Elf_Scn *scn = elf_getscn (ld_state.outelf, groups->outscnidx); xelf_getshdr (scn, shdr); assert (shdr != NULL); @@ -5533,7 +6195,8 @@ cannot create hash table section for output file: %s"), shdr->sh_entsize = sizeof (Elf32_Word); /* Determine the index for the signature symbol. */ - si = groups->symbol->file->symindirect[groups->symbol->symidx]; + Elf32_Word si + = groups->symbol->file->symindirect[groups->symbol->symidx]; if (si == 0) { assert (groups->symbol->file->symref[groups->symbol->symidx] @@ -5545,7 +6208,7 @@ cannot create hash table section for output file: %s"), (void) xelf_update_shdr (scn, shdr); - oldp = groups; + struct scngroup *oldp = groups; groups = groups->next; free (oldp); } @@ -5553,13 +6216,6 @@ cannot create hash table section for output file: %s"), if (ld_state.file_type != relocatable_file_type) { - size_t nphdr; - XElf_Addr addr; - struct output_segment *segment; - Elf_Scn *scn; - Elf32_Word nsec; - XElf_Phdr_vardef (phdr); - /* Every executable needs a program header. The number of entries varies. One exists for each segment. Each SHT_NOTE section gets one, too. For dynamically linked executables we have to create @@ -5567,8 +6223,12 @@ cannot create hash table section for output file: %s"), section. First count the number of segments. XXX Determine whether the segment is non-empty. */ - nphdr = 0; - segment = ld_state.output_segments; + size_t nphdr = 0; + + /* We always add a PT_GNU_stack entry. */ + ++nphdr; + + struct output_segment *segment = ld_state.output_segments; while (segment != NULL) { ++nphdr; @@ -5578,12 +6238,23 @@ cannot create hash table section for output file: %s"), /* Add the number of SHT_NOTE sections. We counted them earlier. */ nphdr += ld_state.nnotesections; - /* If we create a DSO or the file is linked against DSOs we have three - more entries: INTERP, PHDR, DYNAMIC. */ + /* If we create a DSO or the file is linked against DSOs we have + at least one more entry: DYNAMIC. If an interpreter is + specified we add PHDR and INTERP, too. */ if (dynamically_linked_p ()) - nphdr += 3; + { + ++nphdr; + + if (ld_state.interp != NULL || ld_state.file_type != dso_file_type) + nphdr += 2; + } + + /* If we need a TLS segment we need an entry for that. */ + if (ld_state.need_tls) + ++nphdr; /* Create the program header structure. */ + XElf_Phdr_vardef (phdr); if (xelf_newphdr (ld_state.outelf, nphdr) == 0) error (EXIT_FAILURE, 0, gettext ("cannot create program header: %s"), elf_errmsg (-1)); @@ -5599,17 +6270,30 @@ cannot create hash table section for output file: %s"), /* Now determine the memory addresses of all the sections and segments. */ - nsec = 0; - scn = elf_getscn (ld_state.outelf, ld_state.allsections[nsec]->scnidx); + Elf32_Word nsec = 0; + Elf_Scn *scn = elf_getscn (ld_state.outelf, + ld_state.allsections[nsec]->scnidx); xelf_getshdr (scn, shdr); assert (shdr != NULL); /* The address we start with is the offset of the first (not zeroth) section. */ - addr = shdr->sh_offset; + XElf_Addr addr = shdr->sh_offset; + XElf_Addr tls_offset = 0; + XElf_Addr tls_start = ~((XElf_Addr) 0); + XElf_Addr tls_end = 0; + XElf_Off tls_filesize = 0; + XElf_Addr tls_align = 0; /* The index of the first loadable segment. */ - nphdr = 1 + (dynamically_linked_p () == true) * 2; + nphdr = 0; + if (dynamically_linked_p ()) + { + ++nphdr; + if (ld_state.interp != NULL + || ld_state.file_type != dso_file_type) + nphdr += 2; + } segment = ld_state.output_segments; while (segment != NULL) @@ -5619,15 +6303,13 @@ cannot create hash table section for output file: %s"), XElf_Off nobits_size = 0; XElf_Off memsize = 0; - /* the minimum alignment is a page size. */ + /* The minimum alignment is a page size. */ segment->align = ld_state.pagesize; for (orule = segment->output_rules; orule != NULL; orule = orule->next) if (orule->tag == output_section) { - XElf_Off oldoff; - /* See whether this output rule corresponds to the next section. Yes, this is a pointer comparison. */ if (ld_state.allsections[nsec]->name @@ -5657,6 +6339,22 @@ cannot create hash table section for output file: %s"), /* Remember the address. */ ld_state.allsections[nsec]->addr = addr; + + /* Handle TLS sections. */ + if (unlikely (shdr->sh_flags & SHF_TLS)) + { + if (tls_start > addr) + { + tls_start = addr; + tls_offset = shdr->sh_offset; + } + if (tls_end < addr + shdr->sh_size) + tls_end = addr + shdr->sh_size; + if (shdr->sh_type != SHT_NOBITS) + tls_filesize += shdr->sh_size; + if (shdr->sh_addralign > tls_align) + tls_align = shdr->sh_addralign; + } } if (first_section) @@ -5679,12 +6377,19 @@ cannot create hash table section for output file: %s"), first_section = false; } - memsize = shdr->sh_offset - segment->offset + shdr->sh_size; - if (nobits_size != 0 && shdr->sh_type != SHT_NOTE) - error (EXIT_FAILURE, 0, gettext ("\ -internal error: nobits section follows nobits section")); - if (shdr->sh_type == SHT_NOBITS) - nobits_size += shdr->sh_size; + /* NOBITS TLS sections are not laid out in address space + along with the other sections. */ + if (shdr->sh_type != SHT_NOBITS + || (shdr->sh_flags & SHF_TLS) == 0) + { + memsize = (shdr->sh_offset - segment->offset + + shdr->sh_size); + if (nobits_size != 0 && shdr->sh_type != SHT_NOTE) + error (EXIT_FAILURE, 0, gettext ("\ +internal error: non-nobits section follows nobits section")); + if (shdr->sh_type == SHT_NOBITS) + nobits_size += shdr->sh_size; + } /* Determine the new address which is computed using the difference of the offsets on the sections. Note @@ -5692,7 +6397,7 @@ internal error: nobits section follows nobits section")); other in the section header table are also consecutive in the file. This is true here because libelf constructs files this way. */ - oldoff = shdr->sh_offset; + XElf_Off oldoff = shdr->sh_offset; if (++nsec >= ld_state.nallsections) break; @@ -5767,20 +6472,43 @@ internal error: nobits section follows nobits section")); xelf_getehdr (ld_state.outelf, ehdr); assert (ehdr != NULL); - xelf_getphdr_ptr (ld_state.outelf, 1, phdr); - phdr->p_type = PT_PHDR; - phdr->p_offset = ehdr->e_phoff; - phdr->p_vaddr = ld_state.output_segments->addr + phdr->p_offset; - phdr->p_paddr = phdr->p_vaddr; - phdr->p_filesz = ehdr->e_phnum * ehdr->e_phentsize; - phdr->p_memsz = phdr->p_filesz; - phdr->p_flags = 0; /* No need to set PF_R or so. */ + /* Add the TLS information. */ + if (ld_state.need_tls) + { + xelf_getphdr_ptr (ld_state.outelf, nphdr, phdr); + phdr->p_type = PT_TLS; + phdr->p_offset = tls_offset; + phdr->p_vaddr = tls_start; + phdr->p_paddr = tls_start; + phdr->p_filesz = tls_filesize; + phdr->p_memsz = tls_end - tls_start; + phdr->p_flags = PF_R; + phdr->p_align = tls_align; + ld_state.tls_tcb = tls_end; + ld_state.tls_start = tls_start; + + (void) xelf_update_phdr (ld_state.outelf, nphdr, phdr); + ++nphdr; + } + + /* Add the stack information. */ + xelf_getphdr_ptr (ld_state.outelf, nphdr, phdr); + phdr->p_type = PT_GNU_STACK; + phdr->p_offset = 0; + phdr->p_vaddr = 0; + phdr->p_paddr = 0; + phdr->p_filesz = 0; + phdr->p_memsz = 0; + phdr->p_flags = (PF_R | PF_W + | (ld_state.execstack == execstack_true ? PF_X : 0)); phdr->p_align = xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1); - (void) xelf_update_phdr (ld_state.outelf, 0, phdr); + (void) xelf_update_phdr (ld_state.outelf, nphdr, phdr); + ++nphdr; - /* Adjust the addresses in the addresses of the symbol according - to the load addresses of the sections. */ + + /* Adjust the addresses in the address fields of the symbol + records according to the load addresses of the sections. */ if (ld_state.need_symtab) for (cnt = 1; cnt < nsym; ++cnt) { @@ -5826,7 +6554,6 @@ internal error: nobits section follows nobits section")); } } - /* Now is a good time to determine the values of all the symbols we encountered. */ // XXX This loop is very inefficient. The hash tab iterator also @@ -5880,24 +6607,41 @@ internal error: nobits section follows nobits section")); { Elf_Scn *outscn; - assert (ld_state.interpscnidx != 0); - xelf_getshdr (elf_getscn (ld_state.outelf, ld_state.interpscnidx), - shdr); - assert (shdr != NULL); + int idx = 0; + if (ld_state.interp != NULL || ld_state.file_type != dso_file_type) + { + assert (ld_state.interpscnidx != 0); + xelf_getshdr (elf_getscn (ld_state.outelf, + ld_state.interpscnidx), shdr); + assert (shdr != NULL); - /* The interpreter string. */ - // XXX Do we need to support files (DSOs) without interpreters? - xelf_getphdr_ptr (ld_state.outelf, 1, phdr); - phdr->p_type = PT_INTERP; - phdr->p_offset = shdr->sh_offset; - phdr->p_vaddr = shdr->sh_addr; - phdr->p_paddr = phdr->p_vaddr; - phdr->p_filesz = shdr->sh_size; - phdr->p_memsz = phdr->p_filesz; - phdr->p_flags = 0; /* No need to set PF_R or so. */ - phdr->p_align = 1; /* It's a string. */ + xelf_getphdr_ptr (ld_state.outelf, idx, phdr); + phdr->p_type = PT_PHDR; + phdr->p_offset = ehdr->e_phoff; + phdr->p_vaddr = ld_state.output_segments->addr + phdr->p_offset; + phdr->p_paddr = phdr->p_vaddr; + phdr->p_filesz = ehdr->e_phnum * ehdr->e_phentsize; + phdr->p_memsz = phdr->p_filesz; + phdr->p_flags = 0; /* No need to set PF_R or so. */ + phdr->p_align = xelf_fsize (ld_state.outelf, ELF_T_ADDR, 1); + + (void) xelf_update_phdr (ld_state.outelf, idx, phdr); + ++idx; + + /* The interpreter string. */ + xelf_getphdr_ptr (ld_state.outelf, idx, phdr); + phdr->p_type = PT_INTERP; + phdr->p_offset = shdr->sh_offset; + phdr->p_vaddr = shdr->sh_addr; + phdr->p_paddr = phdr->p_vaddr; + phdr->p_filesz = shdr->sh_size; + phdr->p_memsz = phdr->p_filesz; + phdr->p_flags = 0; /* No need to set PF_R or so. */ + phdr->p_align = 1; /* It's a string. */ - (void) xelf_update_phdr (ld_state.outelf, 1, phdr); + (void) xelf_update_phdr (ld_state.outelf, idx, phdr); + ++idx; + } /* The pointer to the dynamic section. We this we need to get the information for the dynamic section first. */ @@ -5906,7 +6650,7 @@ internal error: nobits section follows nobits section")); xelf_getshdr (outscn, shdr); assert (shdr != NULL); - xelf_getphdr_ptr (ld_state.outelf, 2, phdr); + xelf_getphdr_ptr (ld_state.outelf, idx, phdr); phdr->p_type = PT_DYNAMIC; phdr->p_offset = shdr->sh_offset; phdr->p_vaddr = shdr->sh_addr; @@ -5916,7 +6660,7 @@ internal error: nobits section follows nobits section")); phdr->p_flags = 0; /* No need to set PF_R or so. */ phdr->p_align = shdr->sh_addralign; - (void) xelf_update_phdr (ld_state.outelf, 2, phdr); + (void) xelf_update_phdr (ld_state.outelf, idx, phdr); /* Fill in the reference to the .dynstr section. */ assert (ld_state.dynstrscnidx != 0); @@ -5933,7 +6677,7 @@ internal error: nobits section follows nobits section")); struct usedfiles *runp = ld_state.dsofiles->next; do - if (! ld_state.ignore_unused_dsos || runp->used) + if (runp->used || !runp->as_needed) { /* Add the position-dependent flag if necessary. */ if (runp->lazyload) @@ -6020,8 +6764,9 @@ internal error: nobits section follows nobits section")); /* Add the entries related to the .plt. */ if (ld_state.nplt > 0) { - xelf_getshdr (elf_getscn (ld_state.outelf, ld_state.gotscnidx), - shdr); + // XXX Make this work if there is no PLT + xelf_getshdr (elf_getscn (ld_state.outelf, + ld_state.gotpltscnidx), shdr); assert (shdr != NULL); new_dynamic_entry (dyndata, ld_state.ndynamic_filled++, // XXX This should probably be machine @@ -6201,8 +6946,18 @@ internal error: nobits section follows nobits section")); free (ld_state.dblindirect); - /* Finalize the .plt section the what belongs to them. */ - FINALIZE_PLT (statep, nsym, nsym_dyn); + /* Finalize the .plt section and what else belongs to it. */ + FINALIZE_PLT (statep, nsym, nsym_local, ndxtosym); + + + /* Finally, if we have to compute the build ID. */ + if (ld_state.build_id != NULL) + compute_build_id (); + + + /* We don't need the map from the symbol table index to the symbol + structure anymore. */ + free (ndxtosym); return 0; } @@ -6278,7 +7033,7 @@ ld_generic_special_section_number_p (struct ld_state *statep, size_t number) static bool ld_generic_section_type_p (struct ld_state *statep, GElf_Word type) { - if ((type >= SHT_NULL && type < SHT_NUM) + if (type < SHT_NUM /* XXX Enable the following two when implemented. */ // || type == SHT_GNU_LIBLIST // || type == SHT_CHECKSUM @@ -6334,7 +7089,19 @@ ld_generic_initialize_got (struct ld_state *statep, Elf_Scn *scn) static void -ld_generic_finalize_plt (struct ld_state *statep, size_t nsym, size_t nsym_dyn) +ld_generic_initialize_gotplt (struct ld_state *statep, Elf_Scn *scn) +{ + /* This cannot be implemented generally. There should have been a + machine dependent implementation and we should never have arrived + here. */ + error (EXIT_FAILURE, 0, gettext ("no machine specific '%s' implementation"), + "initialize_gotplt"); +} + + +static void +ld_generic_finalize_plt (struct ld_state *statep, size_t nsym, size_t nsym_dyn, + struct symbol **ndxtosymp) { /* By default we assume that nothing has to be done. */ } diff --git a/src/ldlex.c b/src/ldlex.c index e0bf0a5f..dbbdf07a 100644 --- a/src/ldlex.c +++ b/src/ldlex.c @@ -1,8 +1,13 @@ +#line 2 "ldlex.c" + +#line 4 "ldlex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + #define yy_create_buffer ld_create_buffer #define yy_delete_buffer ld_delete_buffer -#define yy_scan_buffer ld_scan_buffer -#define yy_scan_string ld_scan_string -#define yy_scan_bytes ld_scan_bytes #define yy_flex_debug ld_flex_debug #define yy_init_buffer ld_init_buffer #define yy_flush_buffer ld_flush_buffer @@ -11,76 +16,117 @@ #define yyin ldin #define yyleng ldleng #define yylex ldlex +#define yylineno ldlineno #define yyout ldout #define yyrestart ldrestart #define yytext ldtext -#define yylineno ldlineno - -#line 20 "ldlex.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#define yywrap ldwrap +#define yyalloc ldalloc +#define yyrealloc ldrealloc +#define yyfree ldfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include <stdio.h> -#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ -#ifdef __cplusplus +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif -#include <stdlib.h> +#endif /* ! FLEXINT_H */ -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -95,71 +141,83 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE ldrestart(ldin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +extern int ldleng; + +extern FILE *ldin, *ldout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE ldlex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-ldlineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < ldleng; ++yyl )\ + if ( ldtext[yyl] == '\n' )\ + --ldlineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up ldtext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up ldtext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -196,12 +254,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -211,179 +273,166 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via ldrestart()), so that the user can continue scanning by + * just pointing ldin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -static YY_BUFFER_STATE yy_current_buffer = 0; +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when ldtext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int ldleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow ldwrap()'s to do buffer switches + * instead of setting up a fresh ldin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void ldrestart (FILE *input_file ); +void ld_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE ld_create_buffer (FILE *file,int size ); +void ld_delete_buffer (YY_BUFFER_STATE b ); +void ld_flush_buffer (YY_BUFFER_STATE b ); +void ldpush_buffer_state (YY_BUFFER_STATE new_buffer ); +void ldpop_buffer_state (void ); + +static void ldensure_buffer_stack (void ); +static void ld_load_buffer_state (void ); +static void ld_init_buffer (YY_BUFFER_STATE b,FILE *file ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +#define YY_FLUSH_BUFFER ld_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +YY_BUFFER_STATE ld_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE ld_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE ld_scan_bytes (yyconst char *bytes,int len ); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +void *ldalloc (yy_size_t ); +void *ldrealloc (void *,yy_size_t ); +void ldfree (void * ); -#define yy_new_buffer yy_create_buffer +#define yy_new_buffer ld_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + ldensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + ld_create_buffer(ldin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + ldensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + ld_create_buffer(ldin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* Begin user sect3 */ -#define YY_USES_REJECT - -#define yywrap() 1 +#define ldwrap(n) 1 #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +FILE *ldin = (FILE *) 0, *ldout = (FILE *) 0; + typedef int yy_state_type; -extern int yylineno; -int yylineno = 1; -extern char *yytext; -#define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +extern int ldlineno; + +int ldlineno = 1; + +extern char *ldtext; +#define yytext_ptr ldtext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up ldtext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + ldleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 49 -#define YY_END_OF_BUFFER 50 -static yyconst short int yy_acclist[373] = - { 0, - 50, 48, 49, 47, 48, 49, 47, 49, 40, 48, - 49, 41, 48, 49, 31, 48, 49, 32, 48, 49, - 38, 45, 48, 49, 36, 48, 49, 43, 48, 49, - 37, 48, 49, 45, 48, 49, 39, 48, 49, 44, - 45, 48, 49, 44, 45, 48, 49, 33, 48, 49, - 34, 48, 49, 35, 48, 49, 45, 48, 49, 45, - 48, 49, 45, 48, 49, 45, 48, 49, 45, 48, - 49, 45, 48, 49, 45, 48, 49, 45, 48, 49, - 45, 48, 49, 45, 48, 49, 48, 49, 48, 49, - 45, 48, 49, 45, 48, 49, 29, 48, 49, 42, - - 48, 49, 30, 48, 49, 48, 49, 9, 49, 9, - 49, 47, 45, 46, 45, 46, 10, 46, 44, 45, - 46, 44, 45, 46, 44, 45, 46, 45, 46, 44, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 28, 45, - 46, 45, 46, 44, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - - 44, 45, 46, 45, 46, 45, 46, 45, 46, 45, - 46, 45, 46, 45, 46, 18, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 26, 45, 46, 45, 46, 45, 46, 45, 46, 11, - 45, 46, 12, 45, 46, 45, 46, 15, 45, 46, - 16, 45, 46, 45, 46, 45, 46, 45, 46, 45, - 46, 45, 46, 45, 46, 45, 46, 45, 46, 45, - 46, 45, 46, 45, 46, 17, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 45, 46, 45, 46, 19, 2, 6, 45, 46, 45, - - 46, 45, 46, 22, 45, 46, 45, 46, 24, 45, - 46, 45, 46, 27, 45, 46, 14, 4, 1, 8, - 5, 45, 46, 45, 46, 21, 45, 46, 45, 46, - 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, - 3, 7, 45, 46, 45, 46, 23, 45, 46, 45, - 46, 45, 46, 45, 46, 45, 46, 13, 45, 46, - 45, 46, 45, 46, 20, 45, 46, 45, 46, 25, - 45, 46 - } ; + (yy_c_buf_p) = yy_cp; -static yyconst short int yy_accept[212] = +#define YY_NUM_RULES 50 +#define YY_END_OF_BUFFER 51 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[219] = { 0, - 1, 1, 1, 1, 1, 2, 4, 7, 9, 12, - 15, 18, 21, 25, 28, 31, 34, 37, 40, 44, - 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, - 78, 81, 84, 87, 89, 91, 94, 97, 100, 103, - 106, 108, 110, 112, 113, 114, 115, 117, 119, 122, - 125, 128, 130, 133, 135, 137, 139, 141, 143, 145, - 147, 149, 151, 153, 155, 157, 159, 159, 160, 162, - 164, 164, 164, 164, 164, 167, 169, 171, 173, 175, - 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, - 197, 197, 199, 201, 201, 201, 201, 201, 201, 201, - - 204, 206, 208, 210, 212, 214, 216, 219, 221, 223, - 225, 227, 229, 231, 234, 236, 236, 238, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 243, 246, 248, - 251, 254, 256, 258, 260, 262, 264, 266, 268, 270, - 272, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 276, 279, 281, 283, 285, 287, 289, 291, 293, 295, - 296, 296, 297, 297, 297, 297, 298, 298, 298, 300, - 302, 304, 307, 309, 312, 314, 317, 318, 318, 319, - 320, 320, 321, 322, 324, 326, 329, 331, 333, 333, - 333, 335, 337, 339, 341, 342, 343, 345, 347, 350, - - 352, 354, 356, 358, 361, 363, 365, 368, 370, 373, - 373 + 0, 0, 0, 0, 51, 49, 48, 48, 41, 42, + 32, 33, 39, 37, 44, 38, 46, 40, 45, 45, + 34, 35, 36, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 49, 49, 46, 46, 30, 43, 31, + 49, 9, 9, 48, 46, 47, 46, 10, 45, 45, + 45, 46, 45, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 0, 29, 46, + 46, 0, 0, 0, 0, 45, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 0, 46, 46, 0, 0, 0, 0, 0, + + 0, 45, 46, 46, 46, 46, 46, 46, 46, 19, + 46, 46, 46, 46, 46, 46, 27, 46, 0, 46, + 46, 0, 0, 0, 0, 0, 0, 0, 0, 11, + 46, 13, 46, 16, 17, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 0, 0, 0, 0, 0, + 0, 0, 0, 46, 46, 18, 46, 46, 46, 46, + 46, 46, 46, 46, 20, 0, 2, 0, 0, 0, + 6, 0, 0, 46, 46, 46, 46, 23, 46, 25, + 46, 28, 15, 0, 4, 1, 0, 8, 5, 46, + 46, 46, 22, 46, 46, 0, 0, 12, 46, 46, + + 46, 46, 3, 7, 46, 46, 24, 46, 46, 46, + 46, 14, 46, 46, 21, 46, 26, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -415,10 +464,10 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[67] = +static yyconst flex_int32_t yy_meta[67] = { 0, 1, 2, 2, 1, 1, 1, 2, 2, 3, 1, - 1, 1, 3, 1, 3, 3, 3, 2, 2, 1, + 1, 3, 3, 1, 3, 3, 3, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 2, 3, 3, @@ -426,63 +475,65 @@ static yyconst int yy_meta[67] = 3, 3, 3, 2, 1, 2 } ; -static yyconst short int yy_base[215] = +static yyconst flex_int16_t yy_base[223] = { 0, - 0, 218, 0, 216, 219, 2141, 65, 67, 2141, 2141, - 2141, 2141, 0, 2141, 2141, 2141, 70, 208, 135, 62, - 2141, 2141, 2141, 0, 70, 127, 158, 171, 192, 211, - 260, 309, 215, 46, 0, 269, 273, 2141, 2141, 2141, - 42, 2141, 43, 70, 0, 0, 330, 0, 48, 322, - 333, 382, 385, 434, 437, 458, 471, 520, 507, 529, - 558, 564, 613, 609, 616, 647, 67, 2141, 666, 670, - 47, 160, 59, 158, 90, 703, 722, 725, 756, 760, - 789, 793, 822, 828, 851, 862, 873, 886, 907, 926, - 89, 945, 964, 65, 159, 158, 67, 157, 153, 985, - - 1004, 1008, 1039, 1042, 1073, 1076, 1107, 1111, 1130, 1161, - 1165, 1169, 1198, 1205, 1227, 155, 1234, 1256, 144, 143, - 139, 140, 137, 127, 112, 113, 1263, 1285, 1292, 1296, - 1325, 1329, 1336, 1365, 1386, 1389, 1420, 1441, 1444, 1465, - 1494, 106, 151, 83, 79, 77, 154, 61, 59, 1500, - 1503, 1534, 1553, 1556, 1587, 1590, 1609, 1640, 1644, 2141, - 58, 2141, 160, 162, 54, 2141, 169, 174, 1648, 1677, - 1698, 1701, 1722, 1735, 1757, 1766, 2141, 43, 2141, 2141, - 37, 2141, 2141, 1779, 1788, 1801, 1810, 1832, 177, 181, - 1839, 1861, 1868, 1892, 2141, 2141, 1901, 1905, 1936, 1945, - - 1958, 1980, 1989, 2002, 2011, 2024, 2047, 2055, 2068, 2141, - 2131, 76, 2134, 2137 + 0, 217, 0, 216, 216, 2250, 65, 67, 2250, 2250, + 2250, 2250, 0, 2250, 2250, 2250, 70, 206, 135, 62, + 2250, 2250, 2250, 0, 186, 70, 127, 146, 179, 210, + 259, 308, 246, 46, 0, 268, 297, 2250, 2250, 2250, + 25, 2250, 42, 70, 0, 0, 304, 0, 48, 224, + 337, 386, 389, 438, 441, 444, 493, 496, 545, 532, + 554, 583, 589, 638, 634, 641, 672, 73, 2250, 691, + 695, 38, 159, 47, 158, 69, 728, 747, 751, 780, + 784, 813, 819, 842, 848, 871, 877, 900, 908, 929, + 937, 958, 81, 966, 987, 52, 158, 155, 69, 154, + + 153, 995, 1018, 1031, 1039, 1070, 1062, 1091, 1120, 1127, + 1131, 1160, 1171, 1193, 1204, 1164, 1226, 1233, 151, 1237, + 1266, 142, 138, 134, 134, 132, 132, 124, 115, 1277, + 1288, 1301, 1322, 1341, 1345, 1374, 1380, 1409, 1430, 1433, + 1464, 1485, 1488, 1509, 1538, 114, 135, 110, 104, 81, + 145, 77, 75, 1545, 1549, 1578, 1582, 1589, 1611, 1633, + 1640, 1644, 1684, 1693, 2250, 68, 2250, 151, 154, 65, + 2250, 169, 171, 1697, 1728, 1737, 1750, 1772, 1781, 1794, + 1803, 1825, 2250, 57, 2250, 2250, 53, 2250, 2250, 1834, + 1847, 1838, 1869, 1878, 1900, 173, 181, 1907, 1929, 1936, + + 1960, 1967, 2250, 2250, 1989, 1996, 2000, 2040, 2051, 2029, + 2064, 2085, 2108, 2119, 2142, 2148, 2177, 2250, 2240, 89, + 2243, 2246 } ; -static yyconst short int yy_def[215] = +static yyconst flex_int16_t yy_def[223] = { 0, - 210, 1, 211, 211, 210, 210, 210, 210, 210, 210, - 210, 210, 212, 210, 210, 210, 213, 214, 213, 19, - 210, 210, 210, 212, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 210, 214, 19, 19, 210, 210, 210, - 210, 210, 210, 210, 212, 214, 19, 214, 19, 19, + 218, 1, 219, 219, 218, 218, 218, 218, 218, 218, + 218, 218, 220, 218, 218, 218, 221, 222, 221, 19, + 218, 218, 218, 220, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 218, 222, 19, 19, 218, 218, 218, + 218, 218, 218, 218, 220, 222, 19, 222, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 210, 210, 19, 19, - 210, 210, 210, 210, 52, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 218, 218, 19, + 19, 218, 218, 218, 218, 52, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 210, 19, 19, 210, 210, 210, 210, 210, 210, 19, + 19, 19, 218, 19, 19, 218, 218, 218, 218, 218, + 218, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 218, 19, + 19, 218, 218, 218, 218, 218, 218, 218, 218, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 210, 19, 19, 210, 210, - 210, 210, 210, 210, 210, 210, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 210, 210, 210, 210, 210, 210, 210, 210, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 19, 19, - 19, 19, 19, 19, 19, 19, 210, 210, 210, 210, - 210, 210, 210, 19, 19, 19, 19, 19, 210, 210, - 19, 19, 19, 19, 210, 210, 19, 19, 19, 19, - - 19, 19, 19, 19, 19, 19, 19, 19, 19, 0, - 210, 210, 210, 210 + 19, 19, 19, 19, 19, 218, 218, 218, 218, 218, + 218, 218, 218, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 218, 218, 218, 218, 218, 218, 218, 19, + 19, 19, 19, 19, 19, 218, 218, 19, 19, 19, + + 19, 19, 218, 218, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 0, 218, 218, + 218, 218 } ; -static yyconst short int yy_nxt[2208] = +static yyconst flex_int16_t yy_nxt[2317] = { 0, 6, 7, 8, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, @@ -491,245 +542,257 @@ static yyconst short int yy_nxt[2208] = 33, 17, 17, 17, 17, 34, 35, 6, 17, 17, 17, 17, 17, 17, 17, 36, 17, 17, 37, 17, 17, 17, 17, 38, 39, 40, 44, 44, 44, 44, - 46, 44, 44, 46, 46, 46, 50, 50, 45, 46, - 46, 46, 67, 46, 47, 47, 47, 67, 67, 46, - 47, 190, 53, 68, 53, 71, 73, 189, 72, 74, - - 47, 54, 47, 91, 47, 94, 95, 181, 91, 91, - 47, 178, 47, 168, 68, 167, 46, 97, 98, 53, - 100, 119, 100, 123, 47, 116, 120, 47, 124, 165, - 116, 116, 47, 164, 46, 46, 68, 163, 46, 46, - 46, 47, 47, 47, 46, 46, 46, 100, 46, 49, - 49, 50, 162, 162, 46, 166, 166, 47, 161, 47, - 55, 179, 179, 180, 180, 51, 149, 51, 148, 56, - 182, 182, 47, 47, 47, 183, 183, 52, 195, 195, - 147, 46, 196, 196, 47, 47, 47, 47, 47, 47, - 47, 146, 51, 145, 57, 144, 143, 52, 142, 46, - - 47, 47, 68, 47, 58, 126, 47, 47, 47, 125, - 122, 121, 99, 47, 96, 47, 48, 59, 210, 43, - 47, 41, 47, 210, 47, 47, 47, 47, 47, 47, - 47, 47, 210, 47, 47, 210, 210, 210, 210, 210, - 66, 47, 210, 47, 210, 47, 210, 47, 210, 47, - 60, 210, 210, 47, 47, 210, 210, 47, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 47, 210, - 210, 210, 47, 47, 47, 47, 47, 47, 210, 210, - 210, 61, 210, 47, 47, 47, 210, 47, 47, 47, - 47, 210, 47, 210, 210, 210, 62, 210, 210, 47, - - 210, 47, 47, 47, 210, 47, 210, 210, 210, 210, - 210, 47, 210, 210, 210, 47, 210, 47, 210, 210, - 210, 210, 47, 47, 47, 47, 47, 69, 210, 210, - 47, 47, 210, 70, 63, 47, 50, 50, 64, 47, - 210, 47, 210, 65, 47, 47, 47, 47, 47, 47, - 210, 47, 53, 210, 53, 210, 210, 210, 210, 210, - 47, 210, 47, 47, 47, 47, 47, 210, 210, 210, - 210, 47, 47, 210, 210, 47, 210, 210, 210, 53, - 210, 210, 210, 210, 47, 210, 210, 47, 210, 210, - 47, 210, 47, 210, 210, 47, 75, 75, 75, 47, - - 47, 47, 210, 75, 75, 75, 75, 75, 75, 210, - 210, 210, 47, 210, 47, 47, 210, 47, 210, 210, - 210, 210, 210, 210, 47, 210, 210, 47, 210, 210, - 210, 75, 75, 75, 75, 75, 75, 210, 210, 47, - 210, 210, 47, 210, 47, 210, 210, 47, 47, 47, - 47, 47, 47, 47, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 76, 47, 210, 47, 47, 210, 47, - 210, 210, 47, 47, 47, 77, 47, 210, 210, 47, - 210, 78, 210, 210, 210, 47, 47, 47, 47, 210, - 47, 47, 210, 210, 47, 210, 47, 210, 210, 47, - - 47, 47, 210, 47, 210, 79, 210, 210, 210, 210, - 210, 210, 210, 47, 210, 47, 210, 210, 210, 210, - 47, 47, 47, 47, 210, 210, 210, 210, 47, 210, - 210, 210, 82, 47, 47, 47, 47, 47, 210, 47, - 210, 210, 210, 47, 47, 47, 210, 210, 210, 47, - 47, 210, 47, 210, 210, 80, 210, 210, 81, 47, - 210, 47, 47, 210, 47, 210, 210, 83, 210, 47, - 210, 47, 47, 47, 47, 210, 210, 47, 47, 47, - 47, 210, 47, 210, 210, 84, 47, 210, 47, 210, - 47, 47, 210, 210, 47, 210, 47, 210, 85, 210, - - 47, 210, 210, 210, 210, 210, 47, 210, 210, 210, - 210, 210, 210, 210, 210, 47, 210, 210, 210, 210, - 47, 47, 210, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 210, 86, 210, 210, 210, 210, 47, - 87, 47, 210, 47, 210, 47, 47, 210, 47, 210, - 210, 47, 89, 88, 210, 47, 210, 210, 47, 210, - 210, 47, 47, 47, 210, 210, 47, 210, 210, 210, - 47, 47, 210, 47, 210, 47, 210, 47, 47, 47, - 47, 47, 47, 90, 47, 47, 47, 210, 210, 47, - 210, 210, 210, 210, 210, 210, 47, 210, 47, 210, - - 47, 210, 47, 210, 47, 210, 210, 210, 47, 47, - 210, 210, 47, 210, 210, 210, 210, 47, 47, 47, - 210, 93, 210, 47, 210, 210, 92, 47, 47, 210, - 101, 210, 47, 47, 210, 47, 47, 47, 47, 47, - 47, 47, 210, 210, 210, 47, 210, 210, 210, 210, - 210, 210, 47, 210, 47, 47, 103, 47, 102, 210, - 47, 210, 210, 210, 47, 47, 210, 47, 210, 210, - 47, 47, 47, 210, 47, 47, 47, 210, 210, 47, - 210, 210, 47, 210, 47, 210, 47, 47, 47, 210, - 47, 210, 47, 210, 210, 104, 210, 210, 47, 105, - - 210, 210, 47, 47, 47, 47, 210, 47, 47, 47, - 210, 210, 210, 47, 106, 210, 210, 47, 47, 47, - 210, 47, 47, 47, 210, 47, 210, 210, 107, 210, - 210, 47, 210, 210, 210, 47, 47, 47, 47, 210, - 210, 210, 47, 47, 47, 210, 47, 210, 210, 210, - 47, 47, 47, 109, 47, 47, 210, 108, 47, 210, - 47, 210, 210, 210, 47, 47, 47, 47, 210, 210, - 47, 210, 210, 210, 210, 210, 47, 47, 47, 47, - 210, 47, 210, 47, 47, 47, 210, 47, 47, 47, - 47, 110, 47, 47, 47, 210, 210, 210, 111, 210, - - 47, 47, 47, 47, 47, 112, 210, 210, 47, 210, - 210, 113, 210, 47, 210, 47, 47, 210, 47, 47, - 210, 47, 47, 47, 47, 210, 210, 210, 47, 210, - 47, 210, 210, 210, 210, 47, 210, 47, 210, 47, - 47, 47, 47, 47, 210, 114, 210, 210, 47, 47, - 210, 210, 210, 210, 210, 210, 47, 210, 47, 47, - 47, 47, 210, 115, 47, 210, 210, 210, 47, 47, - 210, 210, 210, 210, 210, 47, 210, 47, 47, 47, - 47, 210, 210, 47, 210, 210, 210, 47, 47, 210, - 210, 210, 210, 210, 47, 117, 47, 210, 210, 47, - - 47, 47, 47, 210, 210, 210, 47, 47, 210, 210, - 210, 210, 210, 118, 210, 47, 210, 47, 47, 47, - 47, 47, 47, 47, 47, 210, 47, 47, 210, 210, - 210, 210, 210, 210, 47, 210, 47, 127, 47, 210, - 47, 210, 47, 210, 210, 210, 47, 47, 210, 210, - 47, 128, 210, 47, 47, 47, 47, 47, 47, 210, - 210, 47, 210, 210, 210, 47, 47, 210, 210, 47, - 47, 47, 47, 210, 47, 210, 210, 130, 129, 210, - 210, 47, 210, 210, 47, 210, 210, 47, 47, 47, - 47, 47, 47, 210, 210, 210, 47, 210, 210, 47, - - 210, 47, 210, 47, 47, 47, 47, 210, 47, 210, - 210, 131, 132, 210, 210, 47, 210, 210, 47, 210, - 210, 47, 47, 47, 210, 47, 47, 47, 210, 210, - 47, 210, 210, 47, 210, 47, 210, 47, 47, 47, - 210, 47, 210, 47, 47, 47, 47, 210, 210, 47, - 133, 210, 210, 47, 210, 210, 210, 210, 210, 210, - 47, 210, 47, 210, 47, 210, 210, 134, 47, 47, - 210, 210, 47, 47, 210, 47, 47, 47, 210, 47, - 47, 47, 210, 47, 47, 47, 210, 47, 136, 210, - 135, 47, 47, 47, 137, 47, 210, 47, 210, 47, - - 210, 47, 210, 47, 210, 210, 210, 47, 210, 210, - 210, 47, 47, 47, 47, 210, 210, 210, 47, 47, - 47, 47, 47, 47, 210, 210, 47, 47, 47, 210, - 47, 47, 138, 210, 210, 47, 210, 47, 210, 210, - 47, 47, 47, 47, 210, 210, 210, 47, 47, 47, - 47, 210, 210, 210, 210, 47, 139, 47, 210, 47, - 47, 210, 47, 210, 47, 210, 47, 47, 210, 47, - 47, 47, 47, 210, 210, 210, 47, 47, 47, 47, - 210, 210, 210, 140, 47, 210, 47, 210, 47, 47, - 210, 47, 210, 47, 210, 47, 47, 210, 47, 47, - - 47, 47, 210, 210, 210, 47, 47, 47, 47, 210, - 47, 47, 47, 47, 141, 47, 150, 47, 47, 210, - 47, 210, 47, 210, 47, 47, 47, 47, 47, 210, - 210, 210, 210, 210, 47, 210, 210, 210, 47, 47, - 47, 47, 47, 47, 47, 47, 210, 47, 210, 47, - 47, 47, 47, 47, 47, 47, 210, 47, 47, 47, - 210, 47, 210, 210, 151, 210, 47, 47, 47, 210, - 210, 47, 210, 210, 152, 210, 210, 210, 47, 47, - 47, 47, 47, 210, 210, 210, 47, 47, 210, 210, - 210, 47, 210, 47, 153, 47, 210, 47, 47, 210, - - 47, 47, 47, 47, 47, 47, 210, 47, 210, 210, - 154, 210, 210, 210, 210, 210, 47, 155, 47, 47, - 210, 47, 47, 210, 210, 210, 210, 47, 47, 210, - 210, 47, 210, 210, 47, 47, 47, 210, 210, 210, - 210, 210, 210, 47, 210, 210, 47, 210, 47, 210, - 47, 47, 47, 156, 210, 47, 47, 47, 47, 47, - 47, 210, 47, 210, 210, 210, 210, 157, 210, 210, - 210, 47, 210, 47, 47, 210, 47, 47, 158, 47, - 47, 47, 47, 47, 210, 210, 47, 210, 210, 210, - 210, 210, 210, 210, 210, 47, 210, 47, 47, 210, - - 210, 47, 210, 47, 210, 210, 47, 47, 47, 47, - 47, 160, 210, 210, 47, 47, 47, 47, 47, 47, - 210, 210, 47, 159, 47, 169, 47, 47, 210, 210, - 47, 210, 47, 47, 210, 47, 47, 210, 210, 210, - 210, 210, 47, 210, 210, 47, 210, 210, 47, 47, - 47, 47, 210, 210, 210, 210, 47, 47, 210, 210, - 47, 210, 47, 210, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 210, 210, 210, 47, 210, 210, 210, - 210, 172, 170, 47, 210, 47, 47, 210, 47, 210, - 210, 47, 210, 210, 210, 47, 47, 171, 47, 210, - - 210, 47, 47, 47, 47, 47, 47, 210, 210, 210, - 47, 210, 210, 47, 210, 47, 210, 47, 47, 47, - 47, 210, 47, 47, 47, 47, 210, 210, 174, 47, - 210, 210, 47, 210, 210, 173, 210, 210, 210, 47, - 210, 47, 210, 210, 47, 210, 210, 47, 210, 47, - 210, 47, 47, 210, 47, 47, 47, 175, 47, 47, - 47, 177, 47, 47, 47, 210, 47, 210, 210, 210, - 47, 47, 47, 176, 47, 210, 47, 210, 47, 210, - 47, 210, 47, 210, 210, 210, 47, 210, 210, 210, - 47, 47, 47, 47, 210, 210, 184, 47, 210, 210, - - 210, 47, 47, 185, 210, 47, 47, 47, 210, 47, - 47, 210, 47, 47, 47, 47, 47, 47, 210, 47, - 210, 210, 210, 186, 210, 210, 210, 210, 47, 210, - 47, 47, 210, 47, 47, 210, 47, 47, 47, 47, - 47, 210, 210, 47, 210, 210, 187, 210, 210, 47, - 47, 47, 47, 210, 47, 47, 210, 210, 47, 210, - 47, 210, 210, 47, 47, 47, 210, 47, 210, 210, - 210, 47, 47, 47, 210, 210, 210, 47, 210, 47, - 47, 47, 47, 210, 47, 188, 210, 47, 210, 47, - 210, 210, 47, 47, 47, 47, 47, 47, 47, 47, - - 210, 210, 47, 47, 47, 191, 210, 210, 47, 47, - 210, 47, 210, 210, 47, 47, 47, 47, 47, 47, - 47, 47, 192, 47, 47, 47, 47, 210, 47, 210, - 47, 47, 210, 47, 210, 210, 47, 210, 210, 193, - 47, 47, 47, 47, 210, 47, 47, 47, 47, 210, - 47, 210, 47, 47, 47, 47, 210, 194, 47, 210, - 210, 210, 47, 47, 47, 210, 210, 47, 197, 47, - 210, 47, 47, 210, 47, 47, 47, 47, 210, 210, - 210, 47, 47, 47, 47, 210, 210, 210, 210, 47, - 210, 47, 210, 47, 47, 210, 47, 198, 47, 210, - - 47, 47, 210, 47, 199, 210, 47, 47, 47, 210, - 47, 210, 210, 200, 210, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 210, 210, 210, 210, - 47, 47, 201, 47, 47, 47, 210, 202, 210, 210, - 210, 210, 210, 47, 210, 210, 210, 47, 210, 47, - 47, 47, 47, 210, 47, 210, 210, 210, 47, 47, - 47, 47, 47, 47, 210, 210, 47, 47, 47, 203, - 210, 210, 47, 47, 47, 47, 210, 47, 47, 210, - 210, 210, 210, 204, 210, 210, 210, 47, 47, 210, - 47, 210, 210, 47, 47, 47, 47, 210, 47, 210, - - 47, 205, 47, 47, 47, 47, 210, 47, 210, 210, - 47, 210, 47, 210, 206, 47, 47, 47, 47, 47, - 47, 47, 47, 210, 210, 47, 47, 47, 210, 210, - 210, 47, 47, 210, 47, 210, 210, 47, 47, 47, - 47, 47, 47, 47, 47, 210, 47, 210, 210, 207, - 210, 47, 210, 47, 47, 210, 47, 210, 210, 47, - 208, 47, 47, 47, 47, 210, 47, 210, 47, 47, - 47, 47, 210, 47, 210, 210, 210, 47, 210, 47, - 210, 47, 47, 47, 47, 47, 47, 47, 210, 47, - 210, 210, 209, 210, 210, 210, 210, 47, 47, 210, - - 47, 210, 210, 210, 47, 210, 210, 210, 210, 47, - 47, 210, 47, 210, 210, 210, 210, 47, 210, 210, - 210, 210, 210, 210, 210, 47, 210, 210, 210, 210, - 47, 42, 42, 42, 47, 210, 47, 46, 210, 46, - 5, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - - 210, 210, 210, 210, 210, 210, 210 + 46, 44, 44, 46, 46, 46, 50, 50, 72, 46, + 46, 73, 68, 46, 47, 47, 47, 68, 68, 46, + 47, 45, 53, 69, 53, 74, 96, 97, 75, 102, + + 47, 102, 47, 56, 47, 99, 100, 197, 122, 93, + 47, 196, 57, 123, 93, 93, 46, 119, 187, 53, + 69, 184, 119, 119, 47, 126, 102, 47, 69, 173, + 127, 172, 47, 170, 46, 46, 167, 167, 46, 46, + 46, 47, 47, 47, 46, 46, 171, 171, 46, 49, + 49, 50, 185, 185, 46, 186, 186, 47, 169, 47, + 47, 47, 47, 58, 168, 51, 166, 51, 153, 47, + 188, 188, 189, 189, 203, 203, 47, 52, 47, 59, + 152, 46, 204, 204, 47, 151, 150, 149, 47, 47, + 148, 147, 51, 47, 47, 47, 146, 52, 69, 46, + + 47, 47, 47, 47, 60, 129, 128, 125, 47, 47, + 124, 47, 101, 98, 48, 218, 47, 54, 47, 43, + 41, 47, 218, 55, 47, 47, 47, 218, 47, 218, + 218, 218, 218, 218, 218, 218, 47, 218, 50, 50, + 47, 47, 47, 47, 218, 218, 218, 218, 47, 61, + 218, 218, 47, 218, 53, 218, 53, 218, 218, 218, + 47, 47, 47, 218, 218, 218, 47, 47, 218, 218, + 218, 67, 47, 47, 47, 47, 47, 218, 47, 218, + 62, 53, 47, 47, 47, 218, 47, 218, 47, 47, + 218, 47, 218, 218, 218, 63, 218, 218, 47, 218, + + 47, 47, 218, 47, 218, 218, 218, 218, 47, 218, + 47, 47, 47, 47, 218, 218, 47, 218, 47, 47, + 47, 47, 47, 47, 47, 47, 70, 47, 218, 47, + 47, 218, 218, 64, 47, 218, 47, 65, 47, 47, + 47, 218, 66, 218, 218, 218, 47, 218, 218, 218, + 47, 47, 47, 47, 47, 218, 218, 71, 218, 47, + 218, 47, 218, 218, 218, 47, 47, 47, 218, 47, + 47, 218, 218, 218, 218, 218, 218, 218, 218, 47, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 47, 218, 218, 218, 218, 47, + + 76, 76, 76, 47, 47, 47, 218, 76, 76, 76, + 76, 76, 76, 218, 218, 218, 47, 218, 47, 47, + 218, 47, 218, 218, 218, 218, 218, 218, 47, 218, + 218, 47, 218, 218, 218, 76, 76, 76, 76, 76, + 76, 218, 218, 47, 218, 218, 47, 218, 47, 218, + 218, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 218, 218, 218, 218, 218, 218, 77, 47, 218, + 47, 47, 218, 47, 47, 218, 47, 218, 218, 218, + 47, 218, 79, 47, 218, 218, 47, 218, 218, 78, + 218, 218, 218, 218, 218, 47, 218, 218, 47, 218, + + 47, 47, 218, 47, 218, 218, 47, 47, 47, 47, + 47, 47, 47, 218, 218, 218, 80, 218, 218, 218, + 218, 218, 218, 47, 218, 47, 47, 218, 47, 218, + 81, 218, 218, 218, 218, 47, 218, 218, 47, 218, + 218, 218, 218, 218, 218, 218, 47, 47, 47, 218, + 47, 218, 218, 47, 218, 47, 218, 84, 47, 47, + 47, 47, 47, 218, 47, 218, 218, 218, 47, 47, + 47, 218, 218, 218, 47, 47, 218, 47, 218, 218, + 82, 218, 218, 83, 47, 218, 47, 47, 218, 47, + 218, 218, 85, 218, 47, 218, 47, 47, 47, 47, + + 218, 218, 47, 47, 47, 47, 218, 47, 218, 218, + 86, 47, 218, 47, 218, 47, 47, 218, 218, 47, + 218, 47, 218, 87, 218, 47, 218, 218, 218, 218, + 218, 47, 218, 218, 218, 218, 218, 218, 218, 218, + 47, 218, 218, 218, 218, 47, 47, 218, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 218, 88, + 218, 218, 218, 218, 47, 89, 47, 218, 47, 218, + 47, 47, 218, 47, 218, 218, 47, 91, 90, 218, + 47, 218, 218, 47, 218, 218, 47, 47, 47, 218, + 218, 47, 218, 218, 218, 47, 47, 218, 47, 218, + + 47, 218, 47, 47, 47, 47, 47, 47, 92, 47, + 47, 47, 218, 218, 47, 218, 218, 218, 218, 218, + 218, 47, 218, 47, 218, 47, 218, 47, 218, 47, + 218, 218, 218, 47, 47, 218, 218, 47, 218, 218, + 218, 218, 47, 47, 47, 218, 95, 218, 47, 218, + 218, 94, 47, 47, 218, 103, 218, 47, 47, 218, + 47, 47, 47, 47, 218, 47, 47, 47, 218, 218, + 47, 218, 218, 218, 218, 218, 218, 47, 218, 47, + 104, 47, 218, 47, 218, 47, 218, 105, 218, 47, + 47, 218, 218, 47, 47, 47, 47, 218, 47, 47, + + 47, 218, 218, 218, 47, 218, 218, 218, 47, 47, + 47, 106, 47, 47, 47, 218, 47, 218, 218, 218, + 218, 218, 47, 107, 218, 218, 47, 47, 47, 47, + 218, 218, 218, 47, 47, 47, 218, 47, 218, 218, + 218, 47, 47, 47, 109, 47, 47, 218, 218, 47, + 218, 47, 108, 218, 218, 47, 47, 47, 47, 218, + 218, 47, 47, 47, 47, 218, 218, 218, 218, 218, + 47, 218, 47, 218, 47, 47, 47, 110, 47, 218, + 47, 47, 218, 111, 47, 47, 47, 47, 218, 218, + 47, 47, 47, 47, 218, 218, 112, 218, 218, 47, + + 218, 47, 218, 47, 47, 47, 218, 47, 218, 47, + 47, 218, 218, 47, 47, 47, 47, 113, 218, 47, + 218, 218, 47, 47, 47, 218, 218, 218, 47, 218, + 47, 218, 47, 47, 47, 218, 114, 218, 47, 47, + 115, 218, 47, 47, 47, 47, 218, 218, 218, 218, + 47, 47, 47, 47, 116, 218, 218, 47, 218, 47, + 218, 47, 47, 218, 218, 47, 218, 47, 218, 47, + 47, 47, 47, 47, 47, 117, 218, 218, 218, 47, + 47, 47, 47, 218, 218, 218, 47, 218, 47, 218, + 47, 47, 218, 218, 47, 118, 47, 218, 47, 47, + + 47, 47, 47, 47, 218, 218, 218, 218, 47, 47, + 47, 47, 218, 218, 218, 47, 120, 47, 218, 47, + 47, 218, 218, 47, 218, 47, 218, 47, 47, 47, + 218, 218, 47, 47, 47, 218, 121, 47, 218, 218, + 218, 218, 218, 218, 47, 47, 47, 47, 47, 47, + 47, 130, 47, 47, 47, 47, 131, 47, 218, 218, + 47, 47, 218, 47, 218, 218, 218, 218, 218, 47, + 218, 47, 218, 47, 218, 47, 47, 47, 47, 218, + 47, 47, 132, 218, 47, 47, 47, 218, 47, 218, + 218, 218, 47, 47, 47, 218, 47, 134, 218, 218, + + 47, 47, 47, 218, 47, 47, 47, 47, 218, 133, + 218, 218, 47, 218, 218, 218, 218, 218, 218, 47, + 218, 47, 218, 47, 47, 218, 218, 47, 218, 135, + 218, 218, 47, 47, 47, 47, 47, 218, 218, 218, + 218, 47, 47, 47, 218, 47, 47, 47, 47, 218, + 47, 218, 47, 47, 218, 218, 136, 47, 218, 47, + 218, 47, 47, 47, 218, 218, 218, 218, 218, 47, + 137, 218, 218, 47, 47, 47, 47, 47, 47, 47, + 47, 218, 47, 218, 47, 47, 47, 47, 47, 47, + 47, 218, 47, 47, 47, 218, 47, 138, 142, 218, + + 139, 47, 47, 47, 218, 218, 47, 47, 47, 47, + 218, 218, 218, 47, 218, 218, 140, 47, 47, 47, + 47, 47, 47, 47, 218, 47, 47, 218, 47, 141, + 218, 218, 218, 47, 47, 47, 47, 218, 218, 218, + 47, 47, 47, 218, 218, 218, 47, 47, 47, 47, + 47, 47, 47, 47, 218, 47, 47, 218, 47, 218, + 218, 47, 143, 47, 218, 47, 47, 47, 47, 47, + 218, 218, 218, 218, 218, 47, 218, 218, 218, 47, + 47, 47, 47, 47, 218, 218, 144, 218, 47, 218, + 47, 47, 47, 47, 47, 47, 47, 218, 47, 47, + + 218, 218, 47, 47, 47, 218, 218, 47, 47, 47, + 218, 218, 218, 154, 218, 47, 47, 47, 47, 47, + 47, 218, 218, 47, 145, 218, 218, 218, 47, 218, + 47, 47, 218, 47, 47, 218, 47, 47, 47, 47, + 218, 218, 218, 47, 218, 47, 155, 218, 218, 218, + 47, 218, 47, 218, 47, 47, 47, 47, 47, 47, + 47, 47, 218, 47, 47, 218, 218, 218, 218, 218, + 218, 47, 218, 47, 218, 47, 218, 47, 218, 47, + 218, 218, 218, 47, 47, 218, 218, 47, 47, 47, + 47, 218, 218, 218, 47, 47, 47, 218, 47, 218, + + 218, 218, 47, 47, 47, 218, 47, 47, 218, 156, + 47, 218, 47, 218, 218, 218, 47, 218, 157, 218, + 218, 218, 47, 47, 47, 47, 218, 218, 218, 218, + 218, 47, 218, 218, 218, 218, 47, 47, 158, 47, + 218, 47, 47, 218, 47, 47, 47, 47, 47, 47, + 218, 47, 218, 218, 159, 218, 218, 218, 218, 218, + 47, 160, 47, 47, 218, 47, 47, 218, 218, 218, + 218, 47, 47, 218, 218, 47, 218, 218, 47, 47, + 47, 218, 218, 218, 218, 218, 218, 47, 218, 218, + 47, 218, 47, 218, 47, 47, 47, 161, 218, 47, + + 47, 47, 47, 47, 47, 218, 47, 218, 218, 218, + 218, 162, 218, 218, 218, 47, 218, 47, 47, 218, + 47, 47, 163, 47, 47, 47, 47, 47, 218, 218, + 47, 218, 218, 218, 218, 218, 218, 218, 218, 47, + 218, 47, 47, 218, 218, 47, 218, 47, 218, 218, + 47, 47, 47, 47, 47, 165, 218, 218, 218, 47, + 47, 47, 218, 47, 47, 47, 47, 164, 47, 174, + 47, 47, 218, 218, 175, 47, 218, 47, 218, 47, + 47, 47, 218, 218, 218, 218, 218, 47, 218, 218, + 218, 47, 47, 47, 47, 47, 47, 47, 47, 218, + + 47, 218, 47, 47, 47, 47, 47, 47, 47, 218, + 47, 47, 47, 218, 47, 218, 218, 218, 218, 47, + 47, 47, 218, 218, 47, 47, 47, 47, 218, 218, + 176, 47, 218, 177, 218, 47, 178, 218, 218, 47, + 47, 47, 218, 47, 47, 218, 47, 47, 47, 47, + 218, 47, 218, 47, 47, 47, 47, 218, 47, 47, + 47, 218, 218, 47, 218, 47, 218, 218, 47, 218, + 47, 218, 47, 47, 47, 47, 47, 218, 180, 218, + 218, 179, 47, 218, 218, 218, 47, 218, 218, 218, + 47, 218, 181, 218, 218, 47, 218, 47, 47, 47, + + 47, 47, 47, 218, 218, 218, 47, 47, 47, 47, + 183, 47, 47, 47, 47, 218, 47, 182, 218, 218, + 218, 218, 190, 47, 218, 47, 47, 47, 218, 47, + 218, 218, 218, 218, 218, 47, 218, 218, 218, 47, + 218, 47, 47, 47, 47, 218, 47, 218, 218, 218, + 47, 47, 47, 47, 47, 47, 218, 218, 47, 47, + 47, 218, 218, 192, 47, 47, 47, 47, 218, 47, + 47, 218, 218, 218, 218, 193, 191, 218, 218, 47, + 47, 218, 47, 218, 218, 47, 47, 47, 47, 218, + 47, 218, 47, 218, 47, 47, 47, 47, 218, 47, + + 218, 218, 47, 218, 47, 194, 218, 47, 47, 47, + 47, 47, 47, 47, 47, 218, 218, 47, 47, 47, + 218, 218, 218, 47, 47, 218, 47, 218, 218, 47, + 218, 195, 218, 47, 47, 47, 47, 218, 47, 47, + 47, 47, 218, 47, 218, 47, 218, 218, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 198, 218, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 218, + 47, 218, 200, 199, 218, 218, 47, 47, 218, 47, + 47, 218, 47, 47, 47, 47, 218, 47, 218, 47, + 218, 47, 47, 47, 47, 47, 47, 218, 218, 47, + + 47, 47, 218, 218, 47, 218, 218, 201, 47, 47, + 47, 47, 218, 218, 47, 47, 47, 218, 218, 218, + 47, 47, 47, 47, 218, 202, 47, 218, 218, 218, + 47, 47, 47, 218, 218, 47, 218, 47, 218, 47, + 47, 218, 47, 47, 47, 47, 218, 218, 218, 47, + 47, 47, 47, 218, 218, 218, 218, 47, 205, 47, + 218, 47, 47, 218, 47, 218, 47, 218, 47, 47, + 218, 47, 206, 218, 47, 47, 47, 218, 47, 218, + 218, 47, 47, 47, 218, 218, 47, 218, 208, 218, + 47, 47, 47, 47, 218, 218, 207, 47, 47, 47, + + 218, 218, 47, 47, 47, 47, 218, 218, 218, 47, + 47, 47, 47, 218, 47, 47, 47, 47, 218, 47, + 209, 47, 47, 218, 47, 218, 47, 218, 210, 47, + 47, 47, 47, 218, 218, 218, 218, 218, 47, 218, + 218, 218, 47, 47, 47, 47, 47, 218, 218, 218, + 213, 47, 218, 47, 47, 47, 47, 47, 47, 47, + 218, 47, 47, 218, 211, 47, 47, 47, 218, 218, + 47, 47, 47, 218, 218, 218, 212, 218, 47, 47, + 47, 47, 47, 47, 218, 218, 47, 218, 218, 214, + 218, 47, 218, 47, 47, 218, 47, 47, 218, 47, + + 47, 47, 47, 218, 218, 218, 47, 218, 47, 218, + 218, 218, 218, 47, 218, 47, 218, 47, 218, 218, + 218, 47, 47, 47, 47, 218, 47, 47, 218, 218, + 218, 218, 218, 47, 47, 47, 218, 218, 47, 218, + 47, 218, 47, 218, 218, 218, 215, 47, 218, 47, + 47, 47, 218, 218, 218, 216, 47, 47, 47, 218, + 218, 47, 47, 47, 47, 47, 218, 218, 218, 218, + 47, 218, 47, 218, 47, 218, 47, 218, 47, 218, + 47, 47, 218, 218, 47, 217, 218, 218, 218, 218, + 47, 47, 47, 47, 218, 218, 218, 218, 218, 47, + + 218, 218, 218, 218, 47, 47, 218, 47, 218, 47, + 47, 218, 218, 218, 218, 218, 218, 218, 218, 47, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 47, 218, 218, 218, 218, 47, + 42, 42, 42, 47, 218, 47, 46, 218, 46, 5, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218 } ; -static yyconst short int yy_chk[2208] = +static yyconst flex_int16_t yy_chk[2317] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -738,273 +801,303 @@ static yyconst short int yy_chk[2208] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 7, 8, 8, - 17, 44, 44, 17, 17, 17, 20, 20, 212, 17, - 17, 17, 34, 17, 25, 25, 25, 34, 34, 17, - 49, 181, 20, 34, 20, 41, 43, 178, 41, 43, - - 25, 25, 25, 67, 20, 71, 71, 165, 67, 67, - 49, 161, 25, 149, 67, 148, 17, 73, 73, 20, - 75, 94, 75, 97, 20, 91, 94, 25, 97, 146, - 91, 91, 25, 145, 17, 19, 91, 144, 19, 19, - 19, 26, 26, 26, 19, 19, 19, 75, 19, 19, - 19, 19, 143, 143, 19, 147, 147, 26, 142, 26, - 26, 163, 163, 164, 164, 19, 126, 19, 125, 26, - 167, 167, 27, 27, 27, 168, 168, 19, 189, 189, - 124, 19, 190, 190, 26, 28, 28, 28, 27, 26, - 27, 123, 19, 122, 27, 121, 120, 19, 119, 19, - - 27, 28, 116, 28, 28, 99, 29, 29, 29, 98, - 96, 95, 74, 28, 72, 27, 18, 29, 5, 4, - 27, 2, 29, 0, 29, 30, 30, 30, 28, 33, - 33, 33, 0, 28, 29, 0, 0, 0, 0, 0, - 33, 30, 0, 30, 0, 33, 0, 33, 0, 29, - 30, 0, 0, 30, 29, 0, 0, 33, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, - 0, 0, 33, 30, 31, 31, 31, 33, 0, 0, - 0, 31, 0, 36, 36, 36, 0, 37, 37, 37, - 31, 0, 31, 0, 0, 0, 31, 0, 0, 36, - - 0, 36, 31, 37, 0, 37, 0, 0, 0, 0, - 0, 36, 0, 0, 0, 37, 0, 31, 0, 0, - 0, 0, 31, 32, 32, 32, 36, 36, 0, 0, - 37, 36, 0, 37, 32, 37, 50, 50, 32, 32, - 0, 32, 0, 32, 47, 47, 47, 51, 51, 51, - 0, 32, 50, 0, 50, 0, 0, 0, 0, 0, - 47, 0, 47, 51, 50, 51, 32, 0, 0, 0, - 0, 32, 47, 0, 0, 51, 0, 0, 0, 50, - 0, 0, 0, 0, 50, 0, 0, 47, 0, 0, - 51, 0, 47, 0, 0, 51, 52, 52, 52, 53, - - 53, 53, 0, 52, 52, 52, 52, 52, 52, 0, - 0, 0, 52, 0, 52, 53, 0, 53, 0, 0, - 0, 0, 0, 0, 52, 0, 0, 53, 0, 0, - 0, 52, 52, 52, 52, 52, 52, 0, 0, 52, - 0, 0, 53, 0, 52, 0, 0, 53, 54, 54, - 54, 55, 55, 55, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 54, 54, 0, 54, 55, 0, 55, - 0, 0, 56, 56, 56, 55, 54, 0, 0, 55, - 0, 56, 0, 0, 0, 57, 57, 57, 56, 0, - 56, 54, 0, 0, 55, 0, 54, 0, 0, 55, - - 56, 57, 0, 57, 0, 57, 0, 0, 0, 0, - 0, 0, 0, 57, 0, 56, 0, 0, 0, 0, - 56, 59, 59, 59, 0, 0, 0, 0, 57, 0, - 0, 0, 59, 57, 58, 58, 58, 59, 0, 59, - 0, 0, 0, 60, 60, 60, 0, 0, 0, 59, - 58, 0, 58, 0, 0, 58, 0, 0, 58, 60, - 0, 60, 58, 0, 59, 0, 0, 60, 0, 59, - 0, 60, 61, 61, 61, 0, 0, 58, 62, 62, - 62, 0, 58, 0, 0, 61, 60, 0, 61, 0, - 61, 60, 0, 0, 62, 0, 62, 0, 62, 0, - - 61, 0, 0, 0, 0, 0, 62, 0, 0, 0, - 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, - 61, 62, 0, 64, 64, 64, 62, 63, 63, 63, - 65, 65, 65, 0, 63, 0, 0, 0, 0, 64, - 63, 64, 0, 63, 0, 63, 65, 0, 65, 0, - 0, 64, 65, 64, 0, 63, 0, 0, 65, 0, - 0, 66, 66, 66, 0, 0, 64, 0, 0, 0, - 63, 64, 0, 65, 0, 63, 0, 66, 65, 66, - 69, 69, 69, 66, 70, 70, 70, 0, 0, 66, - 0, 0, 0, 0, 0, 0, 69, 0, 69, 0, - - 70, 0, 70, 0, 66, 0, 0, 0, 69, 66, - 0, 0, 70, 0, 0, 0, 0, 76, 76, 76, - 0, 70, 0, 69, 0, 0, 69, 70, 69, 0, - 76, 0, 70, 76, 0, 76, 77, 77, 77, 78, - 78, 78, 0, 0, 0, 76, 0, 0, 0, 0, - 0, 0, 77, 0, 77, 78, 78, 78, 77, 0, - 76, 0, 0, 0, 77, 76, 0, 78, 0, 0, - 79, 79, 79, 0, 80, 80, 80, 0, 0, 77, - 0, 0, 78, 0, 77, 0, 79, 78, 79, 0, - 80, 0, 80, 0, 0, 79, 0, 0, 79, 80, - - 0, 0, 80, 81, 81, 81, 0, 82, 82, 82, - 0, 0, 0, 79, 81, 0, 0, 80, 79, 81, - 0, 81, 80, 82, 0, 82, 0, 0, 82, 0, - 0, 81, 0, 0, 0, 82, 83, 83, 83, 0, - 0, 0, 84, 84, 84, 0, 81, 0, 0, 0, - 82, 81, 83, 84, 83, 82, 0, 83, 84, 0, - 84, 0, 0, 0, 83, 85, 85, 85, 0, 0, - 84, 0, 0, 0, 0, 0, 86, 86, 86, 83, - 0, 85, 0, 85, 83, 84, 0, 87, 87, 87, - 84, 85, 86, 85, 86, 0, 0, 0, 86, 0, - - 88, 88, 88, 87, 86, 87, 0, 0, 85, 0, - 0, 88, 0, 85, 0, 87, 88, 0, 88, 86, - 0, 89, 89, 89, 86, 0, 0, 0, 88, 0, - 87, 0, 0, 0, 0, 87, 0, 89, 0, 89, - 90, 90, 90, 88, 0, 89, 0, 0, 88, 89, - 0, 0, 0, 0, 0, 0, 90, 0, 90, 92, - 92, 92, 0, 90, 89, 0, 0, 0, 90, 89, - 0, 0, 0, 0, 0, 92, 0, 92, 93, 93, - 93, 0, 0, 90, 0, 0, 0, 92, 90, 0, - 0, 0, 0, 0, 93, 92, 93, 0, 0, 100, - - 100, 100, 92, 0, 0, 0, 93, 92, 0, 0, - 0, 0, 0, 93, 0, 100, 0, 100, 101, 101, - 101, 93, 102, 102, 102, 0, 93, 100, 0, 0, - 0, 0, 0, 0, 101, 0, 101, 101, 102, 0, - 102, 0, 100, 0, 0, 0, 101, 100, 0, 0, - 102, 102, 0, 103, 103, 103, 104, 104, 104, 0, - 0, 101, 0, 0, 0, 102, 101, 0, 0, 103, - 102, 103, 104, 0, 104, 0, 0, 104, 103, 0, - 0, 103, 0, 0, 104, 0, 0, 105, 105, 105, - 106, 106, 106, 0, 0, 0, 103, 0, 0, 104, - - 0, 103, 0, 105, 104, 105, 106, 0, 106, 0, - 0, 105, 106, 0, 0, 105, 0, 0, 106, 0, - 0, 107, 107, 107, 0, 108, 108, 108, 0, 0, - 105, 0, 0, 106, 0, 105, 0, 107, 106, 107, - 0, 108, 0, 108, 109, 109, 109, 0, 0, 107, - 108, 0, 0, 108, 0, 0, 0, 0, 0, 0, - 109, 0, 109, 0, 107, 0, 0, 109, 108, 107, - 0, 0, 109, 108, 0, 110, 110, 110, 0, 111, - 111, 111, 0, 112, 112, 112, 0, 109, 111, 0, - 110, 110, 109, 110, 112, 111, 0, 111, 0, 112, - - 0, 112, 0, 110, 0, 0, 0, 111, 0, 0, - 0, 112, 113, 113, 113, 0, 0, 0, 110, 114, - 114, 114, 111, 110, 0, 0, 112, 111, 113, 0, - 113, 112, 113, 0, 0, 114, 0, 114, 0, 0, - 113, 115, 115, 115, 0, 0, 0, 114, 117, 117, - 117, 0, 0, 0, 0, 113, 115, 115, 0, 115, - 113, 0, 114, 0, 117, 0, 117, 114, 0, 115, - 118, 118, 118, 0, 0, 0, 117, 127, 127, 127, - 0, 0, 0, 117, 115, 0, 118, 0, 118, 115, - 0, 117, 0, 127, 0, 127, 117, 0, 118, 128, - - 128, 128, 0, 0, 0, 127, 129, 129, 129, 0, - 130, 130, 130, 118, 118, 128, 129, 128, 118, 0, - 127, 0, 129, 0, 129, 127, 130, 128, 130, 0, - 0, 0, 0, 0, 129, 0, 0, 0, 130, 131, - 131, 131, 128, 132, 132, 132, 0, 128, 0, 129, - 133, 133, 133, 130, 129, 131, 0, 131, 130, 132, - 0, 132, 0, 0, 132, 0, 133, 131, 133, 0, - 0, 132, 0, 0, 133, 0, 0, 0, 133, 134, - 134, 134, 131, 0, 0, 0, 132, 131, 0, 0, - 0, 132, 0, 133, 134, 134, 0, 134, 133, 0, - - 135, 135, 135, 136, 136, 136, 0, 134, 0, 0, - 135, 0, 0, 0, 0, 0, 135, 136, 135, 136, - 0, 136, 134, 0, 0, 0, 0, 134, 135, 0, - 0, 136, 0, 0, 137, 137, 137, 0, 0, 0, - 0, 0, 0, 135, 0, 0, 136, 0, 135, 0, - 137, 136, 137, 137, 0, 138, 138, 138, 139, 139, - 139, 0, 137, 0, 0, 0, 0, 138, 0, 0, - 0, 138, 0, 138, 139, 0, 139, 137, 139, 140, - 140, 140, 137, 138, 0, 0, 139, 0, 0, 0, - 0, 0, 0, 0, 0, 140, 0, 140, 138, 0, - - 0, 139, 0, 138, 0, 0, 139, 140, 141, 141, - 141, 141, 0, 0, 150, 150, 150, 151, 151, 151, - 0, 0, 140, 140, 141, 150, 141, 140, 0, 0, - 150, 0, 150, 151, 0, 151, 141, 0, 0, 0, - 0, 0, 150, 0, 0, 151, 0, 0, 152, 152, - 152, 141, 0, 0, 0, 0, 141, 150, 0, 0, - 151, 0, 150, 0, 152, 151, 152, 153, 153, 153, - 154, 154, 154, 0, 0, 0, 152, 0, 0, 0, - 0, 154, 152, 153, 0, 153, 154, 0, 154, 0, - 0, 152, 0, 0, 0, 153, 152, 153, 154, 0, - - 0, 155, 155, 155, 156, 156, 156, 0, 0, 0, - 153, 0, 0, 154, 0, 153, 0, 155, 154, 155, - 156, 0, 156, 157, 157, 157, 0, 0, 156, 155, - 0, 0, 156, 0, 0, 155, 0, 0, 0, 157, - 0, 157, 0, 0, 155, 0, 0, 156, 0, 155, - 0, 157, 156, 0, 158, 158, 158, 157, 159, 159, - 159, 159, 169, 169, 169, 0, 157, 0, 0, 0, - 158, 157, 158, 158, 159, 0, 159, 0, 169, 0, - 169, 0, 158, 0, 0, 0, 159, 0, 0, 0, - 169, 170, 170, 170, 0, 0, 169, 158, 0, 0, - - 0, 159, 158, 170, 0, 169, 159, 170, 0, 170, - 169, 0, 171, 171, 171, 172, 172, 172, 0, 170, - 0, 0, 0, 171, 0, 0, 0, 0, 171, 0, - 171, 172, 0, 172, 170, 0, 173, 173, 173, 170, - 171, 0, 0, 172, 0, 0, 173, 0, 0, 174, - 174, 174, 173, 0, 173, 171, 0, 0, 172, 0, - 171, 0, 0, 172, 173, 174, 0, 174, 0, 0, - 0, 175, 175, 175, 0, 0, 0, 174, 0, 173, - 176, 176, 176, 0, 173, 175, 0, 175, 0, 175, - 0, 0, 174, 184, 184, 184, 176, 174, 176, 175, - - 0, 0, 185, 185, 185, 184, 0, 0, 176, 184, - 0, 184, 0, 0, 175, 186, 186, 186, 185, 175, - 185, 184, 185, 176, 187, 187, 187, 0, 176, 0, - 185, 186, 0, 186, 0, 0, 184, 0, 0, 187, - 187, 184, 187, 186, 0, 185, 188, 188, 188, 0, - 185, 0, 187, 191, 191, 191, 0, 188, 186, 0, - 0, 0, 188, 186, 188, 0, 0, 187, 191, 191, - 0, 191, 187, 0, 188, 192, 192, 192, 0, 0, - 0, 191, 193, 193, 193, 0, 0, 0, 0, 188, - 0, 192, 0, 192, 188, 0, 191, 192, 193, 0, - - 193, 191, 0, 192, 193, 0, 194, 194, 194, 0, - 193, 0, 0, 194, 0, 197, 197, 197, 192, 198, - 198, 198, 194, 192, 194, 193, 0, 0, 0, 0, - 193, 197, 197, 197, 194, 198, 0, 198, 0, 0, - 0, 0, 0, 197, 0, 0, 0, 198, 0, 194, - 199, 199, 199, 0, 194, 0, 0, 0, 197, 200, - 200, 200, 198, 197, 0, 0, 199, 198, 199, 200, - 0, 0, 201, 201, 201, 200, 0, 200, 199, 0, - 0, 0, 0, 201, 0, 0, 0, 200, 201, 0, - 201, 0, 0, 199, 202, 202, 202, 0, 199, 0, - - 201, 202, 200, 203, 203, 203, 0, 200, 0, 0, - 202, 0, 202, 0, 203, 201, 204, 204, 204, 203, - 201, 203, 202, 0, 0, 205, 205, 205, 0, 0, - 0, 203, 204, 0, 204, 0, 0, 202, 206, 206, - 206, 205, 202, 205, 204, 0, 203, 0, 0, 205, - 0, 203, 0, 205, 206, 0, 206, 0, 0, 204, - 206, 207, 207, 207, 204, 0, 206, 0, 205, 208, - 208, 208, 0, 205, 0, 0, 0, 207, 0, 207, - 0, 206, 209, 209, 209, 208, 206, 208, 0, 207, - 0, 0, 208, 0, 0, 0, 0, 208, 209, 0, - - 209, 0, 0, 0, 207, 0, 0, 0, 0, 207, - 209, 0, 208, 0, 0, 0, 0, 208, 0, 0, - 0, 0, 0, 0, 0, 209, 0, 0, 0, 0, - 209, 211, 211, 211, 213, 0, 213, 214, 0, 214, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - - 210, 210, 210, 210, 210, 210, 210 + 17, 44, 44, 17, 17, 17, 20, 20, 41, 17, + 17, 41, 34, 17, 26, 26, 26, 34, 34, 17, + 49, 220, 20, 34, 20, 43, 72, 72, 43, 76, + + 26, 76, 26, 26, 20, 74, 74, 187, 96, 68, + 49, 184, 26, 96, 68, 68, 17, 93, 170, 20, + 68, 166, 93, 93, 20, 99, 76, 26, 93, 153, + 99, 152, 26, 150, 17, 19, 147, 147, 19, 19, + 19, 27, 27, 27, 19, 19, 151, 151, 19, 19, + 19, 19, 168, 168, 19, 169, 169, 27, 149, 27, + 28, 28, 28, 27, 148, 19, 146, 19, 129, 27, + 172, 172, 173, 173, 196, 196, 28, 19, 28, 28, + 128, 19, 197, 197, 27, 127, 126, 125, 28, 27, + 124, 123, 19, 29, 29, 29, 122, 19, 119, 19, + + 25, 25, 25, 28, 29, 101, 100, 98, 28, 29, + 97, 29, 75, 73, 18, 5, 25, 25, 25, 4, + 2, 29, 0, 25, 30, 30, 30, 0, 25, 0, + 0, 0, 0, 0, 0, 0, 29, 0, 50, 50, + 30, 29, 30, 25, 0, 0, 0, 0, 25, 30, + 0, 0, 30, 0, 50, 0, 50, 0, 0, 0, + 33, 33, 33, 0, 0, 0, 50, 30, 0, 0, + 0, 33, 30, 31, 31, 31, 33, 0, 33, 0, + 31, 50, 36, 36, 36, 0, 50, 0, 33, 31, + 0, 31, 0, 0, 0, 31, 0, 0, 36, 0, + + 36, 31, 0, 33, 0, 0, 0, 0, 33, 0, + 36, 37, 37, 37, 0, 0, 31, 0, 47, 47, + 47, 31, 32, 32, 32, 36, 36, 37, 0, 37, + 36, 0, 0, 32, 47, 0, 47, 32, 32, 37, + 32, 0, 32, 0, 0, 0, 47, 0, 0, 0, + 32, 51, 51, 51, 37, 0, 0, 37, 0, 37, + 0, 47, 0, 0, 0, 32, 47, 51, 0, 51, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 0, 0, 51, + + 52, 52, 52, 53, 53, 53, 0, 52, 52, 52, + 52, 52, 52, 0, 0, 0, 52, 0, 52, 53, + 0, 53, 0, 0, 0, 0, 0, 0, 52, 0, + 0, 53, 0, 0, 0, 52, 52, 52, 52, 52, + 52, 0, 0, 52, 0, 0, 53, 0, 52, 0, + 0, 53, 54, 54, 54, 55, 55, 55, 56, 56, + 56, 0, 0, 0, 0, 0, 0, 54, 54, 0, + 54, 55, 0, 55, 56, 0, 56, 0, 0, 0, + 54, 0, 56, 55, 0, 0, 56, 0, 0, 55, + 0, 0, 0, 0, 0, 54, 0, 0, 55, 0, + + 54, 56, 0, 55, 0, 0, 56, 57, 57, 57, + 58, 58, 58, 0, 0, 0, 57, 0, 0, 0, + 0, 0, 0, 57, 0, 57, 58, 0, 58, 0, + 58, 0, 0, 0, 0, 57, 0, 0, 58, 0, + 0, 0, 0, 0, 0, 0, 60, 60, 60, 0, + 57, 0, 0, 58, 0, 57, 0, 60, 58, 59, + 59, 59, 60, 0, 60, 0, 0, 0, 61, 61, + 61, 0, 0, 0, 60, 59, 0, 59, 0, 0, + 59, 0, 0, 59, 61, 0, 61, 59, 0, 60, + 0, 0, 61, 0, 60, 0, 61, 62, 62, 62, + + 0, 0, 59, 63, 63, 63, 0, 59, 0, 0, + 62, 61, 0, 62, 0, 62, 61, 0, 0, 63, + 0, 63, 0, 63, 0, 62, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, + 62, 0, 0, 0, 0, 62, 63, 0, 65, 65, + 65, 63, 64, 64, 64, 66, 66, 66, 0, 64, + 0, 0, 0, 0, 65, 64, 65, 0, 64, 0, + 64, 66, 0, 66, 0, 0, 65, 66, 65, 0, + 64, 0, 0, 66, 0, 0, 67, 67, 67, 0, + 0, 65, 0, 0, 0, 64, 65, 0, 66, 0, + + 64, 0, 67, 66, 67, 70, 70, 70, 67, 71, + 71, 71, 0, 0, 67, 0, 0, 0, 0, 0, + 0, 70, 0, 70, 0, 71, 0, 71, 0, 67, + 0, 0, 0, 70, 67, 0, 0, 71, 0, 0, + 0, 0, 77, 77, 77, 0, 71, 0, 70, 0, + 0, 70, 71, 70, 0, 77, 0, 71, 77, 0, + 77, 78, 78, 78, 0, 79, 79, 79, 0, 0, + 77, 0, 0, 0, 0, 0, 0, 78, 0, 78, + 78, 79, 0, 79, 0, 77, 0, 79, 0, 78, + 77, 0, 0, 79, 80, 80, 80, 0, 81, 81, + + 81, 0, 0, 0, 78, 0, 0, 0, 79, 78, + 80, 80, 80, 79, 81, 0, 81, 0, 0, 0, + 0, 0, 80, 81, 0, 0, 81, 82, 82, 82, + 0, 0, 0, 83, 83, 83, 0, 80, 0, 0, + 0, 81, 80, 82, 83, 82, 81, 0, 0, 83, + 0, 83, 82, 0, 0, 82, 84, 84, 84, 0, + 0, 83, 85, 85, 85, 0, 0, 0, 0, 0, + 82, 0, 84, 0, 84, 82, 83, 84, 85, 0, + 85, 83, 0, 85, 84, 86, 86, 86, 0, 0, + 85, 87, 87, 87, 0, 0, 86, 0, 0, 84, + + 0, 86, 0, 86, 84, 85, 0, 87, 0, 87, + 85, 0, 0, 86, 88, 88, 88, 87, 0, 87, + 0, 0, 89, 89, 89, 0, 0, 0, 86, 0, + 88, 0, 88, 86, 87, 0, 88, 0, 89, 87, + 89, 0, 88, 90, 90, 90, 0, 0, 0, 0, + 89, 91, 91, 91, 90, 0, 0, 88, 0, 90, + 0, 90, 88, 0, 0, 89, 0, 91, 0, 91, + 89, 90, 92, 92, 92, 91, 0, 0, 0, 91, + 94, 94, 94, 0, 0, 0, 90, 0, 92, 0, + 92, 90, 0, 0, 91, 92, 94, 0, 94, 91, + + 92, 95, 95, 95, 0, 0, 0, 0, 94, 102, + 102, 102, 0, 0, 0, 92, 94, 95, 0, 95, + 92, 0, 0, 94, 0, 102, 0, 102, 94, 95, + 0, 0, 103, 103, 103, 0, 95, 102, 0, 0, + 0, 0, 0, 0, 95, 104, 104, 104, 103, 95, + 103, 103, 102, 105, 105, 105, 104, 102, 0, 0, + 103, 104, 0, 104, 0, 0, 0, 0, 0, 105, + 0, 105, 0, 104, 0, 103, 107, 107, 107, 0, + 103, 105, 105, 0, 106, 106, 106, 0, 104, 0, + 0, 0, 107, 104, 107, 0, 105, 107, 0, 0, + + 106, 105, 106, 0, 107, 108, 108, 108, 0, 106, + 0, 0, 106, 0, 0, 0, 0, 0, 0, 107, + 0, 108, 0, 108, 107, 0, 0, 106, 0, 108, + 0, 0, 106, 108, 109, 109, 109, 0, 0, 0, + 0, 110, 110, 110, 0, 111, 111, 111, 108, 0, + 109, 0, 109, 108, 0, 0, 109, 110, 0, 110, + 0, 111, 109, 111, 0, 0, 0, 0, 0, 110, + 111, 0, 0, 111, 112, 112, 112, 109, 116, 116, + 116, 0, 109, 0, 110, 113, 113, 113, 111, 110, + 112, 0, 112, 111, 116, 0, 116, 112, 116, 0, + + 113, 113, 112, 113, 0, 0, 116, 114, 114, 114, + 0, 0, 0, 113, 0, 0, 114, 112, 115, 115, + 115, 116, 112, 114, 0, 114, 116, 0, 113, 115, + 0, 0, 0, 113, 115, 114, 115, 0, 0, 0, + 117, 117, 117, 0, 0, 0, 115, 118, 118, 118, + 114, 120, 120, 120, 0, 114, 117, 0, 117, 0, + 0, 115, 118, 118, 0, 118, 115, 120, 117, 120, + 0, 0, 0, 0, 0, 118, 0, 0, 0, 120, + 121, 121, 121, 117, 0, 0, 120, 0, 117, 0, + 118, 130, 130, 130, 120, 118, 121, 0, 121, 120, + + 0, 0, 131, 131, 131, 0, 0, 130, 121, 130, + 0, 0, 0, 131, 0, 132, 132, 132, 131, 130, + 131, 0, 0, 121, 121, 0, 0, 0, 121, 0, + 131, 132, 0, 132, 130, 0, 133, 133, 133, 130, + 0, 0, 0, 132, 0, 131, 133, 0, 0, 0, + 131, 0, 133, 0, 133, 134, 134, 134, 132, 135, + 135, 135, 0, 132, 133, 0, 0, 0, 0, 0, + 0, 134, 0, 134, 0, 135, 0, 135, 0, 133, + 0, 0, 0, 134, 133, 0, 0, 135, 136, 136, + 136, 0, 0, 0, 137, 137, 137, 0, 134, 0, + + 0, 0, 135, 134, 136, 0, 136, 135, 0, 136, + 137, 0, 137, 0, 0, 0, 136, 0, 137, 0, + 0, 0, 137, 138, 138, 138, 0, 0, 0, 0, + 0, 136, 0, 0, 0, 0, 136, 137, 138, 138, + 0, 138, 137, 0, 139, 139, 139, 140, 140, 140, + 0, 138, 0, 0, 139, 0, 0, 0, 0, 0, + 139, 140, 139, 140, 0, 140, 138, 0, 0, 0, + 0, 138, 139, 0, 0, 140, 0, 0, 141, 141, + 141, 0, 0, 0, 0, 0, 0, 139, 0, 0, + 140, 0, 139, 0, 141, 140, 141, 141, 0, 142, + + 142, 142, 143, 143, 143, 0, 141, 0, 0, 0, + 0, 142, 0, 0, 0, 142, 0, 142, 143, 0, + 143, 141, 143, 144, 144, 144, 141, 142, 0, 0, + 143, 0, 0, 0, 0, 0, 0, 0, 0, 144, + 0, 144, 142, 0, 0, 143, 0, 142, 0, 0, + 143, 144, 145, 145, 145, 145, 0, 0, 0, 154, + 154, 154, 0, 155, 155, 155, 144, 144, 145, 154, + 145, 144, 0, 0, 155, 154, 0, 154, 0, 155, + 145, 155, 0, 0, 0, 0, 0, 154, 0, 0, + 0, 155, 156, 156, 156, 145, 157, 157, 157, 0, + + 145, 0, 154, 158, 158, 158, 155, 154, 156, 0, + 156, 155, 157, 0, 157, 0, 0, 0, 0, 158, + 156, 158, 0, 0, 157, 159, 159, 159, 0, 0, + 157, 158, 0, 158, 0, 156, 159, 0, 0, 157, + 156, 159, 0, 159, 157, 0, 158, 160, 160, 160, + 0, 158, 0, 159, 161, 161, 161, 0, 162, 162, + 162, 0, 0, 160, 0, 160, 0, 0, 159, 0, + 161, 0, 161, 159, 162, 160, 162, 0, 161, 0, + 0, 160, 161, 0, 0, 0, 162, 0, 0, 0, + 160, 0, 162, 0, 0, 160, 0, 161, 163, 163, + + 163, 162, 161, 0, 0, 0, 162, 164, 164, 164, + 164, 174, 174, 174, 163, 0, 163, 163, 0, 0, + 0, 0, 174, 164, 0, 164, 163, 174, 0, 174, + 0, 0, 0, 0, 0, 164, 0, 0, 0, 174, + 0, 163, 175, 175, 175, 0, 163, 0, 0, 0, + 164, 176, 176, 176, 174, 164, 0, 0, 175, 174, + 175, 0, 0, 176, 177, 177, 177, 176, 0, 176, + 175, 0, 0, 0, 0, 177, 175, 0, 0, 176, + 177, 0, 177, 0, 0, 175, 178, 178, 178, 0, + 175, 0, 177, 0, 176, 179, 179, 179, 0, 176, + + 0, 0, 178, 0, 178, 179, 0, 177, 180, 180, + 180, 179, 177, 179, 178, 0, 0, 181, 181, 181, + 0, 0, 0, 179, 180, 0, 180, 0, 0, 178, + 0, 181, 0, 181, 178, 181, 180, 0, 179, 182, + 182, 182, 0, 179, 0, 181, 0, 0, 190, 190, + 190, 180, 192, 192, 192, 182, 180, 182, 190, 0, + 181, 191, 191, 191, 190, 181, 190, 182, 192, 0, + 192, 0, 192, 191, 0, 0, 190, 191, 0, 191, + 192, 0, 182, 193, 193, 193, 0, 182, 0, 191, + 0, 190, 194, 194, 194, 192, 190, 0, 0, 193, + + 192, 193, 0, 0, 191, 0, 0, 194, 194, 191, + 194, 193, 0, 0, 195, 195, 195, 0, 0, 0, + 194, 198, 198, 198, 0, 195, 193, 0, 0, 0, + 195, 193, 195, 0, 0, 194, 0, 198, 0, 198, + 194, 0, 195, 199, 199, 199, 0, 0, 0, 198, + 200, 200, 200, 0, 0, 0, 0, 195, 199, 199, + 0, 199, 195, 0, 198, 0, 200, 0, 200, 198, + 0, 199, 200, 0, 201, 201, 201, 0, 200, 0, + 0, 202, 202, 202, 0, 0, 199, 0, 202, 0, + 201, 199, 201, 200, 0, 0, 201, 202, 200, 202, + + 0, 0, 201, 205, 205, 205, 0, 0, 0, 202, + 206, 206, 206, 0, 207, 207, 207, 201, 0, 205, + 205, 205, 201, 0, 202, 0, 206, 0, 206, 202, + 207, 205, 207, 0, 0, 0, 0, 0, 206, 0, + 0, 0, 207, 210, 210, 210, 205, 0, 0, 0, + 210, 205, 0, 206, 208, 208, 208, 207, 206, 210, + 0, 210, 207, 0, 208, 209, 209, 209, 0, 0, + 208, 210, 208, 0, 0, 0, 209, 0, 211, 211, + 211, 209, 208, 209, 0, 0, 210, 0, 0, 211, + 0, 210, 0, 209, 211, 0, 211, 208, 0, 212, + + 212, 212, 208, 0, 0, 0, 211, 0, 209, 0, + 0, 0, 0, 209, 0, 212, 0, 212, 0, 0, + 0, 211, 213, 213, 213, 0, 211, 212, 0, 0, + 0, 0, 0, 214, 214, 214, 0, 0, 213, 0, + 213, 0, 212, 0, 0, 0, 213, 212, 0, 214, + 213, 214, 0, 0, 0, 214, 215, 215, 215, 0, + 0, 214, 216, 216, 216, 213, 0, 0, 0, 0, + 213, 0, 215, 0, 215, 0, 214, 0, 216, 0, + 216, 214, 0, 0, 215, 216, 0, 0, 0, 0, + 216, 217, 217, 217, 0, 0, 0, 0, 0, 215, + + 0, 0, 0, 0, 215, 216, 0, 217, 0, 217, + 216, 0, 0, 0, 0, 0, 0, 0, 0, 217, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 217, 0, 0, 0, 0, 217, + 219, 219, 219, 221, 0, 221, 222, 0, 222, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218 } ; -static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; -static char *yy_full_match; -static int yy_lp; -#define REJECT \ -{ \ -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ -yy_cp = yy_full_match; /* restore poss. backed-over text */ \ -++yy_lp; \ -goto find_rule; \ -} +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[51] = + { 0, +1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 1, 0, 0, }; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int ld_flex_debug; +int ld_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "/home/drepper/gnu/elfutils/src/ldlex.l" -#define INITIAL 0 -#line 2 "/home/drepper/gnu/elfutils/src/ldlex.l" -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +char *ldtext; +#line 1 "ldlex.l" +#line 2 "ldlex.l" +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -1035,6 +1128,11 @@ char *yytext; #undef fwrite #define fwrite(b, m, n, s) fwrite_unlocked (b, m, n, s) +/* ECHO must be redefined since the default implementation ignores + the return value of fwrite_unlocked. */ +#define ECHO do { size_t n__ __attribute__ ((unused)) \ + = fwrite (ldtext, ldleng, 1, ldout); } while (0) + /* Defined in ld.c. */ extern int ld_scan_version_script; @@ -1054,10 +1152,54 @@ static void push_state (enum prepstate); static int pop_state (void); static int handle_ifdef (void); static void invalid_char (int ch); -#define YY_NEVER_INTERACTIVE 1 + +#line 1157 "ldlex.c" + +#define INITIAL 0 #define IGNORE 1 -#line 1061 "ldlex.c" +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ldlex_destroy (void ); + +int ldget_debug (void ); + +void ldset_debug (int debug_flag ); + +YY_EXTRA_TYPE ldget_extra (void ); + +void ldset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *ldget_in (void ); + +void ldset_in (FILE * in_str ); + +FILE *ldget_out (void ); + +void ldset_out (FILE * out_str ); + +int ldget_leng (void ); + +char *ldget_text (void ); + +int ldget_lineno (void ); + +void ldset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1065,65 +1207,30 @@ static void invalid_char (int ch); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int ldwrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int ldwrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif +#ifdef __cplusplus +static int yyinput (void ); #else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 +static int input (void ); #endif -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -1132,12 +1239,11 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO fwrite( ldtext, ldleng, 1, ldout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1145,21 +1251,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + unsigned n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( ldin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( ldin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, ldin))==0 && ferror(ldin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(ldin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -1180,14 +1300,20 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int ldlex (void); -/* Code executed at the beginning of each rule, after yytext and yyleng +#define YY_DECL int ldlex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after ldtext and ldleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1200,18 +1326,20 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ + if ( ldleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (ldtext[ldleng - 1] == '\n'); \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; - -#line 79 "/home/drepper/gnu/elfutils/src/ldlex.l" + +#line 96 "ldlex.l" if (unlikely (ld_scan_version_script)) { @@ -1219,149 +1347,153 @@ YY_DECL return kVERSION_SCRIPT; } -#line 1223 "ldlex.c" +#line 1351 "ldlex.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! ldin ) + ldin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! ldout ) + ldout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + ldensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + ld_create_buffer(ldin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + ld_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of ldtext. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 211 ) + if ( yy_current_state >= 219 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 2141 ); + while ( yy_current_state != 218 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - { - yy_full_match = yy_cp; - break; - } - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; - if ( yy_act != YY_END_OF_BUFFER ) + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - ++yylineno; + for ( yyl = 0; yyl < ldleng; ++yyl ) + if ( ldtext[yyl] == '\n' ) + + ldlineno++; +; } do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + case 1: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 6; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 1 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 6; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 86 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 103 "ldlex.l" { BEGIN (handle_ifdef ()); } YY_BREAK case 2: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 5; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 2 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 5; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 87 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 104 "ldlex.l" { eat_to_eol (true); push_state (skip_to_endif); BEGIN (IGNORE); } YY_BREAK case 3: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 8; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 3 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 8; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 90 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 107 "ldlex.l" { eat_to_eol (false); push_state (skip_to_endif); BEGIN (IGNORE); } YY_BREAK case 4: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 6; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 4 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 6; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 93 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 110 "ldlex.l" { eat_to_eol (true) ; } YY_BREAK case 5: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 6; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 5 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 6; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 95 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 112 "ldlex.l" { eat_to_eol (false); push_state (skip_to_endif); } YY_BREAK case 6: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 5; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 6 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 5; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 97 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 114 "ldlex.l" { eat_to_eol (true); assert (prepdepth > 0); if (prepstate[prepdepth - 1] == skip_if) @@ -1373,11 +1505,12 @@ YY_RULE_SETUP } YY_BREAK case 7: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 8; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 7 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 8; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 106 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 123 "ldlex.l" { assert (prepdepth > 0); if (prepstate[prepdepth - 1] == skip_if) { @@ -1388,198 +1521,205 @@ YY_RULE_SETUP } YY_BREAK case 8: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp = yy_bp + 6; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +/* rule 8 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ldtext */ +(yy_c_buf_p) = yy_cp = yy_bp + 6; +YY_DO_BEFORE_ACTION; /* set up ldtext again */ YY_RULE_SETUP -#line 114 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 131 "ldlex.l" { eat_to_eol (true); BEGIN (pop_state ()); } YY_BREAK case 9: +/* rule 9 can match eol */ YY_RULE_SETUP -#line 116 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 133 "ldlex.l" { /* nothing */ } YY_BREAK case 10: YY_RULE_SETUP -#line 119 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 136 "ldlex.l" { eat_comment (); } YY_BREAK case 11: YY_RULE_SETUP -#line 121 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 138 "ldlex.l" { return kALIGN; } YY_BREAK case 12: YY_RULE_SETUP -#line 122 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kENTRY; } +#line 139 "ldlex.l" +{ return kAS_NEEDED; } YY_BREAK case 13: YY_RULE_SETUP -#line 123 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kEXCLUDE_FILE; } +#line 140 "ldlex.l" +{ return kENTRY; } YY_BREAK case 14: YY_RULE_SETUP -#line 124 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kGLOBAL; } +#line 141 "ldlex.l" +{ return kEXCLUDE_FILE; } YY_BREAK case 15: YY_RULE_SETUP -#line 125 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kGROUP; } +#line 142 "ldlex.l" +{ return kGLOBAL; } YY_BREAK case 16: YY_RULE_SETUP -#line 126 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kINPUT; } +#line 143 "ldlex.l" +{ return kGROUP; } YY_BREAK case 17: YY_RULE_SETUP -#line 127 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kINTERP; } +#line 144 "ldlex.l" +{ return kINPUT; } YY_BREAK case 18: YY_RULE_SETUP -#line 128 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kKEEP; } +#line 145 "ldlex.l" +{ return kINTERP; } YY_BREAK case 19: YY_RULE_SETUP -#line 129 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kLOCAL; } +#line 146 "ldlex.l" +{ return kKEEP; } YY_BREAK case 20: YY_RULE_SETUP -#line 130 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kOUTPUT_FORMAT; } +#line 147 "ldlex.l" +{ return kLOCAL; } YY_BREAK case 21: YY_RULE_SETUP -#line 131 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kPAGESIZE; } +#line 148 "ldlex.l" +{ return kOUTPUT_FORMAT; } YY_BREAK case 22: YY_RULE_SETUP -#line 132 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kPROVIDE; } +#line 149 "ldlex.l" +{ return kPAGESIZE; } YY_BREAK case 23: YY_RULE_SETUP -#line 133 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kSEARCH_DIR; } +#line 150 "ldlex.l" +{ return kPROVIDE; } YY_BREAK case 24: YY_RULE_SETUP -#line 134 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kSEGMENT; } +#line 151 "ldlex.l" +{ return kSEARCH_DIR; } YY_BREAK case 25: YY_RULE_SETUP -#line 135 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kSIZEOF_HEADERS; } +#line 152 "ldlex.l" +{ return kSEGMENT; } YY_BREAK case 26: YY_RULE_SETUP -#line 136 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kSORT; } +#line 153 "ldlex.l" +{ return kSIZEOF_HEADERS; } YY_BREAK case 27: YY_RULE_SETUP -#line 137 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ return kVERSION; } +#line 154 "ldlex.l" +{ return kSORT; } YY_BREAK case 28: YY_RULE_SETUP -#line 139 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 155 "ldlex.l" +{ return kVERSION; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 157 "ldlex.l" { int cnt = 1 ; ldlval.num = 0; - while (cnt < yyleng - 1) - ldlval.num |= attrib_convert (yytext[cnt++]); + while (cnt < ldleng - 1) + ldlval.num |= attrib_convert (ldtext[cnt++]); return kMODE; } YY_BREAK -case 29: +case 30: YY_RULE_SETUP -#line 145 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 163 "ldlex.l" { return '{'; } YY_BREAK -case 30: +case 31: YY_RULE_SETUP -#line 146 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 164 "ldlex.l" { return '}'; } YY_BREAK -case 31: +case 32: YY_RULE_SETUP -#line 147 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 165 "ldlex.l" { return '('; } YY_BREAK -case 32: +case 33: YY_RULE_SETUP -#line 148 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 166 "ldlex.l" { return ')'; } YY_BREAK -case 33: +case 34: YY_RULE_SETUP -#line 149 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 167 "ldlex.l" { return ':'; } YY_BREAK -case 34: +case 35: YY_RULE_SETUP -#line 150 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 168 "ldlex.l" { return ';'; } YY_BREAK -case 35: +case 36: YY_RULE_SETUP -#line 151 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 169 "ldlex.l" { return '='; } YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 152 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 170 "ldlex.l" { ldlval.op = exp_plus; return kADD_OP; } YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 153 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 171 "ldlex.l" { ldlval.op = exp_minus; return kADD_OP; } YY_BREAK -case 38: +case 39: YY_RULE_SETUP -#line 154 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 172 "ldlex.l" { return '*'; } YY_BREAK -case 39: +case 40: YY_RULE_SETUP -#line 155 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 173 "ldlex.l" { ldlval.op = exp_div; return kMUL_OP; } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 156 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 174 "ldlex.l" { ldlval.op = exp_mod; return kMUL_OP; } YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 157 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 175 "ldlex.l" { return '&'; } YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 158 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 176 "ldlex.l" { return '|'; } YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 160 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 178 "ldlex.l" { return ','; } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 162 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 180 "ldlex.l" { char *endp; - ldlval.num = strtoumax (yytext, &endp, 0); + ldlval.num = strtoumax (ldtext, &endp, 0); if (*endp != '\0') { if (tolower (*endp) == 'k') @@ -1592,63 +1732,64 @@ YY_RULE_SETUP } return kNUM; } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 176 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 194 "ldlex.l" { ldlval.str = obstack_strndup (&ld_state.smem, - yytext, yyleng); + ldtext, ldleng); return kID; } YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 180 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 198 "ldlex.l" { ldlval.str = obstack_strndup (&ld_state.smem, - yytext, yyleng); + ldtext, ldleng); return kFILENAME; } YY_BREAK -case 47: +case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 184 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 202 "ldlex.l" { /* IGNORE */ } YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 186 "/home/drepper/gnu/elfutils/src/ldlex.l" -{ invalid_char (*yytext); } +#line 204 "ldlex.l" +{ invalid_char (*ldtext); } YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 188 "/home/drepper/gnu/elfutils/src/ldlex.l" +#line 206 "ldlex.l" ECHO; YY_BREAK -#line 1625 "ldlex.c" - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(IGNORE): - yyterminate(); +#line 1766 "ldlex.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(IGNORE): + yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed ldin at a new source and called + * ldlex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = ldin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1658,13 +1799,13 @@ ECHO; * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1677,41 +1818,42 @@ ECHO; yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( ldwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * ldtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1719,30 +1861,30 @@ ECHO; else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1753,8 +1895,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of ldlex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1763,21 +1904,20 @@ ECHO; * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1797,34 +1937,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1837,8 +1973,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + ldrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1848,35 +1983,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + ldrestart(ldin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1884,150 +2019,150 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ldrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - return ret_val; - } + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 211 ) + if ( yy_current_state >= 219 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 211 ) + if ( yy_current_state >= 219 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 210); - if ( ! yy_is_jam ) - *yy_state_ptr++ = yy_current_state; + yy_is_jam = (yy_current_state == 218); return yy_is_jam ? 0 : yy_current_state; - } - +} -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + /* undo effects of setting up ldtext */ + *yy_cp = (yy_hold_char); - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; - if ( c == '\n' ) - --yylineno; - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + if ( c == '\n' ){ + --ldlineno; + } + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -2041,16 +2176,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + ldrestart(ldin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( ldwrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -2060,170 +2195,171 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve ldtext */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); - if ( yy_current_buffer->yy_at_bol ) - ++yylineno; + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + ldlineno++; +; return c; - } -#endif /* YY_NO_INPUT */ - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +} +#endif /* ifndef YY_NO_INPUT */ - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void ldrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + ldensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + ld_create_buffer(ldin,YY_BUF_SIZE ); } + ld_init_buffer(YY_CURRENT_BUFFER,input_file ); + ld_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void ld_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * ldpop_buffer_state(); + * ldpush_buffer_state(new_buffer); + */ + ldensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + ld_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (ldwrap()) processing, but the only time this flag + * is looked at is after ldwrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void ld_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + ldin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE ld_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) ldalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ld_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) ldalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ld_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + ld_init_buffer(b,file ); return b; - } - +} -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with ld_create_buffer() + * + */ + void ld_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + ldfree((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif + ldfree((void *) b ); +} +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a ldrestart() or at EOF. + */ + static void ld_init_buffer (YY_BUFFER_STATE b, FILE * file ) - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + ld_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - + /* If b is the current buffer, then ld_init_buffer was _probably_ + * called from ldrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_is_interactive = 0; + + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void ld_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -2240,31 +2376,127 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + ld_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void ldpush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + ldensure_buffer_stack(); + + /* This block is copied from ld_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from ld_switch_to_buffer. */ + ld_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void ldpop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + ld_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + ld_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void ldensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)ldalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in ldensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)ldrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in ldensure_buffer_stack()" ); + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ld_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ldalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ld_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -2276,58 +2508,53 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + ld_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to ldlex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * ld_scan_bytes() instead. + */ +YY_BUFFER_STATE ld_scan_string (yyconst char * yystr ) +{ + + return ld_scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to ldlex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ld_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) ldalloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in ld_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = ld_scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in ld_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2335,148 +2562,199 @@ int len; b->yy_is_our_buffer = 1; return b; - } +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 #endif +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; +/* Redefine yyless() so it works in section 3 code. */ - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up ldtext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + ldtext[ldleng] = (yy_hold_char); \ + (yy_c_buf_p) = ldtext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + ldleng = yyless_macro_arg; \ + } \ + while ( 0 ) - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); +/* Accessor methods (get/set functions) to struct members. */ - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); +/** Get the current line number. + * + */ +int ldget_lineno (void) +{ + + return ldlineno; +} - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } +/** Get the input stream. + * + */ +FILE *ldget_in (void) +{ + return ldin; +} - yy_start_stack[yy_start_stack_ptr++] = YY_START; +/** Get the output stream. + * + */ +FILE *ldget_out (void) +{ + return ldout; +} - BEGIN(new_state); - } -#endif +/** Get the length of the current token. + * + */ +int ldget_leng (void) +{ + return ldleng; +} +/** Get the current token. + * + */ -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); +char *ldget_text (void) +{ + return ldtext; +} - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif +/** Set the current line number. + * @param line_number + * + */ +void ldset_lineno (int line_number ) +{ + + ldlineno = line_number; +} +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see ld_switch_to_buffer + */ +void ldset_in (FILE * in_str ) +{ + ldin = in_str ; +} -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +void ldset_out (FILE * out_str ) +{ + ldout = out_str ; +} -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif +int ldget_debug (void) +{ + return ld_flex_debug; +} + +void ldset_debug (int bdebug ) +{ + ld_flex_debug = bdebug ; +} -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from ldlex_destroy(), so don't allocate here. + */ + + /* We do not touch ldlineno unless the option is enabled. */ + ldlineno = 1; + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + ldin = stdin; + ldout = stdout; #else -static void yy_fatal_error( msg ) -char msg[]; + ldin = (FILE *) 0; + ldout = (FILE *) 0; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + /* For future reference: Set errno on error, since we are called by + * ldlex_init() + */ + return 0; +} +/* ldlex_destroy is for both reentrant and non-reentrant scanners. */ +int ldlex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + ld_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + ldpop_buffer_state(); + } -/* Redefine yyless() so it works in section 3 code. */ + /* Destroy the stack itself. */ + ldfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * ldlex() is called, initialization will occur. */ + yy_init_globals( ); + return 0; +} -/* Internal utility routines. */ +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *ldalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *ldrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2485,26 +2763,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void ldfree (void * ptr ) +{ + free( (char *) ptr ); /* see ldrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 206 "ldlex.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 188 "/home/drepper/gnu/elfutils/src/ldlex.l" static void @@ -2549,13 +2818,13 @@ eat_to_eol (bool empty) break; if (c == '\n') { - ++yylineno; + ++ldlineno; break; } if (empty && ! isspace (c) && ! warned) { - error (0, 0, gettext ("%d: garbage at end of line"), yylineno); + error (0, 0, gettext ("%d: garbage at end of line"), ldlineno); warned = true; } } @@ -2579,7 +2848,7 @@ push_state (enum prepstate state) { if (prepdepth >= MAX_PREPDEPTH) error (EXIT_FAILURE, 0, gettext ("%d: conditionals nested too deep"), - yylineno); + ldlineno); prepstate[prepdepth++] = state; } @@ -2589,7 +2858,7 @@ static int pop_state (void) { if (prepdepth == 0) - error (0, 0, gettext ("%d: unexpected #endif"), yylineno); + error (0, 0, gettext ("%d: unexpected #endif"), ldlineno); else --prepdepth; @@ -2654,10 +2923,11 @@ invalid_char (int ch) error (0, 0, (isascii (ch) ? gettext ("invalid character '%c' at line %d; ignored") : gettext ("invalid character '\\%o' at line %d; ignored")), - ch, yylineno); + ch, ldlineno); } // Local Variables: // mode: C // End: + diff --git a/src/ldlex.l b/src/ldlex.l index 06ea6237..eb15c7be 100644 --- a/src/ldlex.l +++ b/src/ldlex.l @@ -1,16 +1,28 @@ %{ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -41,6 +53,11 @@ #undef fwrite #define fwrite(b, m, n, s) fwrite_unlocked (b, m, n, s) +/* ECHO must be redefined since the default implementation ignores + the return value of fwrite_unlocked. */ +#define ECHO do { size_t n__ __attribute__ ((unused)) \ + = fwrite (yytext, yyleng, 1, yyout); } while (0) + /* Defined in ld.c. */ extern int ld_scan_version_script; @@ -62,7 +79,7 @@ static int handle_ifdef (void); static void invalid_char (int ch); %} -ID [a-zA-Z0-9_.*?]+ +ID [a-zA-Z0-9_.*?][a-zA-Z0-9_.*?-]* FILENAMECHAR1 [a-zA-Z0-9_/.\\~] FILENAMECHAR [^][{}[:space:]():;]+ HEX 0[xX][0-9a-fA-F]+[kKmM]? @@ -119,6 +136,7 @@ WHITE [[:space:]]+ "/*" { eat_comment (); } ALIGN { return kALIGN; } +AS_NEEDED { return kAS_NEEDED; } ENTRY { return kENTRY; } EXCLUDE_FILE { return kEXCLUDE_FILE; } "global:" { return kGLOBAL; } diff --git a/src/ldscript.c b/src/ldscript.c index 0f70ca95..da72f29c 100644 --- a/src/ldscript.c +++ b/src/ldscript.c @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 @@ -15,16 +17,24 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -36,6 +46,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.3" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,8 +58,7 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse ldparse #define yylex ldlex #define yyerror lderror @@ -64,78 +76,93 @@ enum yytokentype { kADD_OP = 258, kALIGN = 259, - kENTRY = 260, - kEXCLUDE_FILE = 261, - kFILENAME = 262, - kGLOBAL = 263, - kGROUP = 264, - kID = 265, - kINPUT = 266, - kINTERP = 267, - kKEEP = 268, - kLOCAL = 269, - kMODE = 270, - kMUL_OP = 271, - kNUM = 272, - kOUTPUT_FORMAT = 273, - kPAGESIZE = 274, - kPROVIDE = 275, - kSEARCH_DIR = 276, - kSEGMENT = 277, - kSIZEOF_HEADERS = 278, - kSORT = 279, - kVERSION = 280, - kVERSION_SCRIPT = 281, - ADD_OP = 282, - MUL_OP = 283 + kAS_NEEDED = 260, + kENTRY = 261, + kEXCLUDE_FILE = 262, + kFILENAME = 263, + kGLOBAL = 264, + kGROUP = 265, + kID = 266, + kINPUT = 267, + kINTERP = 268, + kKEEP = 269, + kLOCAL = 270, + kMODE = 271, + kMUL_OP = 272, + kNUM = 273, + kOUTPUT_FORMAT = 274, + kPAGESIZE = 275, + kPROVIDE = 276, + kSEARCH_DIR = 277, + kSEGMENT = 278, + kSIZEOF_HEADERS = 279, + kSORT = 280, + kVERSION = 281, + kVERSION_SCRIPT = 282, + ADD_OP = 283, + MUL_OP = 284 }; #endif +/* Tokens. */ #define kADD_OP 258 #define kALIGN 259 -#define kENTRY 260 -#define kEXCLUDE_FILE 261 -#define kFILENAME 262 -#define kGLOBAL 263 -#define kGROUP 264 -#define kID 265 -#define kINPUT 266 -#define kINTERP 267 -#define kKEEP 268 -#define kLOCAL 269 -#define kMODE 270 -#define kMUL_OP 271 -#define kNUM 272 -#define kOUTPUT_FORMAT 273 -#define kPAGESIZE 274 -#define kPROVIDE 275 -#define kSEARCH_DIR 276 -#define kSEGMENT 277 -#define kSIZEOF_HEADERS 278 -#define kSORT 279 -#define kVERSION 280 -#define kVERSION_SCRIPT 281 -#define ADD_OP 282 -#define MUL_OP 283 +#define kAS_NEEDED 260 +#define kENTRY 261 +#define kEXCLUDE_FILE 262 +#define kFILENAME 263 +#define kGLOBAL 264 +#define kGROUP 265 +#define kID 266 +#define kINPUT 267 +#define kINTERP 268 +#define kKEEP 269 +#define kLOCAL 270 +#define kMODE 271 +#define kMUL_OP 272 +#define kNUM 273 +#define kOUTPUT_FORMAT 274 +#define kPAGESIZE 275 +#define kPROVIDE 276 +#define kSEARCH_DIR 277 +#define kSEGMENT 278 +#define kSIZEOF_HEADERS 279 +#define kSORT 280 +#define kVERSION 281 +#define kVERSION_SCRIPT 282 +#define ADD_OP 283 +#define MUL_OP 284 /* Copy the first part of user declarations. */ -#line 1 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 1 "ldscript.y" /* Parser for linker scripts. - Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -170,6 +197,7 @@ static void new_segment (int mode, struct output_rule *output_rule); static struct filename_list *new_filename_listelem (const char *string); static void add_inputfiles (struct filename_list *fnames); static struct id_list *new_id_listelem (const char *str); + static struct filename_list *mark_as_needed (struct filename_list *listp); static struct version *new_version (struct id_list *local, struct id_list *global); static struct version *merge_versions (struct version *one, @@ -192,9 +220,15 @@ extern int yylex (void); # define YYERROR_VERBOSE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 58 "/home/drepper/gnu/elfutils/src/ldscript.y" -typedef union YYSTYPE { +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 71 "ldscript.y" +{ uintmax_t num; enum expression_tag op; char *str; @@ -207,9 +241,10 @@ typedef union YYSTYPE { struct filename_list *filename_list; struct version *version; struct id_list *id_list; -} YYSTYPE; -/* Line 191 of yacc.c. */ -#line 213 "ldscript.c" +} +/* Line 187 of yacc.c. */ +#line 247 "ldscript.c" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -220,56 +255,171 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 225 "ldscript.c" +/* Line 216 of yacc.c. */ +#line 260 "ldscript.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif -# ifndef YYFREE -# define YYFREE free +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif # endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee 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 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + yytype_int16 yyss; YYSTYPE yyvs; }; @@ -279,24 +429,24 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -314,53 +464,47 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 30 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 32 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 198 +#define YYLAST 226 -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 39 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 22 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 62 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 146 +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 40 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 23 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 66 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 159 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 283 +#define YYMAXUTOK 284 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 28, 2, - 32, 33, 30, 2, 38, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 34, - 2, 37, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 29, 2, + 33, 34, 31, 2, 39, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 35, + 2, 38, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 35, 27, 36, 2, 2, 2, 2, + 2, 2, 2, 36, 28, 37, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -376,80 +520,82 @@ static const unsigned char yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 29, 31 + 25, 26, 27, 30, 32 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned char yyprhs[] = +static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 8, 11, 13, 19, 25, 31, - 37, 43, 49, 54, 59, 64, 69, 72, 74, 77, - 82, 85, 89, 96, 99, 101, 103, 108, 111, 117, - 119, 124, 129, 130, 135, 139, 143, 147, 151, 155, - 159, 161, 163, 165, 167, 171, 173, 175, 176, 179, - 181, 186, 192, 199, 202, 204, 207, 210, 214, 217, - 219, 221, 223 + 37, 43, 49, 54, 59, 64, 69, 74, 77, 79, + 82, 87, 90, 94, 101, 104, 106, 108, 113, 116, + 122, 124, 129, 134, 135, 140, 144, 148, 152, 156, + 160, 164, 166, 168, 170, 172, 176, 178, 180, 181, + 186, 191, 193, 196, 198, 203, 209, 216, 219, 221, + 224, 227, 231, 234, 236, 238, 240 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { - 40, 0, -1, 41, -1, 26, 54, -1, 41, 42, - -1, 42, -1, 5, 32, 10, 33, 34, -1, 21, - 32, 59, 33, 34, -1, 19, 32, 17, 33, 34, - -1, 12, 32, 59, 33, 34, -1, 22, 15, 35, - 43, 36, -1, 22, 1, 35, 43, 36, -1, 9, - 32, 52, 33, -1, 11, 32, 52, 33, -1, 25, - 35, 54, 36, -1, 18, 32, 59, 33, -1, 43, - 44, -1, 44, -1, 45, 34, -1, 10, 35, 46, - 36, -1, 10, 34, -1, 10, 37, 51, -1, 20, - 32, 10, 37, 51, 33, -1, 46, 47, -1, 47, - -1, 48, -1, 13, 32, 48, 33, -1, 45, 34, - -1, 60, 32, 50, 49, 33, -1, 10, -1, 24, - 32, 10, 33, -1, 6, 32, 59, 33, -1, -1, - 4, 32, 51, 33, -1, 32, 51, 33, -1, 51, - 30, 51, -1, 51, 16, 51, -1, 51, 3, 51, - -1, 51, 28, 51, -1, 51, 27, 51, -1, 17, - -1, 10, -1, 23, -1, 19, -1, 52, 53, 59, - -1, 59, -1, 38, -1, -1, 54, 55, -1, 55, - -1, 35, 56, 36, 34, -1, 59, 35, 56, 36, - 34, -1, 59, 35, 56, 36, 59, 34, -1, 56, - 57, -1, 57, -1, 8, 58, -1, 14, 58, -1, - 58, 60, 34, -1, 60, 34, -1, 7, -1, 10, - -1, 59, -1, 30, -1 + 41, 0, -1, 42, -1, 27, 56, -1, 42, 43, + -1, 43, -1, 6, 33, 11, 34, 35, -1, 22, + 33, 61, 34, 35, -1, 20, 33, 18, 34, 35, + -1, 13, 33, 61, 34, 35, -1, 23, 16, 36, + 44, 37, -1, 23, 1, 36, 44, 37, -1, 10, + 33, 53, 34, -1, 12, 33, 53, 34, -1, 5, + 33, 53, 34, -1, 26, 36, 56, 37, -1, 19, + 33, 61, 34, -1, 44, 45, -1, 45, -1, 46, + 35, -1, 11, 36, 47, 37, -1, 11, 35, -1, + 11, 38, 52, -1, 21, 33, 11, 38, 52, 34, + -1, 47, 48, -1, 48, -1, 49, -1, 14, 33, + 49, 34, -1, 46, 35, -1, 62, 33, 51, 50, + 34, -1, 11, -1, 25, 33, 11, 34, -1, 7, + 33, 61, 34, -1, -1, 4, 33, 52, 34, -1, + 33, 52, 34, -1, 52, 31, 52, -1, 52, 17, + 52, -1, 52, 3, 52, -1, 52, 29, 52, -1, + 52, 28, 52, -1, 18, -1, 11, -1, 24, -1, + 20, -1, 53, 54, 55, -1, 55, -1, 39, -1, + -1, 10, 33, 53, 34, -1, 5, 33, 53, 34, + -1, 61, -1, 56, 57, -1, 57, -1, 36, 58, + 37, 35, -1, 61, 36, 58, 37, 35, -1, 61, + 36, 58, 37, 61, 35, -1, 58, 59, -1, 59, + -1, 9, 60, -1, 15, 60, -1, 60, 62, 35, + -1, 62, 35, -1, 8, -1, 11, -1, 61, -1, + 31, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const yytype_uint16 yyrline[] = { - 0, 128, 128, 129, 133, 134, 137, 142, 146, 151, - 156, 160, 166, 177, 179, 181, 185, 190, 194, 199, - 211, 235, 237, 241, 246, 250, 255, 262, 269, 280, - 282, 286, 289, 292, 297, 299, 305, 311, 317, 323, - 329, 334, 339, 341, 345, 351, 355, 356, 359, 364, - 368, 374, 380, 389, 391, 395, 397, 402, 408, 412, - 414, 418, 420 + 0, 143, 143, 144, 148, 149, 152, 157, 161, 166, + 172, 176, 182, 193, 195, 197, 199, 203, 208, 212, + 217, 229, 253, 255, 259, 264, 268, 273, 280, 287, + 298, 300, 304, 307, 310, 315, 317, 323, 329, 335, + 341, 347, 352, 357, 359, 363, 368, 372, 373, 376, + 387, 389, 394, 399, 403, 409, 415, 424, 426, 430, + 432, 437, 443, 447, 449, 453, 455 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kENTRY", - "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID", "kINPUT", - "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM", + "$end", "error", "$undefined", "kADD_OP", "kALIGN", "kAS_NEEDED", + "kENTRY", "kEXCLUDE_FILE", "kFILENAME", "kGLOBAL", "kGROUP", "kID", + "kINPUT", "kINTERP", "kKEEP", "kLOCAL", "kMODE", "kMUL_OP", "kNUM", "kOUTPUT_FORMAT", "kPAGESIZE", "kPROVIDE", "kSEARCH_DIR", "kSEGMENT", "kSIZEOF_HEADERS", "kSORT", "kVERSION", "kVERSION_SCRIPT", "'|'", "'&'", "ADD_OP", "'*'", "MUL_OP", "'('", "')'", "';'", "'{'", "'}'", "'='", "','", "$accept", "script_or_version", "file", "content", "outputsections", "outputsection", "assignment", "inputsections", "inputsection", "sectionname", "sort_opt_name", "exclude_opt", "expr", - "filename_id_list", "comma_opt", "versionlist", "version", - "version_stmt_list", "version_stmt", "filename_id_star_list", + "filename_id_list", "comma_opt", "filename_id_listelem", "versionlist", + "version", "version_stmt_list", "version_stmt", "filename_id_star_list", "filename_id", "filename_id_star", 0 }; #endif @@ -457,97 +603,99 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 124, 38, 282, - 42, 283, 40, 41, 59, 123, 125, 61, 44 + 275, 276, 277, 278, 279, 280, 281, 282, 124, 38, + 283, 42, 284, 40, 41, 59, 123, 125, 61, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { - 0, 39, 40, 40, 41, 41, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 43, 43, 44, 44, - 44, 45, 45, 46, 46, 47, 47, 47, 48, 49, - 49, 50, 50, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 52, 52, 53, 53, 54, 54, - 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, - 59, 60, 60 + 0, 40, 41, 41, 42, 42, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 44, 44, 45, + 45, 45, 46, 46, 47, 47, 48, 48, 48, 49, + 50, 50, 51, 51, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 53, 53, 54, 54, 55, + 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, + 59, 60, 60, 61, 61, 62, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 2, 1, 5, 5, 5, 5, - 5, 5, 4, 4, 4, 4, 2, 1, 2, 4, - 2, 3, 6, 2, 1, 1, 4, 2, 5, 1, - 4, 4, 0, 4, 3, 3, 3, 3, 3, 3, - 1, 1, 1, 1, 3, 1, 1, 0, 2, 1, - 4, 5, 6, 2, 1, 2, 2, 3, 2, 1, - 1, 1, 1 + 5, 5, 4, 4, 4, 4, 4, 2, 1, 2, + 4, 2, 3, 6, 2, 1, 1, 4, 2, 5, + 1, 4, 4, 0, 4, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 3, 1, 1, 0, 4, + 4, 1, 2, 1, 4, 5, 6, 2, 1, 2, + 2, 3, 2, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 59, 60, 0, 3, 49, 0, - 1, 4, 0, 47, 45, 47, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 54, 48, 0, 0, - 12, 46, 0, 13, 0, 15, 0, 0, 0, 0, - 0, 17, 0, 0, 14, 62, 55, 61, 0, 56, - 0, 53, 0, 6, 44, 9, 8, 7, 20, 0, - 0, 0, 11, 16, 18, 10, 0, 58, 50, 0, - 60, 0, 0, 0, 24, 25, 0, 0, 41, 40, - 43, 42, 0, 21, 0, 57, 51, 0, 0, 27, - 19, 23, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 52, 0, 0, 0, 0, 34, 37, 36, 39, - 38, 35, 0, 26, 0, 29, 0, 0, 33, 22, - 0, 0, 28, 31, 0, 30 + 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 63, 64, 0, 3, + 53, 0, 1, 4, 0, 0, 48, 46, 51, 0, + 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 58, 52, 0, 0, 0, 14, 47, 0, + 0, 12, 13, 0, 16, 0, 0, 0, 0, 0, + 18, 0, 0, 15, 66, 59, 65, 0, 60, 0, + 57, 0, 48, 48, 45, 6, 9, 8, 7, 21, + 0, 0, 0, 11, 17, 19, 10, 0, 62, 54, + 0, 50, 49, 64, 0, 0, 0, 25, 26, 0, + 0, 42, 41, 44, 43, 0, 22, 0, 61, 55, + 0, 0, 28, 20, 24, 33, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, 0, 0, 0, 35, + 38, 37, 40, 39, 36, 0, 27, 0, 30, 0, + 0, 34, 23, 0, 0, 29, 32, 0, 31 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - -1, 11, 12, 13, 60, 61, 62, 93, 94, 95, - 137, 124, 103, 33, 52, 27, 28, 45, 46, 66, - 67, 96 + -1, 12, 13, 14, 69, 70, 71, 106, 107, 108, + 150, 137, 116, 36, 59, 37, 29, 30, 51, 52, + 75, 76, 109 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -41 -static const short yypact[] = +#define YYPACT_NINF -86 +static const yytype_int16 yypact[] = { - 107, -28, -20, -13, 34, 77, 85, 88, 91, 33, - 38, 123, 125, -41, 117, 52, 52, 52, 52, 114, - 52, 100, 103, 38, -41, -41, 96, 38, -41, 110, - -41, -41, 115, 64, -41, 67, 116, 118, 120, 127, - 1, 1, 28, 84, 84, 36, -41, -41, 96, 128, - -41, -41, 52, -41, 129, -41, 130, 131, 105, 134, - 75, -41, 133, 79, -41, -41, 84, -41, 135, 84, - 136, -41, 41, -41, -41, -41, -41, -41, -41, 83, - 48, 151, -41, -41, -41, -41, 137, -41, -41, 44, - 138, 140, 139, 17, -41, -41, 142, 144, -41, -41, - -41, -41, 48, 54, 141, -41, -41, 143, 84, -41, - -41, -41, 162, 48, -2, 48, 48, 48, 48, 48, - 48, -41, 146, 148, 97, 6, -41, 54, 54, 58, - 53, -1, 13, -41, 52, -41, 149, 150, -41, -41, - 152, 172, -41, -41, 153, -41 + 111, -18, -14, 23, 45, 70, 75, 85, 92, 97, + 91, 19, 128, 134, -86, 162, 96, 162, 162, 5, + 5, 123, 5, 93, 99, 19, -86, -86, 117, 19, + -86, 115, -86, -86, 125, 144, 71, -86, -86, 145, + 116, 135, 147, 148, 149, 150, 101, 101, 14, 83, + 83, 55, -86, -86, 117, 162, 162, -86, -86, 162, + 133, -86, -86, 143, -86, 151, 152, 107, 155, 63, + -86, 154, 74, -86, -86, 83, -86, 156, 83, 157, + -86, 56, 137, 141, -86, -86, -86, -86, -86, -86, + 88, 48, 174, -86, -86, -86, -86, 158, -86, -86, + 69, -86, -86, 159, 161, 160, 12, -86, -86, 163, + 165, -86, -86, -86, -86, 48, 59, 164, -86, -86, + 166, 83, -86, -86, -86, 183, 48, 0, 48, 48, + 48, 48, 48, 48, -86, 169, 167, 90, 7, -86, + 59, 59, 44, 66, 103, 29, -86, 5, -86, 171, + 172, -86, -86, 173, 188, -86, -86, 175, -86 }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const yytype_int16 yypgoto[] = { - -41, -41, -41, 175, 147, -40, 29, -41, 98, 76, - -41, -41, 39, 173, -41, 167, -24, 145, 15, 154, - -10, 32 + -86, -86, -86, 192, 168, 80, -85, -86, 102, 89, + -86, -86, 33, -16, -86, 153, 186, 38, 170, -39, + 176, -11, 4 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -555,91 +703,82 @@ static const short yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const unsigned char yytable[] = +static const yytype_uint8 yytable[] = { - 29, 115, 115, 47, 14, 34, 34, 36, 37, 115, - 39, 58, 15, 29, 116, 116, 115, 29, 47, 16, - 83, 59, 116, 83, 24, 117, 118, 90, 119, 116, - 91, 126, 29, 117, 118, 24, 119, 59, 25, 138, - 117, 118, 74, 119, 43, 24, 139, 65, 25, 43, - 44, 24, 97, 110, 25, 44, 115, 115, 98, 24, - 71, 115, 25, 26, 64, 99, 17, 100, 23, 116, - 116, 101, 70, 26, 116, 68, 68, 89, 106, 107, - 102, 117, 118, 119, 119, 58, 118, 71, 119, 58, - 24, 24, 21, 90, 25, 59, 91, 50, 86, 59, - 53, 86, 51, 59, 43, 51, 22, 135, 92, 18, - 44, 82, 1, 65, 65, 85, 2, 19, 3, 4, - 20, 136, 92, 30, 140, 5, 6, 32, 7, 8, - 1, 38, 9, 10, 2, 40, 3, 4, 41, 78, - 79, 114, 80, 5, 6, 48, 7, 8, 49, 54, - 9, 55, 125, 56, 127, 128, 129, 130, 131, 132, - 57, 104, 73, 75, 76, 77, 81, 84, 123, 87, - 88, 105, 108, 109, 112, 80, 113, 121, 120, 133, - 134, 141, 144, 142, 122, 143, 145, 31, 63, 35, - 42, 111, 0, 72, 0, 0, 0, 0, 69 + 31, 40, 41, 128, 38, 105, 38, 38, 42, 43, + 128, 45, 80, 26, 31, 15, 27, 129, 31, 16, + 26, 105, 26, 103, 129, 27, 104, 26, 130, 131, + 27, 132, 128, 68, 139, 130, 131, 31, 132, 82, + 83, 151, 80, 74, 38, 38, 129, 128, 38, 123, + 28, 73, 110, 77, 77, 28, 17, 130, 131, 111, + 132, 129, 128, 152, 49, 49, 112, 53, 113, 128, + 50, 50, 114, 131, 67, 132, 129, 26, 18, 97, + 27, 115, 97, 129, 68, 67, 53, 130, 131, 120, + 132, 26, 79, 100, 27, 68, 26, 132, 23, 103, + 93, 148, 104, 19, 119, 57, 128, 39, 20, 68, + 58, 96, 67, 24, 74, 149, 1, 2, 21, 74, + 129, 3, 68, 4, 5, 22, 49, 25, 32, 46, + 6, 7, 50, 8, 9, 47, 153, 10, 11, 1, + 2, 44, 89, 90, 3, 91, 4, 5, 127, 94, + 61, 54, 94, 6, 7, 58, 8, 9, 55, 138, + 10, 140, 141, 142, 143, 144, 145, 34, 85, 62, + 26, 101, 35, 27, 58, 102, 58, 56, 86, 60, + 58, 63, 64, 65, 66, 117, 87, 88, 92, 95, + 136, 98, 99, 118, 121, 122, 125, 91, 126, 157, + 147, 134, 133, 146, 154, 33, 155, 156, 124, 158, + 135, 48, 84, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 0, 0, 81, 0, 78 }; -static const short yycheck[] = +static const yytype_int16 yycheck[] = { - 10, 3, 3, 27, 32, 15, 16, 17, 18, 3, - 20, 10, 32, 23, 16, 16, 3, 27, 42, 32, - 60, 20, 16, 63, 7, 27, 28, 10, 30, 16, - 13, 33, 42, 27, 28, 7, 30, 20, 10, 33, - 27, 28, 52, 30, 8, 7, 33, 30, 10, 8, - 14, 7, 4, 36, 10, 14, 3, 3, 10, 7, - 45, 3, 10, 35, 36, 17, 32, 19, 35, 16, - 16, 23, 36, 35, 16, 43, 44, 36, 34, 89, - 32, 27, 28, 30, 30, 10, 28, 72, 30, 10, - 7, 7, 1, 10, 10, 20, 13, 33, 66, 20, - 33, 69, 38, 20, 8, 38, 15, 10, 79, 32, - 14, 36, 5, 30, 30, 36, 9, 32, 11, 12, - 32, 24, 93, 0, 134, 18, 19, 10, 21, 22, - 5, 17, 25, 26, 9, 35, 11, 12, 35, 34, - 35, 102, 37, 18, 19, 35, 21, 22, 33, 33, - 25, 33, 113, 33, 115, 116, 117, 118, 119, 120, - 33, 10, 34, 34, 34, 34, 32, 34, 6, 34, - 34, 34, 32, 34, 32, 37, 32, 34, 37, 33, - 32, 32, 10, 33, 108, 33, 33, 12, 41, 16, - 23, 93, -1, 48, -1, -1, -1, -1, 44 + 11, 17, 18, 3, 15, 90, 17, 18, 19, 20, + 3, 22, 51, 8, 25, 33, 11, 17, 29, 33, + 8, 106, 8, 11, 17, 11, 14, 8, 28, 29, + 11, 31, 3, 21, 34, 28, 29, 48, 31, 55, + 56, 34, 81, 31, 55, 56, 17, 3, 59, 37, + 36, 37, 4, 49, 50, 36, 33, 28, 29, 11, + 31, 17, 3, 34, 9, 9, 18, 29, 20, 3, + 15, 15, 24, 29, 11, 31, 17, 8, 33, 75, + 11, 33, 78, 17, 21, 11, 48, 28, 29, 100, + 31, 8, 37, 37, 11, 21, 8, 31, 1, 11, + 37, 11, 14, 33, 35, 34, 3, 11, 33, 21, + 39, 37, 11, 16, 31, 25, 5, 6, 33, 31, + 17, 10, 21, 12, 13, 33, 9, 36, 0, 36, + 19, 20, 15, 22, 23, 36, 147, 26, 27, 5, + 6, 18, 35, 36, 10, 38, 12, 13, 115, 69, + 34, 36, 72, 19, 20, 39, 22, 23, 33, 126, + 26, 128, 129, 130, 131, 132, 133, 5, 35, 34, + 8, 34, 10, 11, 39, 34, 39, 33, 35, 34, + 39, 34, 34, 34, 34, 11, 35, 35, 33, 35, + 7, 35, 35, 35, 33, 35, 33, 38, 33, 11, + 33, 35, 38, 34, 33, 13, 34, 34, 106, 34, + 121, 25, 59, -1, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, 54, -1, 50 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { - 0, 5, 9, 11, 12, 18, 19, 21, 22, 25, - 26, 40, 41, 42, 32, 32, 32, 32, 32, 32, - 32, 1, 15, 35, 7, 10, 35, 54, 55, 59, - 0, 42, 10, 52, 59, 52, 59, 59, 17, 59, - 35, 35, 54, 8, 14, 56, 57, 55, 35, 33, - 33, 38, 53, 33, 33, 33, 33, 33, 10, 20, - 43, 44, 45, 43, 36, 30, 58, 59, 60, 58, - 36, 57, 56, 34, 59, 34, 34, 34, 34, 35, - 37, 32, 36, 44, 34, 36, 60, 34, 34, 36, - 10, 13, 45, 46, 47, 48, 60, 4, 10, 17, - 19, 23, 32, 51, 10, 34, 34, 59, 32, 34, - 36, 47, 32, 32, 51, 3, 16, 27, 28, 30, - 37, 34, 48, 6, 50, 51, 33, 51, 51, 51, - 51, 51, 51, 33, 32, 10, 24, 49, 33, 33, - 59, 32, 33, 33, 10, 33 + 0, 5, 6, 10, 12, 13, 19, 20, 22, 23, + 26, 27, 41, 42, 43, 33, 33, 33, 33, 33, + 33, 33, 33, 1, 16, 36, 8, 11, 36, 56, + 57, 61, 0, 43, 5, 10, 53, 55, 61, 11, + 53, 53, 61, 61, 18, 61, 36, 36, 56, 9, + 15, 58, 59, 57, 36, 33, 33, 34, 39, 54, + 34, 34, 34, 34, 34, 34, 34, 11, 21, 44, + 45, 46, 44, 37, 31, 60, 61, 62, 60, 37, + 59, 58, 53, 53, 55, 35, 35, 35, 35, 35, + 36, 38, 33, 37, 45, 35, 37, 62, 35, 35, + 37, 34, 34, 11, 14, 46, 47, 48, 49, 62, + 4, 11, 18, 20, 24, 33, 52, 11, 35, 35, + 61, 33, 35, 37, 48, 33, 33, 52, 3, 17, + 28, 29, 31, 38, 35, 49, 7, 51, 52, 34, + 52, 52, 52, 52, 52, 52, 34, 33, 11, 25, + 50, 34, 34, 61, 33, 34, 34, 11, 34 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -665,30 +804,63 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -709,42 +881,96 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) -# define YYDSYMPRINTF(Title, Token, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) + for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -753,45 +979,52 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -806,13 +1039,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -822,45 +1051,47 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - register const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -870,70 +1101,192 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; - + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ + if (! yyres) + return yystrlen (yystr); -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif - } - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } - switch (yytype) - { - default: - break; + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: - break; + break; } } @@ -941,13 +1294,13 @@ yydestruct (yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -956,10 +1309,10 @@ int yyparse (); -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -972,14 +1325,18 @@ int yynerrs; `----------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else @@ -990,13 +1347,19 @@ yyparse () #endif { - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif /* Three stacks and their tools: `yyss': related to states, @@ -1007,18 +1370,18 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; -#define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; @@ -1027,9 +1390,9 @@ yyparse () YYSTYPE yyval; - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1053,8 +1416,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -1067,18 +1429,18 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), @@ -1089,21 +1451,21 @@ yyparse () } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -1134,19 +1496,17 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1161,7 +1521,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1181,22 +1541,21 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -1232,430 +1591,458 @@ yyreduce: switch (yyn) { case 3: -#line 130 "/home/drepper/gnu/elfutils/src/ldscript.y" - { add_versions (yyvsp[0].version); } +#line 145 "ldscript.y" + { add_versions ((yyvsp[(2) - (2)].version)); } break; case 6: -#line 138 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 153 "ldscript.y" { if (likely (ld_state.entry == NULL)) - ld_state.entry = yyvsp[-2].str; + ld_state.entry = (yyvsp[(3) - (5)].str); } break; case 7: -#line 143 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 158 "ldscript.y" { - ld_new_searchdir (yyvsp[-2].str); + ld_new_searchdir ((yyvsp[(3) - (5)].str)); } break; case 8: -#line 147 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 162 "ldscript.y" { if (likely (ld_state.pagesize == 0)) - ld_state.pagesize = yyvsp[-2].num; + ld_state.pagesize = (yyvsp[(3) - (5)].num); } break; case 9: -#line 152 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 167 "ldscript.y" { - if (likely (ld_state.interp == NULL)) - ld_state.interp = yyvsp[-2].str; + if (likely (ld_state.interp == NULL) + && ld_state.file_type != dso_file_type) + ld_state.interp = (yyvsp[(3) - (5)].str); } break; case 10: -#line 157 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 173 "ldscript.y" { - new_segment (yyvsp[-3].num, yyvsp[-1].output_rule); + new_segment ((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].output_rule)); } break; case 11: -#line 161 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 177 "ldscript.y" { fputs_unlocked (gettext ("mode for segment invalid\n"), stderr); - new_segment (0, yyvsp[-1].output_rule); + new_segment (0, (yyvsp[(4) - (5)].output_rule)); } break; case 12: -#line 167 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 183 "ldscript.y" { /* First little optimization. If there is only one file in the group don't do anything. */ - if (yyvsp[-1].filename_list != yyvsp[-1].filename_list->next) + if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next) { - yyvsp[-1].filename_list->next->group_start = 1; - yyvsp[-1].filename_list->group_end = 1; + (yyvsp[(3) - (4)].filename_list)->next->group_start = 1; + (yyvsp[(3) - (4)].filename_list)->group_end = 1; } - add_inputfiles (yyvsp[-1].filename_list); + add_inputfiles ((yyvsp[(3) - (4)].filename_list)); } break; case 13: -#line 178 "/home/drepper/gnu/elfutils/src/ldscript.y" - { add_inputfiles (yyvsp[-1].filename_list); } +#line 194 "ldscript.y" + { add_inputfiles ((yyvsp[(3) - (4)].filename_list)); } break; case 14: -#line 180 "/home/drepper/gnu/elfutils/src/ldscript.y" - { add_versions (yyvsp[-1].version); } +#line 196 "ldscript.y" + { add_inputfiles (mark_as_needed ((yyvsp[(3) - (4)].filename_list))); } break; case 15: -#line 182 "/home/drepper/gnu/elfutils/src/ldscript.y" - { /* XXX TODO */ } +#line 198 "ldscript.y" + { add_versions ((yyvsp[(3) - (4)].version)); } break; case 16: -#line 186 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyvsp[0].output_rule->next = yyvsp[-1].output_rule->next; - yyval.output_rule = yyvsp[-1].output_rule->next = yyvsp[0].output_rule; - } +#line 200 "ldscript.y" + { /* XXX TODO */ } break; case 17: -#line 191 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.output_rule = yyvsp[0].output_rule; } +#line 204 "ldscript.y" + { + (yyvsp[(2) - (2)].output_rule)->next = (yyvsp[(1) - (2)].output_rule)->next; + (yyval.output_rule) = (yyvsp[(1) - (2)].output_rule)->next = (yyvsp[(2) - (2)].output_rule); + } break; case 18: -#line 195 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 209 "ldscript.y" + { (yyval.output_rule) = (yyvsp[(1) - (1)].output_rule); } + break; + + case 19: +#line 213 "ldscript.y" { - yyval.output_rule = new_output_rule (output_assignment); - yyval.output_rule->val.assignment = yyvsp[-1].assignment; + (yyval.output_rule) = new_output_rule (output_assignment); + (yyval.output_rule)->val.assignment = (yyvsp[(1) - (2)].assignment); } break; - case 19: -#line 200 "/home/drepper/gnu/elfutils/src/ldscript.y" + case 20: +#line 218 "ldscript.y" { - yyval.output_rule = new_output_rule (output_section); - yyval.output_rule->val.section.name = yyvsp[-3].str; - yyval.output_rule->val.section.input = yyvsp[-1].input_rule->next; + (yyval.output_rule) = new_output_rule (output_section); + (yyval.output_rule)->val.section.name = (yyvsp[(1) - (4)].str); + (yyval.output_rule)->val.section.input = (yyvsp[(3) - (4)].input_rule)->next; if (ld_state.strip == strip_debug - && ebl_debugscn_p (ld_state.ebl, yyvsp[-3].str)) - yyval.output_rule->val.section.ignored = true; + && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (4)].str))) + (yyval.output_rule)->val.section.ignored = true; else - yyval.output_rule->val.section.ignored = false; - yyvsp[-1].input_rule->next = NULL; + (yyval.output_rule)->val.section.ignored = false; + (yyvsp[(3) - (4)].input_rule)->next = NULL; } break; - case 20: -#line 212 "/home/drepper/gnu/elfutils/src/ldscript.y" + case 21: +#line 230 "ldscript.y" { /* This is a short cut for "ID { *(ID) }". */ - yyval.output_rule = new_output_rule (output_section); - yyval.output_rule->val.section.name = yyvsp[-1].str; - yyval.output_rule->val.section.input = new_input_rule (input_section); - yyval.output_rule->val.section.input->next = NULL; - yyval.output_rule->val.section.input->val.section = + (yyval.output_rule) = new_output_rule (output_section); + (yyval.output_rule)->val.section.name = (yyvsp[(1) - (2)].str); + (yyval.output_rule)->val.section.input = new_input_rule (input_section); + (yyval.output_rule)->val.section.input->next = NULL; + (yyval.output_rule)->val.section.input->val.section = (struct filemask_section_name *) obstack_alloc (&ld_state.smem, sizeof (struct filemask_section_name)); - yyval.output_rule->val.section.input->val.section->filemask = NULL; - yyval.output_rule->val.section.input->val.section->excludemask = NULL; - yyval.output_rule->val.section.input->val.section->section_name = - new_input_section_name (yyvsp[-1].str, false); - yyval.output_rule->val.section.input->val.section->keep_flag = false; + (yyval.output_rule)->val.section.input->val.section->filemask = NULL; + (yyval.output_rule)->val.section.input->val.section->excludemask = NULL; + (yyval.output_rule)->val.section.input->val.section->section_name = + new_input_section_name ((yyvsp[(1) - (2)].str), false); + (yyval.output_rule)->val.section.input->val.section->keep_flag = false; if (ld_state.strip == strip_debug - && ebl_debugscn_p (ld_state.ebl, yyvsp[-1].str)) - yyval.output_rule->val.section.ignored = true; + && ebl_debugscn_p (ld_state.ebl, (yyvsp[(1) - (2)].str))) + (yyval.output_rule)->val.section.ignored = true; else - yyval.output_rule->val.section.ignored = false; + (yyval.output_rule)->val.section.ignored = false; } break; - case 21: -#line 236 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.assignment = new_assignment (yyvsp[-2].str, yyvsp[0].expr, false); } - break; - case 22: -#line 238 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.assignment = new_assignment (yyvsp[-3].str, yyvsp[-1].expr, true); } +#line 254 "ldscript.y" + { (yyval.assignment) = new_assignment ((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].expr), false); } break; case 23: -#line 242 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyvsp[0].input_rule->next = yyvsp[-1].input_rule->next; - yyval.input_rule = yyvsp[-1].input_rule->next = yyvsp[0].input_rule; - } +#line 256 "ldscript.y" + { (yyval.assignment) = new_assignment ((yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].expr), true); } break; case 24: -#line 247 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.input_rule = yyvsp[0].input_rule; } +#line 260 "ldscript.y" + { + (yyvsp[(2) - (2)].input_rule)->next = (yyvsp[(1) - (2)].input_rule)->next; + (yyval.input_rule) = (yyvsp[(1) - (2)].input_rule)->next = (yyvsp[(2) - (2)].input_rule); + } break; case 25: -#line 251 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyval.input_rule = new_input_rule (input_section); - yyval.input_rule->val.section = yyvsp[0].filemask_section_name; - } +#line 265 "ldscript.y" + { (yyval.input_rule) = (yyvsp[(1) - (1)].input_rule); } break; case 26: -#line 256 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 269 "ldscript.y" { - yyvsp[-1].filemask_section_name->keep_flag = true; - - yyval.input_rule = new_input_rule (input_section); - yyval.input_rule->val.section = yyvsp[-1].filemask_section_name; + (yyval.input_rule) = new_input_rule (input_section); + (yyval.input_rule)->val.section = (yyvsp[(1) - (1)].filemask_section_name); } break; case 27: -#line 263 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 274 "ldscript.y" { - yyval.input_rule = new_input_rule (input_assignment); - yyval.input_rule->val.assignment = yyvsp[-1].assignment; + (yyvsp[(3) - (4)].filemask_section_name)->keep_flag = true; + + (yyval.input_rule) = new_input_rule (input_section); + (yyval.input_rule)->val.section = (yyvsp[(3) - (4)].filemask_section_name); } break; case 28: -#line 270 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 281 "ldscript.y" { - yyval.filemask_section_name = (struct filemask_section_name *) - obstack_alloc (&ld_state.smem, sizeof (*yyval.filemask_section_name)); - yyval.filemask_section_name->filemask = yyvsp[-4].str; - yyval.filemask_section_name->excludemask = yyvsp[-2].str; - yyval.filemask_section_name->section_name = yyvsp[-1].sectionname; - yyval.filemask_section_name->keep_flag = false; + (yyval.input_rule) = new_input_rule (input_assignment); + (yyval.input_rule)->val.assignment = (yyvsp[(1) - (2)].assignment); } break; case 29: -#line 281 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.sectionname = new_input_section_name (yyvsp[0].str, false); } +#line 288 "ldscript.y" + { + (yyval.filemask_section_name) = (struct filemask_section_name *) + obstack_alloc (&ld_state.smem, sizeof (*(yyval.filemask_section_name))); + (yyval.filemask_section_name)->filemask = (yyvsp[(1) - (5)].str); + (yyval.filemask_section_name)->excludemask = (yyvsp[(3) - (5)].str); + (yyval.filemask_section_name)->section_name = (yyvsp[(4) - (5)].sectionname); + (yyval.filemask_section_name)->keep_flag = false; + } break; case 30: -#line 283 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.sectionname = new_input_section_name (yyvsp[-1].str, true); } +#line 299 "ldscript.y" + { (yyval.sectionname) = new_input_section_name ((yyvsp[(1) - (1)].str), false); } break; case 31: -#line 287 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = yyvsp[-1].str; } +#line 301 "ldscript.y" + { (yyval.sectionname) = new_input_section_name ((yyvsp[(3) - (4)].str), true); } break; case 32: -#line 289 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = NULL; } +#line 305 "ldscript.y" + { (yyval.str) = (yyvsp[(3) - (4)].str); } break; case 33: -#line 293 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyval.expr = new_expr (exp_align); - yyval.expr->val.child = yyvsp[-1].expr; - } +#line 307 "ldscript.y" + { (yyval.str) = NULL; } break; case 34: -#line 298 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.expr = yyvsp[-1].expr; } +#line 311 "ldscript.y" + { + (yyval.expr) = new_expr (exp_align); + (yyval.expr)->val.child = (yyvsp[(3) - (4)].expr); + } break; case 35: -#line 300 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyval.expr = new_expr (exp_mult); - yyval.expr->val.binary.left = yyvsp[-2].expr; - yyval.expr->val.binary.right = yyvsp[0].expr; - } +#line 316 "ldscript.y" + { (yyval.expr) = (yyvsp[(2) - (3)].expr); } break; case 36: -#line 306 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 318 "ldscript.y" { - yyval.expr = new_expr (yyvsp[-1].op); - yyval.expr->val.binary.left = yyvsp[-2].expr; - yyval.expr->val.binary.right = yyvsp[0].expr; + (yyval.expr) = new_expr (exp_mult); + (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr); + (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr); } break; case 37: -#line 312 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 324 "ldscript.y" { - yyval.expr = new_expr (yyvsp[-1].op); - yyval.expr->val.binary.left = yyvsp[-2].expr; - yyval.expr->val.binary.right = yyvsp[0].expr; + (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op)); + (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr); + (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr); } break; case 38: -#line 318 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 330 "ldscript.y" { - yyval.expr = new_expr (exp_and); - yyval.expr->val.binary.left = yyvsp[-2].expr; - yyval.expr->val.binary.right = yyvsp[0].expr; + (yyval.expr) = new_expr ((yyvsp[(2) - (3)].op)); + (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr); + (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr); } break; case 39: -#line 324 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 336 "ldscript.y" { - yyval.expr = new_expr (exp_or); - yyval.expr->val.binary.left = yyvsp[-2].expr; - yyval.expr->val.binary.right = yyvsp[0].expr; + (yyval.expr) = new_expr (exp_and); + (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr); + (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr); } break; case 40: -#line 330 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 342 "ldscript.y" { - yyval.expr = new_expr (exp_num); - yyval.expr->val.num = yyvsp[0].num; + (yyval.expr) = new_expr (exp_or); + (yyval.expr)->val.binary.left = (yyvsp[(1) - (3)].expr); + (yyval.expr)->val.binary.right = (yyvsp[(3) - (3)].expr); } break; case 41: -#line 335 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 348 "ldscript.y" { - yyval.expr = new_expr (exp_id); - yyval.expr->val.str = yyvsp[0].str; + (yyval.expr) = new_expr (exp_num); + (yyval.expr)->val.num = (yyvsp[(1) - (1)].num); } break; case 42: -#line 340 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.expr = new_expr (exp_sizeof_headers); } +#line 353 "ldscript.y" + { + (yyval.expr) = new_expr (exp_id); + (yyval.expr)->val.str = (yyvsp[(1) - (1)].str); + } break; case 43: -#line 342 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.expr = new_expr (exp_pagesize); } +#line 358 "ldscript.y" + { (yyval.expr) = new_expr (exp_sizeof_headers); } break; case 44: -#line 346 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - struct filename_list *newp = new_filename_listelem (yyvsp[0].str); - newp->next = yyvsp[-2].filename_list->next; - yyval.filename_list = yyvsp[-2].filename_list->next = newp; - } +#line 360 "ldscript.y" + { (yyval.expr) = new_expr (exp_pagesize); } break; case 45: -#line 352 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.filename_list = new_filename_listelem (yyvsp[0].str); } - break; - - case 48: -#line 360 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 364 "ldscript.y" { - yyvsp[0].version->next = yyvsp[-1].version->next; - yyval.version = yyvsp[-1].version->next = yyvsp[0].version; + (yyvsp[(3) - (3)].filename_list)->next = (yyvsp[(1) - (3)].filename_list)->next; + (yyval.filename_list) = (yyvsp[(1) - (3)].filename_list)->next = (yyvsp[(3) - (3)].filename_list); } break; - case 49: -#line 365 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.version = yyvsp[0].version; } + case 46: +#line 369 "ldscript.y" + { (yyval.filename_list) = (yyvsp[(1) - (1)].filename_list); } break; - case 50: -#line 369 "/home/drepper/gnu/elfutils/src/ldscript.y" + case 49: +#line 377 "ldscript.y" { - yyvsp[-2].version->versionname = ""; - yyvsp[-2].version->parentname = NULL; - yyval.version = yyvsp[-2].version; + /* First little optimization. If there is only one + file in the group don't do anything. */ + if ((yyvsp[(3) - (4)].filename_list) != (yyvsp[(3) - (4)].filename_list)->next) + { + (yyvsp[(3) - (4)].filename_list)->next->group_start = 1; + (yyvsp[(3) - (4)].filename_list)->group_end = 1; + } + (yyval.filename_list) = (yyvsp[(3) - (4)].filename_list); } break; + case 50: +#line 388 "ldscript.y" + { (yyval.filename_list) = mark_as_needed ((yyvsp[(3) - (4)].filename_list)); } + break; + case 51: -#line 375 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - yyvsp[-2].version->versionname = yyvsp[-4].str; - yyvsp[-2].version->parentname = NULL; - yyval.version = yyvsp[-2].version; - } +#line 390 "ldscript.y" + { (yyval.filename_list) = new_filename_listelem ((yyvsp[(1) - (1)].str)); } break; case 52: -#line 381 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 395 "ldscript.y" { - yyvsp[-3].version->versionname = yyvsp[-5].str; - yyvsp[-3].version->parentname = yyvsp[-1].str; - yyval.version = yyvsp[-3].version; + (yyvsp[(2) - (2)].version)->next = (yyvsp[(1) - (2)].version)->next; + (yyval.version) = (yyvsp[(1) - (2)].version)->next = (yyvsp[(2) - (2)].version); } break; case 53: -#line 390 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.version = merge_versions (yyvsp[-1].version, yyvsp[0].version); } +#line 400 "ldscript.y" + { (yyval.version) = (yyvsp[(1) - (1)].version); } break; case 54: -#line 392 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.version = yyvsp[0].version; } +#line 404 "ldscript.y" + { + (yyvsp[(2) - (4)].version)->versionname = ""; + (yyvsp[(2) - (4)].version)->parentname = NULL; + (yyval.version) = (yyvsp[(2) - (4)].version); + } break; case 55: -#line 396 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.version = new_version (NULL, yyvsp[0].id_list); } +#line 410 "ldscript.y" + { + (yyvsp[(3) - (5)].version)->versionname = (yyvsp[(1) - (5)].str); + (yyvsp[(3) - (5)].version)->parentname = NULL; + (yyval.version) = (yyvsp[(3) - (5)].version); + } break; case 56: -#line 398 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.version = new_version (yyvsp[0].id_list, NULL); } +#line 416 "ldscript.y" + { + (yyvsp[(3) - (6)].version)->versionname = (yyvsp[(1) - (6)].str); + (yyvsp[(3) - (6)].version)->parentname = (yyvsp[(5) - (6)].str); + (yyval.version) = (yyvsp[(3) - (6)].version); + } break; case 57: -#line 403 "/home/drepper/gnu/elfutils/src/ldscript.y" - { - struct id_list *newp = new_id_listelem (yyvsp[-1].str); - newp->next = yyvsp[-2].id_list->next; - yyval.id_list = yyvsp[-2].id_list->next = newp; - } +#line 425 "ldscript.y" + { (yyval.version) = merge_versions ((yyvsp[(1) - (2)].version), (yyvsp[(2) - (2)].version)); } break; case 58: -#line 409 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.id_list = new_id_listelem (yyvsp[-1].str); } +#line 427 "ldscript.y" + { (yyval.version) = (yyvsp[(1) - (1)].version); } break; case 59: -#line 413 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = yyvsp[0].str; } +#line 431 "ldscript.y" + { (yyval.version) = new_version (NULL, (yyvsp[(2) - (2)].id_list)); } break; case 60: -#line 415 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = yyvsp[0].str; } +#line 433 "ldscript.y" + { (yyval.version) = new_version ((yyvsp[(2) - (2)].id_list), NULL); } break; case 61: -#line 419 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = yyvsp[0].str; } +#line 438 "ldscript.y" + { + struct id_list *newp = new_id_listelem ((yyvsp[(2) - (3)].str)); + newp->next = (yyvsp[(1) - (3)].id_list)->next; + (yyval.id_list) = (yyvsp[(1) - (3)].id_list)->next = newp; + } break; case 62: -#line 421 "/home/drepper/gnu/elfutils/src/ldscript.y" - { yyval.str = NULL; } +#line 444 "ldscript.y" + { (yyval.id_list) = new_id_listelem ((yyvsp[(1) - (2)].str)); } break; + case 63: +#line 448 "ldscript.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); } + break; - } + case 64: +#line 450 "ldscript.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); } + break; -/* Line 1000 of yacc.c. */ -#line 1654 "ldscript.c" - - yyvsp -= yylen; - yyssp -= yylen; + case 65: +#line 454 "ldscript.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); } + break; + case 66: +#line 456 "ldscript.y" + { (yyval.str) = NULL; } + break; + +/* Line 1267 of yacc.c. */ +#line 2040 "ldscript.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -1684,99 +2071,65 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; - int yyx; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) - { - yysize = 0; - break; - } + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); + } - if (yycount < 5) - { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif } if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) - { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + { + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } - } + YYABORT; + } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; - } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1786,15 +2139,17 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) goto yyerrorlab; -#endif - yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -1823,9 +2178,10 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - YYPOPSTACK; + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -1833,11 +2189,12 @@ yyerrlab1: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1857,25 +2214,43 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 424 "/home/drepper/gnu/elfutils/src/ldscript.y" +#line 459 "ldscript.y" static void @@ -2001,6 +2376,21 @@ new_filename_listelem (const char *string) } +static struct filename_list * +mark_as_needed (struct filename_list *listp) +{ + struct filename_list *runp = listp; + do + { + runp->as_needed = true; + runp = runp->next; + } + while (runp != listp); + + return listp; +} + + static void add_inputfiles (struct filename_list *fnames) { diff --git a/src/ldscript.h b/src/ldscript.h index 6464d8da..946ef4c6 100644 --- a/src/ldscript.h +++ b/src/ldscript.h @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 @@ -15,13 +17,21 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -31,65 +41,69 @@ enum yytokentype { kADD_OP = 258, kALIGN = 259, - kENTRY = 260, - kEXCLUDE_FILE = 261, - kFILENAME = 262, - kGLOBAL = 263, - kGROUP = 264, - kID = 265, - kINPUT = 266, - kINTERP = 267, - kKEEP = 268, - kLOCAL = 269, - kMODE = 270, - kMUL_OP = 271, - kNUM = 272, - kOUTPUT_FORMAT = 273, - kPAGESIZE = 274, - kPROVIDE = 275, - kSEARCH_DIR = 276, - kSEGMENT = 277, - kSIZEOF_HEADERS = 278, - kSORT = 279, - kVERSION = 280, - kVERSION_SCRIPT = 281, - ADD_OP = 282, - MUL_OP = 283 + kAS_NEEDED = 260, + kENTRY = 261, + kEXCLUDE_FILE = 262, + kFILENAME = 263, + kGLOBAL = 264, + kGROUP = 265, + kID = 266, + kINPUT = 267, + kINTERP = 268, + kKEEP = 269, + kLOCAL = 270, + kMODE = 271, + kMUL_OP = 272, + kNUM = 273, + kOUTPUT_FORMAT = 274, + kPAGESIZE = 275, + kPROVIDE = 276, + kSEARCH_DIR = 277, + kSEGMENT = 278, + kSIZEOF_HEADERS = 279, + kSORT = 280, + kVERSION = 281, + kVERSION_SCRIPT = 282, + ADD_OP = 283, + MUL_OP = 284 }; #endif +/* Tokens. */ #define kADD_OP 258 #define kALIGN 259 -#define kENTRY 260 -#define kEXCLUDE_FILE 261 -#define kFILENAME 262 -#define kGLOBAL 263 -#define kGROUP 264 -#define kID 265 -#define kINPUT 266 -#define kINTERP 267 -#define kKEEP 268 -#define kLOCAL 269 -#define kMODE 270 -#define kMUL_OP 271 -#define kNUM 272 -#define kOUTPUT_FORMAT 273 -#define kPAGESIZE 274 -#define kPROVIDE 275 -#define kSEARCH_DIR 276 -#define kSEGMENT 277 -#define kSIZEOF_HEADERS 278 -#define kSORT 279 -#define kVERSION 280 -#define kVERSION_SCRIPT 281 -#define ADD_OP 282 -#define MUL_OP 283 +#define kAS_NEEDED 260 +#define kENTRY 261 +#define kEXCLUDE_FILE 262 +#define kFILENAME 263 +#define kGLOBAL 264 +#define kGROUP 265 +#define kID 266 +#define kINPUT 267 +#define kINTERP 268 +#define kKEEP 269 +#define kLOCAL 270 +#define kMODE 271 +#define kMUL_OP 272 +#define kNUM 273 +#define kOUTPUT_FORMAT 274 +#define kPAGESIZE 275 +#define kPROVIDE 276 +#define kSEARCH_DIR 277 +#define kSEGMENT 278 +#define kSIZEOF_HEADERS 279 +#define kSORT 280 +#define kVERSION 281 +#define kVERSION_SCRIPT 282 +#define ADD_OP 283 +#define MUL_OP 284 -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 58 "/home/drepper/gnu/elfutils/src/ldscript.y" -typedef union YYSTYPE { +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 71 "ldscript.y" +{ uintmax_t num; enum expression_tag op; char *str; @@ -102,9 +116,10 @@ typedef union YYSTYPE { struct filename_list *filename_list; struct version *version; struct id_list *id_list; -} YYSTYPE; -/* Line 1275 of yacc.c. */ -#line 108 "ldscript.h" +} +/* Line 1489 of yacc.c. */ +#line 122 "ldscript.h" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -112,5 +127,3 @@ typedef union YYSTYPE { extern YYSTYPE ldlval; - - diff --git a/src/ldscript.y b/src/ldscript.y index 8f68078d..252f9d4b 100644 --- a/src/ldscript.y +++ b/src/ldscript.y @@ -1,17 +1,29 @@ %{ /* Parser for linker scripts. - Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -46,6 +58,7 @@ static void new_segment (int mode, struct output_rule *output_rule); static struct filename_list *new_filename_listelem (const char *string); static void add_inputfiles (struct filename_list *fnames); static struct id_list *new_id_listelem (const char *str); + static struct filename_list *mark_as_needed (struct filename_list *listp); static struct version *new_version (struct id_list *local, struct id_list *global); static struct version *merge_versions (struct version *one, @@ -72,6 +85,7 @@ extern int yylex (void); %token kADD_OP %token kALIGN +%token kAS_NEEDED %token kENTRY %token kEXCLUDE_FILE %token <str> kFILENAME @@ -114,6 +128,7 @@ extern int yylex (void); %type <output_rule> outputsections %type <assignment> assignment %type <filename_list> filename_id_list +%type <filename_list> filename_id_listelem %type <version> versionlist %type <version> version %type <version> version_stmt_list @@ -150,7 +165,8 @@ content: kENTRY '(' kID ')' ';' } | kINTERP '(' filename_id ')' ';' { - if (likely (ld_state.interp == NULL)) + if (likely (ld_state.interp == NULL) + && ld_state.file_type != dso_file_type) ld_state.interp = $3; } | kSEGMENT kMODE '{' outputsections '}' @@ -176,6 +192,8 @@ content: kENTRY '(' kID ')' ';' } | kINPUT '(' filename_id_list ')' { add_inputfiles ($3); } + | kAS_NEEDED '(' filename_id_list ')' + { add_inputfiles (mark_as_needed ($3)); } | kVERSION '{' versionlist '}' { add_versions ($3); } | kOUTPUT_FORMAT '(' filename_id ')' @@ -342,20 +360,37 @@ expr: kALIGN '(' expr ')' { $$ = new_expr (exp_pagesize); } ; -filename_id_list: filename_id_list comma_opt filename_id +filename_id_list: filename_id_list comma_opt filename_id_listelem { - struct filename_list *newp = new_filename_listelem ($3); - newp->next = $1->next; - $$ = $1->next = newp; + $3->next = $1->next; + $$ = $1->next = $3; } - | filename_id - { $$ = new_filename_listelem ($1); } + | filename_id_listelem + { $$ = $1; } ; comma_opt: ',' | ; +filename_id_listelem: kGROUP '(' filename_id_list ')' + { + /* First little optimization. If there is only one + file in the group don't do anything. */ + if ($3 != $3->next) + { + $3->next->group_start = 1; + $3->group_end = 1; + } + $$ = $3; + } + | kAS_NEEDED '(' filename_id_list ')' + { $$ = mark_as_needed ($3); } + | filename_id + { $$ = new_filename_listelem ($1); } + ; + + versionlist: versionlist version { $2->next = $1->next; @@ -546,6 +581,21 @@ new_filename_listelem (const char *string) } +static struct filename_list * +mark_as_needed (struct filename_list *listp) +{ + struct filename_list *runp = listp; + do + { + runp->as_needed = true; + runp = runp->next; + } + while (runp != listp); + + return listp; +} + + static void add_inputfiles (struct filename_list *fnames) { diff --git a/src/make-debug-archive.in b/src/make-debug-archive.in new file mode 100644 index 00000000..c3fcbce4 --- /dev/null +++ b/src/make-debug-archive.in @@ -0,0 +1,132 @@ +#!/bin/sh +# +# Script to make an offline archive for debugging with libdwfl-based tools. +# +# make-debug-archive ARCHIVE {options} +# make-debug-archive --kernel [--force] [RELEASE] +# +# Valid options are those listed under 'Input selection options' +# by running @UNSTRIP@ --help. +# +# The archive installed by --kernel be used automatically by -K. +# An offline archive can be used via -e in any tool that accepts those options. +# + +UNSTRIP=${UNSTRIP:-@UNSTRIP@} +AR=${AR:-@AR@} +SUDO=${SUDO:-/usr/bin/sudo} + +LS=/bin/ls +RM=/bin/rm +MV=/bin/mv +MKDIR=/bin/mkdir +XARGS=/usr/bin/xargs + +outdir=${TMPDIR:-/tmp}/debugar$$ + +usage() +{ + echo "Usage: $0 ARCHIVE {options}" + echo " or: $0 --kernel [--sudo] [--force] [RELEASE]" + echo + echo "Valid options are listed under 'Input selection options'" + echo "when running: $UNSTRIP --help" + echo + echo "The --kernel form updates the file used by -K if the" + echo "kernel installation has changed, or always with --force." + echo "With --sudo, touches the installed file via $SUDO." +} + +fatal_usage() +{ + usage >&2 + exit 2 +} + +script_version() +{ + echo "`basename $0` (@PACKAGE_NAME@) @PACKAGE_VERSION@" + echo "Copyright (C) 2007 Red Hat, Inc." + echo "This is free software; see the source for copying conditions." + echo "There is NO warranty; not even for MERCHANTABILITY or" + echo "FITNESS FOR A PARTICULAR PURPOSE." + echo "Written by Roland McGrath." +} + +sudo= +kernel=no +force_kernel=no +while [ $# -gt 0 ]; do + case "x$1" in + x--help) usage; exit 0 ;; + x--version) script_version; exit 0 ;; + x--kernel) kernel=yes ;; + x--force) force_kernel=yes ;; + x--sudo) sudo=$SUDO ;; + *) break ;; + esac + shift +done + +if [ $kernel = no ] && [ $force_kernel = yes -o -n "$sudo" ]; then + usage +fi + +if [ $kernel = yes ]; then + if [ $# -eq 0 ]; then + release=`uname -r` + elif [ $# -eq 1 ]; then + release=$1 + else + fatal_usage + fi + + dir=/usr/lib/debug/lib/modules/$release + archive=$dir/debug.a + dep=/lib/modules/$release/modules.dep + + if [ ! -d $dir ]; then + echo >&2 "$0: $dir not installed" + exit 1 + fi + + # Without --force, bail if the kernel installation is not newer. + # This file is normally touched by installing new kernels or modules. + if [ $force_kernel = no -a "$archive" -nt "$dep" ]; then + exit 0 + fi + + # We have to kill the old one first, because our own -K would use it. + [ ! -e "$archive" ] || $sudo $RM -f "$archive" || exit + + set "$archive" "-K$release" +fi + +if [ $# -lt 2 ]; then + fatal_usage +fi + +archive="$1" +shift + +case "$archive" in +/*) ;; +*) archive="`/bin/pwd`/$archive" ;; +esac + +if [ -z "$sudo" ]; then + new_archive="$archive.new" +else + new_archive="$outdir.a" +fi + +$RM -f "$new_archive" || exit + +trap '$RM -rf "$outdir" "$new_archive"' 0 1 2 15 + +$MKDIR "$outdir" && +$UNSTRIP -d "$outdir" -m -a -R "$@" && +(cd "$outdir" && $LS | $XARGS $AR cq "$new_archive") && +$sudo $MV -f "$new_archive" "$archive" + +exit @@ -1,16 +1,28 @@ -/* Print information from ELF file in human-readable form. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Print symbol information from ELF file in human-readable form. + Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -27,7 +39,6 @@ #include <gelf.h> #include <inttypes.h> #include <libdw.h> -#include <libebl.h> #include <libintl.h> #include <locale.h> #include <mcheck.h> @@ -42,12 +53,16 @@ #include <sys/param.h> #include <system.h> +#include "../libebl/libeblP.h" /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + /* Values for the parameters which have no short form. */ #define OPT_DEFINED 0x100 @@ -98,13 +113,10 @@ static const char args_doc[] = N_("[FILE...]"); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp = { - options, parse_opt, args_doc, doc, NULL, more_help, NULL + options, parse_opt, args_doc, doc, NULL, NULL, NULL }; @@ -122,7 +134,7 @@ static int handle_elf (Elf *elf, const char *prefix, const char *fname, #define INTERNAL_ERROR(fname) \ error (EXIT_FAILURE, 0, gettext ("%s: INTERNAL ERROR %d (%s-%s): %s"), \ - fname, __LINE__, VERSION, __DATE__, elf_errmsg (-1)) + fname, __LINE__, PACKAGE_VERSION, __DATE__, elf_errmsg (-1)) /* Internal representation of symbols. */ @@ -205,10 +217,10 @@ main (int argc, char *argv[]) (void) setlocale (LC_ALL, ""); /* Make sure the message catalog can be found. */ - (void) bindtextdomain (PACKAGE, LOCALEDIR); + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); /* Initialize the message catalog. */ - (void) textdomain (PACKAGE); + (void) textdomain (PACKAGE_TARNAME); /* Parse and process arguments. */ (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); @@ -235,21 +247,22 @@ main (int argc, char *argv[]) /* Print the version information. */ static void -print_version (FILE *stream, /*@unused@*/ struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "nm (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "nm (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } /* Handle program arguments. */ static error_t -parse_opt (int key, char *arg, /*@unused@*/ struct argp_state *state) +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) { switch (key) { @@ -339,27 +352,6 @@ parse_opt (int key, char *arg, /*@unused@*/ struct argp_state *state) } -static char * -more_help (int key, const char *text, /*@unused@*/ void *input) -{ - char *buf; - - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - - default: - break; - } - return (char *) text; -} - - /* Open the file and determine the type. */ static int process_file (const char *fname, bool more_than_one) @@ -368,7 +360,7 @@ process_file (const char *fname, bool more_than_one) int fd = open (fname, O_RDONLY); if (fd == -1) { - error (0, errno, fname); + error (0, errno, gettext ("cannot open '%s'"), fname); return 1; } @@ -385,7 +377,7 @@ process_file (const char *fname, bool more_than_one) INTERNAL_ERROR (fname); if (close (fd) != 0) - error (EXIT_FAILURE, errno, gettext ("while close `%s'"), fname); + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); return result; } @@ -397,7 +389,7 @@ process_file (const char *fname, bool more_than_one) INTERNAL_ERROR (fname); if (close (fd) != 0) - error (EXIT_FAILURE, errno, gettext ("while close `%s'"), fname); + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); return result; } @@ -527,13 +519,6 @@ static const int length_map[2][3] = }; -struct global_name -{ - Dwarf_Global global; - const char *name; -}; - - static int global_compare (const void *p1, const void *p2) { @@ -548,7 +533,8 @@ static void *global_root; static int -get_global (Dwarf *dbg, Dwarf_Global *global, void *arg) +get_global (Dwarf *dbg __attribute__ ((unused)), Dwarf_Global *global, + void *arg __attribute__ ((unused))) { tsearch (memcpy (xmalloc (sizeof (Dwarf_Global)), global, sizeof (Dwarf_Global)), @@ -608,9 +594,9 @@ get_var_range (Dwarf_Die *die, Dwarf_Word *lowpc, Dwarf_Word *highpc) if (locattr == NULL) return 1; - Dwarf_Loc *loc; + Dwarf_Op *loc; size_t nloc; - if (dwarf_getloclist (locattr, &loc, &nloc) != 0) + if (dwarf_getlocation (locattr, &loc, &nloc) != 0) return 1; /* Interpret the location expressions. */ @@ -630,7 +616,7 @@ static void *local_root; static void -get_local_names (Ebl *ebl, Dwarf *dbg) +get_local_names (Dwarf *dbg) { Dwarf_Off offset = 0; Dwarf_Off old_offset; @@ -717,6 +703,18 @@ get_local_names (Ebl *ebl, Dwarf *dbg) } } +/* Do elf_strptr, but return a backup string and never NULL. */ +static const char * +sym_name (Elf *elf, GElf_Word strndx, GElf_Word st_name, char buf[], size_t n) +{ + const char *symstr = elf_strptr (elf, strndx, st_name); + if (symstr == NULL) + { + snprintf (buf, n, "[invalid st_name %#" PRIx32 "]", st_name); + symstr = buf; + } + return symstr; +} /* Show symbols in SysV format. */ static void @@ -750,9 +748,15 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, assert (elf_ndxscn (scn) == cnt++); - scnnames[elf_ndxscn (scn)] - = elf_strptr (ebl->elf, shstrndx, - gelf_getshdr (scn, &shdr_mem)->sh_name); + char *name = elf_strptr (ebl->elf, shstrndx, + gelf_getshdr (scn, &shdr_mem)->sh_name); + if (unlikely (name == NULL)) + { + name = alloca (sizeof "[invalid sh_name 0x12345678]"); + snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]", + gelf_getshdr (scn, &shdr_mem)->sh_name); + } + scnnames[elf_ndxscn (scn)] = name; } int digits = length_map[gelf_getclass (ebl->elf) - 1][radix]; @@ -786,8 +790,10 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, /* Iterate over all symbols. */ for (cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (ebl->elf, strndx, - syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (ebl->elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); + char symbindbuf[50]; char symtypebuf[50]; char secnamebuf[1024]; @@ -839,7 +845,7 @@ class_type_char (GElf_Sym *sym) static void -show_symbols_bsd (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, +show_symbols_bsd (Elf *elf, GElf_Word strndx, const char *prefix, const char *fname, const char *fullname, GElf_SymX *syms, size_t nsyms) { @@ -864,7 +870,9 @@ show_symbols_bsd (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, /* Iterate over all symbols. */ for (size_t cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (elf, strndx, syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); /* Printing entries with a zero-length name makes the output not very well parseable. Since these entries don't carry @@ -886,7 +894,7 @@ show_symbols_bsd (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, ? (GELF_ST_BIND (syms[cnt].sym.st_info) == STB_WEAK ? "*" : " ") : "", - elf_strptr (elf, strndx, syms[cnt].sym.st_name)); + symstr); else printf (print_size ? sfmtstrs[radix] : fmtstrs[radix], digits, syms[cnt].sym.st_value, @@ -895,15 +903,14 @@ show_symbols_bsd (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, ? (GELF_ST_BIND (syms[cnt].sym.st_info) == STB_WEAK ? "*" : " ") : "", - elf_strptr (elf, strndx, syms[cnt].sym.st_name), + symstr, digits, (uint64_t) syms[cnt].sym.st_size); } } static void -show_symbols_posix (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, - const char *prefix, const char *fname, +show_symbols_posix (Elf *elf, GElf_Word strndx, const char *prefix, const char *fullname, GElf_SymX *syms, size_t nsyms) { if (prefix != NULL && ! print_file_name) @@ -922,7 +929,9 @@ show_symbols_posix (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, /* Iterate over all symbols. */ for (size_t cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (elf, strndx, syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); /* Printing entries with a zero-length name makes the output not very well parseable. Since these entries don't carry @@ -953,34 +962,39 @@ show_symbols_posix (Elf *elf, GElf_Ehdr *ehdr, GElf_Word strndx, /* Maximum size of memory we allocate on the stack. */ #define MAX_STACK_ALLOC 65536 -static void -show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, - GElf_Shdr *shdr, const char *prefix, const char *fname, - const char *fullname) +static int +sort_by_address (const void *p1, const void *p2) { - int sort_by_name (const void *p1, const void *p2) - { - GElf_SymX *s1 = (GElf_SymX *) p1; - GElf_SymX *s2 = (GElf_SymX *) p2; - int result; + GElf_SymX *s1 = (GElf_SymX *) p1; + GElf_SymX *s2 = (GElf_SymX *) p2; - result = strcmp (elf_strptr (ebl->elf, shdr->sh_link, s1->sym.st_name), - elf_strptr (ebl->elf, shdr->sh_link, s2->sym.st_name)); + int result = (s1->sym.st_value < s2->sym.st_value + ? -1 : (s1->sym.st_value == s2->sym.st_value ? 0 : 1)); - return reverse_sort ? -result : result; - } + return reverse_sort ? -result : result; +} - int sort_by_address (const void *p1, const void *p2) - { - GElf_SymX *s1 = (GElf_SymX *) p1; - GElf_SymX *s2 = (GElf_SymX *) p2; +static Elf_Data *sort_by_name_strtab; - int result = (s1->sym.st_value < s2->sym.st_value - ? -1 : (s1->sym.st_value == s2->sym.st_value ? 0 : 1)); +static int +sort_by_name (const void *p1, const void *p2) +{ + GElf_SymX *s1 = (GElf_SymX *) p1; + GElf_SymX *s2 = (GElf_SymX *) p2; - return reverse_sort ? -result : result; - } + const char *n1 = sort_by_name_strtab->d_buf + s1->sym.st_name; + const char *n2 = sort_by_name_strtab->d_buf + s2->sym.st_name; + int result = strcmp (n1, n2); + + return reverse_sort ? -result : result; +} + +static void +show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, + GElf_Shdr *shdr, const char *prefix, const char *fname, + const char *fullname) +{ /* Get the section header string table index. */ size_t shstrndx; if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) @@ -1021,7 +1035,7 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, { (void) dwarf_getpubnames (dbg, get_global, NULL, 0); - get_local_names (ebl, dbg); + get_local_names (dbg); } } @@ -1066,6 +1080,8 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, { const char *symstr = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); + if (symstr == NULL) + continue; longest_name = MAX ((size_t) longest_name, strlen (symstr)); @@ -1157,7 +1173,11 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, /* Sort the entries according to the users wishes. */ if (sort == sort_name) - qsort (sym_mem, nentries, sizeof (GElf_SymX), sort_by_name); + { + sort_by_name_strtab = elf_getdata (elf_getscn (ebl->elf, shdr->sh_link), + NULL); + qsort (sym_mem, nentries, sizeof (GElf_SymX), sort_by_name); + } else if (sort == sort_numeric) qsort (sym_mem, nentries, sizeof (GElf_SymX), sort_by_address); @@ -1171,15 +1191,15 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, break; case format_bsd: - show_symbols_bsd (ebl->elf, ehdr, shdr->sh_link, prefix, fname, - fullname, sym_mem, nentries); + show_symbols_bsd (ebl->elf, shdr->sh_link, prefix, fname, fullname, + sym_mem, nentries); break; case format_posix: default: assert (format == format_posix); - show_symbols_posix (ebl->elf, ehdr, shdr->sh_link, prefix, fname, - fullname, sym_mem, nentries); + show_symbols_posix (ebl->elf, shdr->sh_link, prefix, fullname, sym_mem, + nentries); break; } @@ -1300,3 +1320,6 @@ handle_elf (Elf *elf, const char *prefix, const char *fname, return result; } + + +#include "debugpred.h" diff --git a/src/objdump.c b/src/objdump.c new file mode 100644 index 00000000..91fa8750 --- /dev/null +++ b/src/objdump.c @@ -0,0 +1,815 @@ +/* Print information from ELF file in human-readable form. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <error.h> +#include <fcntl.h> +#include <inttypes.h> +#include <libintl.h> +#include <locale.h> +#include <mcheck.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/param.h> + +#include <system.h> +#include "../libebl/libeblP.h" + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Mode selection:"), 0 }, + { "reloc", 'r', NULL, 0, N_("Display relocation information."), 0 }, + { "full-contents", 's', NULL, 0, + N_("Display the full contents of all sections requested"), 0 }, + { "disassemble", 'd', NULL, 0, + N_("Display assembler code of executable sections"), 0 }, + + { NULL, 0, NULL, 0, N_("Output option selection:"), 0 }, + { "section", 'j', "NAME", 0, + N_("Only display information for section NAME."), 0 }, + + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("\ +Show information from FILEs (a.out by default)."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[FILE...]"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + options, parse_opt, args_doc, doc, NULL, NULL, NULL +}; + + +/* Print symbols in file named FNAME. */ +static int process_file (const char *fname, bool more_than_one); + +/* Handle content of archive. */ +static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, + const char *suffix); + +/* Handle ELF file. */ +static int handle_elf (Elf *elf, const char *prefix, const char *fname, + const char *suffix); + + +#define INTERNAL_ERROR(fname) \ + error (EXIT_FAILURE, 0, gettext ("%s: INTERNAL ERROR %d (%s-%s): %s"), \ + fname, __LINE__, PACKAGE_VERSION, __DATE__, elf_errmsg (-1)) + + +/* List of sections which should be used. */ +static struct section_list +{ + bool is_name; + union + { + const char *name; + uint32_t scnndx; + }; + struct section_list *next; +} *section_list; + + +/* If true print archive index. */ +static bool print_relocs; + +/* If true print full contents of requested sections. */ +static bool print_full_content; + +/* If true print disassembled output.. */ +static bool print_disasm; + +int +main (int argc, char *argv[]) +{ + /* Make memory leak detection possible. */ + mtrace (); + + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stderr, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + int remaining; + (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + /* Tell the library which version we are expecting. */ + (void) elf_version (EV_CURRENT); + + int result = 0; + if (remaining == argc) + /* The user didn't specify a name so we use a.out. */ + result = process_file ("a.out", false); + else + { + /* Process all the remaining files. */ + const bool more_than_one = remaining + 1 < argc; + + do + result |= process_file (argv[remaining], more_than_one); + while (++remaining < argc); + } + + return result; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "objdump (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) +{ + /* True if any of the control options is set. */ + static bool any_control_option; + + switch (key) + { + case 'j': + { + struct section_list *newp = xmalloc (sizeof (*newp)); + char *endp; + newp->scnndx = strtoul (arg, &endp, 0); + if (*endp == 0) + newp->is_name = false; + else + { + newp->name = arg; + newp->is_name = true; + } + newp->next = section_list; + section_list = newp; + } + any_control_option = true; + break; + + case 'd': + print_disasm = true; + any_control_option = true; + break; + + case 'r': + print_relocs = true; + any_control_option = true; + break; + + case 's': + print_full_content = true; + any_control_option = true; + break; + + case ARGP_KEY_FINI: + if (! any_control_option) + { + fputs (gettext ("No operation specified.\n"), stderr); + argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, + program_invocation_short_name); + exit (1); + } + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +/* Open the file and determine the type. */ +static int +process_file (const char *fname, bool more_than_one) +{ + /* Open the file. */ + int fd = open (fname, O_RDONLY); + if (fd == -1) + { + error (0, errno, gettext ("cannot open %s"), fname); + return 1; + } + + /* Now get the ELF descriptor. */ + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf != NULL) + { + if (elf_kind (elf) == ELF_K_ELF) + { + int result = handle_elf (elf, more_than_one ? "" : NULL, + fname, NULL); + + if (elf_end (elf) != 0) + INTERNAL_ERROR (fname); + + if (close (fd) != 0) + error (EXIT_FAILURE, errno, gettext ("while close `%s'"), fname); + + return result; + } + else if (elf_kind (elf) == ELF_K_AR) + { + int result = handle_ar (fd, elf, NULL, fname, NULL); + + if (elf_end (elf) != 0) + INTERNAL_ERROR (fname); + + if (close (fd) != 0) + error (EXIT_FAILURE, errno, gettext ("while close `%s'"), fname); + + return result; + } + + /* We cannot handle this type. Close the descriptor anyway. */ + if (elf_end (elf) != 0) + INTERNAL_ERROR (fname); + } + + error (0, 0, gettext ("%s: File format not recognized"), fname); + + return 1; +} + + +static int +handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, + const char *suffix) +{ + size_t fname_len = strlen (fname) + 1; + size_t prefix_len = prefix != NULL ? strlen (prefix) : 0; + char new_prefix[prefix_len + fname_len + 2]; + size_t suffix_len = suffix != NULL ? strlen (suffix) : 0; + char new_suffix[suffix_len + 2]; + Elf *subelf; + Elf_Cmd cmd = ELF_C_READ_MMAP; + int result = 0; + + char *cp = new_prefix; + if (prefix != NULL) + cp = stpcpy (cp, prefix); + cp = stpcpy (cp, fname); + stpcpy (cp, "["); + + cp = new_suffix; + if (suffix != NULL) + cp = stpcpy (cp, suffix); + stpcpy (cp, "]"); + + /* Process all the files contained in the archive. */ + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + /* Skip over the index entries. */ + if (strcmp (arhdr->ar_name, "/") != 0 + && strcmp (arhdr->ar_name, "//") != 0) + { + if (elf_kind (subelf) == ELF_K_ELF) + result |= handle_elf (subelf, new_prefix, arhdr->ar_name, + new_suffix); + else if (elf_kind (subelf) == ELF_K_AR) + result |= handle_ar (fd, subelf, new_prefix, arhdr->ar_name, + new_suffix); + else + { + error (0, 0, gettext ("%s%s%s: file format not recognized"), + new_prefix, arhdr->ar_name, new_suffix); + result = 1; + } + } + + /* Get next archive element. */ + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + INTERNAL_ERROR (fname); + } + + return result; +} + + +static void +show_relocs_rel (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, + Elf_Data *symdata, Elf_Data *xndxdata, size_t symstrndx, + size_t shstrndx) +{ + int elfclass = gelf_getclass (ebl->elf); + int nentries = shdr->sh_size / shdr->sh_entsize; + + for (int cnt = 0; cnt < nentries; ++cnt) + { + GElf_Rel relmem; + GElf_Rel *rel; + + rel = gelf_getrel (data, cnt, &relmem); + if (rel != NULL) + { + char buf[128]; + GElf_Sym symmem; + GElf_Sym *sym; + Elf32_Word xndx; + + sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), + &symmem, &xndx); + if (sym == NULL) + printf ("%0*" PRIx64 " %-20s <%s %ld>\n", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + gettext ("INVALID SYMBOL"), + (long int) GELF_R_SYM (rel->r_info)); + else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) + printf ("%0*" PRIx64 " %-20s %s\n", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + elf_strptr (ebl->elf, symstrndx, sym->st_name)); + else + { + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr; + destshdr = gelf_getshdr (elf_getscn (ebl->elf, + sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx), + &destshdr_mem); + + if (shdr == NULL) + printf ("%0*" PRIx64 " %-20s <%s %ld>\n", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + gettext ("INVALID SECTION"), + (long int) (sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx)); + else + printf ("%0*" PRIx64 " %-20s %s\n", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + elf_strptr (ebl->elf, shstrndx, destshdr->sh_name)); + } + } + } +} + + +static void +show_relocs_rela (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, + Elf_Data *symdata, Elf_Data *xndxdata, size_t symstrndx, + size_t shstrndx) +{ + int elfclass = gelf_getclass (ebl->elf); + int nentries = shdr->sh_size / shdr->sh_entsize; + + for (int cnt = 0; cnt < nentries; ++cnt) + { + GElf_Rela relmem; + GElf_Rela *rel; + + rel = gelf_getrela (data, cnt, &relmem); + if (rel != NULL) + { + char buf[128]; + GElf_Sym symmem; + GElf_Sym *sym; + Elf32_Word xndx; + + sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), + &symmem, &xndx); + if (sym == NULL) + printf ("%0*" PRIx64 " %-20s <%s %ld>", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + gettext ("INVALID SYMBOL"), + (long int) GELF_R_SYM (rel->r_info)); + else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) + printf ("%0*" PRIx64 " %-20s %s", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + elf_strptr (ebl->elf, symstrndx, sym->st_name)); + else + { + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr; + destshdr = gelf_getshdr (elf_getscn (ebl->elf, + sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx), + &destshdr_mem); + + if (shdr == NULL) + printf ("%0*" PRIx64 " %-20s <%s %ld>", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + gettext ("INVALID SECTION"), + (long int) (sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx)); + else + printf ("%0*" PRIx64 " %-20s %s", + elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, + ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), + buf, sizeof (buf)) + : gettext ("<INVALID RELOC>"), + elf_strptr (ebl->elf, shstrndx, destshdr->sh_name)); + } + + if (rel->r_addend != 0) + printf ("+%#" PRIx64, rel->r_addend); + putchar ('\n'); + } + } +} + + +static bool +section_match (Elf *elf, uint32_t scnndx, GElf_Shdr *shdr, size_t shstrndx) +{ + if (section_list == NULL) + return true; + + struct section_list *runp = section_list; + + do + { + if (runp->is_name) + { + if (strcmp (runp->name, + elf_strptr (elf, shstrndx, shdr->sh_name)) == 0) + return true; + } + else + { + if (runp->scnndx == scnndx) + return true; + } + + runp = runp->next; + } + while (runp != NULL); + + return false; +} + + +static int +show_relocs (Ebl *ebl, const char *fname, uint32_t shstrndx) +{ + int elfclass = gelf_getclass (ebl->elf); + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL) + INTERNAL_ERROR (fname); + + if (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA) + { + if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx)) + continue; + + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr = gelf_getshdr (elf_getscn (ebl->elf, + shdr->sh_info), + &destshdr_mem); + + printf (gettext ("RELOCATION RECORDS FOR [%s]:\n" + "%-*s TYPE VALUE\n"), + elf_strptr (ebl->elf, shstrndx, destshdr->sh_name), + elfclass == ELFCLASS32 ? 8 : 16, gettext ("OFFSET")); + + /* Get the data of the section. */ + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + continue; + + /* Get the symbol table information. */ + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); + Elf_Data *symdata = elf_getdata (symscn, NULL); + + /* Search for the optional extended section index table. */ + Elf_Data *xndxdata = NULL; + Elf_Scn *xndxscn = NULL; + while ((xndxscn = elf_nextscn (ebl->elf, xndxscn)) != NULL) + { + GElf_Shdr xndxshdr_mem; + GElf_Shdr *xndxshdr; + + xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem); + if (xndxshdr != NULL && xndxshdr->sh_type == SHT_SYMTAB_SHNDX + && xndxshdr->sh_link == elf_ndxscn (symscn)) + { + /* Found it. */ + xndxdata = elf_getdata (xndxscn, NULL); + break; + } + } + + if (shdr->sh_type == SHT_REL) + show_relocs_rel (ebl, shdr, data, symdata, xndxdata, + symshdr->sh_link, shstrndx); + else + show_relocs_rela (ebl, shdr, data, symdata, xndxdata, + symshdr->sh_link, shstrndx); + } + } + + fputs_unlocked ("\n\n", stdout); + + return 0; +} + + +static int +show_full_content (Ebl *ebl, const char *fname, uint32_t shstrndx) +{ + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL) + INTERNAL_ERROR (fname); + + if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size > 0) + { + if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx)) + continue; + + printf (gettext ("Contents of section %s:\n"), + elf_strptr (ebl->elf, shstrndx, shdr->sh_name)); + + /* Get the data of the section. */ + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + continue; + + unsigned char *cp = data->d_buf; + size_t cnt; + for (cnt = 0; cnt + 16 < data->d_size; cp += 16, cnt += 16) + { + printf (" %04zx ", cnt); + + for (size_t inner = 0; inner < 16; inner += 4) + printf ("%02hhx%02hhx%02hhx%02hhx ", + cp[inner], cp[inner + 1], cp[inner + 2], + cp[inner + 3]); + fputc_unlocked (' ', stdout); + + for (size_t inner = 0; inner < 16; ++inner) + fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner]) + ? cp[inner] : '.', stdout); + fputc_unlocked ('\n', stdout); + } + + printf (" %04zx ", cnt); + + size_t remaining = data->d_size - cnt; + size_t inner; + for (inner = 0; inner + 4 <= remaining; inner += 4) + printf ("%02hhx%02hhx%02hhx%02hhx ", + cp[inner], cp[inner + 1], cp[inner + 2], cp[inner + 3]); + + for (; inner < remaining; ++inner) + printf ("%02hhx", cp[inner]); + + for (inner = 2 * (16 - inner) + (16 - inner + 3) / 4 + 1; inner > 0; + --inner) + fputc_unlocked (' ', stdout); + + for (inner = 0; inner < remaining; ++inner) + fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner]) + ? cp[inner] : '.', stdout); + fputc_unlocked ('\n', stdout); + + fputc_unlocked ('\n', stdout); + } + } + + return 0; +} + + +struct disasm_info +{ + GElf_Addr addr; + const uint8_t *cur; + const uint8_t *last_end; +}; + + +// XXX This is not the preferred output for all architectures. Needs +// XXX customization, too. +static int +disasm_output (char *buf, size_t buflen, void *arg) +{ + struct disasm_info *info = (struct disasm_info *) arg; + + printf ("%8" PRIx64 ": ", (uint64_t) info->addr); + size_t cnt; + for (cnt = 0; cnt < (size_t) MIN (info->cur - info->last_end, 8); ++cnt) + printf (" %02" PRIx8, info->last_end[cnt]); + printf ("%*s %.*s\n", + (int) (8 - cnt) * 3 + 1, "", (int) buflen, buf); + + info->addr += cnt; + + /* We limit the number of bytes printed before the mnemonic to 8. + Print the rest on a separate, following line. */ + if (info->cur - info->last_end > 8) + { + printf ("%8" PRIx64 ": ", (uint64_t) info->addr); + for (; cnt < (size_t) (info->cur - info->last_end); ++cnt) + printf (" %02" PRIx8, info->last_end[cnt]); + putchar_unlocked ('\n'); + info->addr += info->cur - info->last_end - 8; + } + + info->last_end = info->cur; + + return 0; +} + + +static int +show_disasm (Ebl *ebl, const char *fname, uint32_t shstrndx) +{ + DisasmCtx_t *ctx = disasm_begin (ebl, ebl->elf, NULL /* XXX TODO */); + if (ctx == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot disassemble")); + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL) + INTERNAL_ERROR (fname); + + if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size > 0 + && (shdr->sh_flags & SHF_EXECINSTR) != 0) + { + if (! section_match (ebl->elf, elf_ndxscn (scn), shdr, shstrndx)) + continue; + + Elf_Data *data = elf_getdata (scn, NULL); + if (data == NULL) + continue; + + printf ("Disassembly of section %s:\n\n", + elf_strptr (ebl->elf, shstrndx, shdr->sh_name)); + + struct disasm_info info; + info.addr = shdr->sh_addr; + info.last_end = info.cur = data->d_buf; + + disasm_cb (ctx, &info.cur, info.cur + data->d_size, info.addr, + "%7m %.1o,%.2o,%.3o%34a %l", disasm_output, &info, + NULL /* XXX */); + } + } + + (void) disasm_end (ctx); + + return 0; +} + + +static int +handle_elf (Elf *elf, const char *prefix, const char *fname, + const char *suffix) +{ + + /* Get the backend for this object file type. */ + Ebl *ebl = ebl_openbackend (elf); + + printf ("%s: elf%d-%s\n\n", + fname, gelf_getclass (elf) == ELFCLASS32 ? 32 : 64, + ebl_backend_name (ebl)); + + /* Create the full name of the file. */ + size_t prefix_len = prefix == NULL ? 0 : strlen (prefix); + size_t suffix_len = suffix == NULL ? 0 : strlen (suffix); + size_t fname_len = strlen (fname) + 1; + char fullname[prefix_len + 1 + fname_len + suffix_len]; + char *cp = fullname; + if (prefix != NULL) + cp = mempcpy (cp, prefix, prefix_len); + cp = mempcpy (cp, fname, fname_len); + if (suffix != NULL) + memcpy (cp - 1, suffix, suffix_len + 1); + + /* Get the section header string table index. */ + size_t shstrndx; + if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + int result = 0; + if (print_disasm) + result = show_disasm (ebl, fullname, shstrndx); + if (print_relocs && !print_disasm) + result = show_relocs (ebl, fullname, shstrndx); + if (print_full_content) + result = show_full_content (ebl, fullname, shstrndx); + + /* Close the ELF backend library descriptor. */ + ebl_closebackend (ebl); + + return result; +} + + +#include "debugpred.h" diff --git a/src/ranlib.c b/src/ranlib.c new file mode 100644 index 00000000..a915e558 --- /dev/null +++ b/src/ranlib.c @@ -0,0 +1,309 @@ +/* Generate an index to speed access to archives. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <ar.h> +#include <argp.h> +#include <assert.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <libintl.h> +#include <locale.h> +#include <mcheck.h> +#include <obstack.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/param.h> +#include <sys/stat.h> + +#include <system.h> + +#include "arlib.h" + + +/* Prototypes for local functions. */ +static int handle_file (const char *fname); + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("Generate an index to speed access to archives."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("ARCHIVE"); + +/* Data structure to communicate with argp functions. */ +static const struct argp argp = +{ + options, NULL, args_doc, doc, NULL, NULL, NULL +}; + + +int +main (int argc, char *argv[]) +{ + /* Make memory leak detection possible. */ + mtrace (); + + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + (void) __fsetlocking (stderr, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + int remaining; + (void) argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &remaining, NULL); + + /* Tell the library which version we are expecting. */ + (void) elf_version (EV_CURRENT); + + /* There must at least be one more parameter specifying the archive. */ + if (remaining == argc) + { + error (0, 0, gettext ("Archive name required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, "ranlib"); + exit (EXIT_FAILURE); + } + + /* We accept the names of multiple archives. */ + int status = 0; + do + status |= handle_file (argv[remaining]); + while (++remaining < argc); + + return status; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "ranlib (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +static int +copy_content (Elf *elf, int newfd, off_t off, size_t n) +{ + size_t len; + char *rawfile = elf_rawfile (elf, &len); + + assert (off + n <= len); + + /* Tell the kernel we will read all the pages sequentially. */ + size_t ps = sysconf (_SC_PAGESIZE); + if (n > 2 * ps) + posix_madvise (rawfile + (off & ~(ps - 1)), n, POSIX_MADV_SEQUENTIAL); + + return write_retry (newfd, rawfile + off, n) != (ssize_t) n; +} + + +/* Handle a file given on the command line. */ +static int +handle_file (const char *fname) +{ + int fd = open (fname, O_RDONLY); + if (fd == -1) + { + error (0, errno, gettext ("cannot open '%s'"), fname); + return 1; + } + + struct stat st; + if (fstat (fd, &st) != 0) + { + error (0, errno, gettext ("cannot stat '%s'"), fname); + close (fd); + return 1; + } + + /* First we walk through the file, looking for all ELF files to + collect symbols from. */ + Elf *arelf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (arelf == NULL) + { + error (0, 0, gettext ("cannot create ELF descriptor for '%s': %s"), + fname, elf_errmsg (-1)); + close (fd); + return 1; + } + + if (elf_kind (arelf) != ELF_K_AR) + { + error (0, 0, gettext ("'%s' is no archive"), fname); + elf_end (arelf); + close (fd); + return 1; + } + + arlib_init (); + + /* Iterate over the content of the archive. */ + off_t index_off = -1; + size_t index_size = 0; + off_t cur_off = SARMAG; + Elf *elf; + Elf_Cmd cmd = ELF_C_READ_MMAP; + while ((elf = elf_begin (fd, cmd, arelf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (elf); + assert (arhdr != NULL); + + /* If this is the index, remember the location. */ + if (strcmp (arhdr->ar_name, "/") == 0) + { + index_off = elf_getaroff (elf); + index_size = arhdr->ar_size; + } + else + { + arlib_add_symbols (elf, fname, arhdr->ar_name, cur_off); + cur_off += (((arhdr->ar_size + 1) & ~((off_t) 1)) + + sizeof (struct ar_hdr)); + } + + /* Get next archive element. */ + cmd = elf_next (elf); + if (elf_end (elf) != 0) + error (0, 0, gettext ("error while freeing sub-ELF descriptor: %s"), + elf_errmsg (-1)); + } + + arlib_finalize (); + + /* If the file contains no symbols we need not do anything. */ + int status = 0; + if (symtab.symsnamelen != 0 + /* We have to rewrite the file also if it initially had an index + but now does not need one anymore. */ + || (symtab.symsnamelen == 0 && index_size != 0)) + { + /* Create a new, temporary file in the same directory as the + original file. */ + char tmpfname[strlen (fname) + 7]; + strcpy (stpcpy (tmpfname, fname), "XXXXXX"); + int newfd = mkstemp (tmpfname); + if (unlikely (newfd == -1)) + { + nonew: + error (0, errno, gettext ("cannot create new file")); + status = 1; + } + else + { + /* Create the header. */ + if (unlikely (write_retry (newfd, ARMAG, SARMAG) != SARMAG)) + { + // XXX Use /prof/self/fd/%d ??? + nonew_unlink: + unlink (tmpfname); + if (newfd != -1) + close (newfd); + goto nonew; + } + + /* Create the new file. There are three parts as far we are + concerned: 1. original context before the index, 2. the + new index, 3. everything after the new index. */ + off_t rest_off; + if (index_off != -1) + rest_off = (index_off + sizeof (struct ar_hdr) + + ((index_size + 1) & ~1ul)); + else + rest_off = SARMAG; + + if ((symtab.symsnamelen != 0 + && ((write_retry (newfd, symtab.symsoff, + symtab.symsofflen) + != (ssize_t) symtab.symsofflen) + || (write_retry (newfd, symtab.symsname, + symtab.symsnamelen) + != (ssize_t) symtab.symsnamelen))) + /* Even if the original file had content before the + symbol table, we write it in the correct order. */ + || (index_off > SARMAG + && copy_content (arelf, newfd, SARMAG, index_off - SARMAG)) + || copy_content (arelf, newfd, rest_off, st.st_size - rest_off) + /* Set the mode of the new file to the same values the + original file has. */ + || fchmod (newfd, st.st_mode & ALLPERMS) != 0 + /* Never complain about fchown failing. */ + || (({asm ("" :: "r" (fchown (newfd, st.st_uid, st.st_gid))); }), + close (newfd) != 0) + || (newfd = -1, rename (tmpfname, fname) != 0)) + goto nonew_unlink; + } + } + + elf_end (arelf); + + arlib_fini (); + + close (fd); + + return status; +} + + +#include "debugpred.h" diff --git a/src/readelf.c b/src/readelf.c index 6129e29d..2797a849 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1,16 +1,28 @@ /* Print information from ELF file in human-readable form. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -18,6 +30,7 @@ #include <argp.h> #include <assert.h> +#include <ctype.h> #include <dwarf.h> #include <errno.h> #include <error.h> @@ -26,9 +39,10 @@ #include <inttypes.h> #include <langinfo.h> #include <libdw.h> -#include <libebl.h> +#include <libdwfl.h> #include <libintl.h> #include <locale.h> +#include <stdarg.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> @@ -37,7 +51,11 @@ #include <sys/param.h> #include <system.h> +#include "../libelf/libelfP.h" +#include "../libelf/common.h" +#include "../libebl/libeblP.h" #include "../libdw/libdwP.h" +#include "../libdwfl/libdwflP.h" #include "../libdw/memory-access.h" @@ -45,30 +63,43 @@ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - { NULL, 0, NULL, 0, N_("Output selection:") }, - { "all", 'a', NULL, 0, N_("Equivalent to: -h -l") }, - { "dynamic", 'd', NULL, 0, N_("Display the dynamic segment") }, - { "file-header", 'h', NULL, 0, N_("Display the ELF file header") }, + { NULL, 0, NULL, 0, N_("Output selection:"), 0 }, + { "all", 'a', NULL, 0, N_("Equivalent to: -h -l"), 0 }, + { "dynamic", 'd', NULL, 0, N_("Display the dynamic segment"), 0 }, + { "file-header", 'h', NULL, 0, N_("Display the ELF file header"), 0 }, { "histogram", 'I', NULL, 0, - N_("Display histogram of bucket list lengths") }, - { "program-headers", 'l', NULL, 0, N_("Display the program headers") }, - { "relocs", 'r', NULL, 0, N_("Display relocations") }, - { "section-headers", 'S', NULL, 0, N_("Display the sections' header") }, - { "symbols", 's', NULL, 0, N_("Display the symbol table") }, - { "version-info", 'V', NULL, 0, N_("Display versioning information") }, + N_("Display histogram of bucket list lengths"), 0 }, + { "program-headers", 'l', NULL, 0, N_("Display the program headers"), 0 }, + { "segments", 'l', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, + { "relocs", 'r', NULL, 0, N_("Display relocations"), 0 }, + { "section-headers", 'S', NULL, 0, N_("Display the sections' header"), 0 }, + { "sections", 'S', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, + { "symbols", 's', NULL, 0, N_("Display the symbol table"), 0 }, + { "version-info", 'V', NULL, 0, N_("Display versioning information"), 0 }, { "debug-dump", 'w', "SECTION", OPTION_ARG_OPTIONAL, N_("Display DWARF section content. SECTION can be one of abbrev, " - "aranges, frame, info, loc, line, pubnames, str, or macinfo.") }, - { "notes", 'n', NULL, 0, N_("Display the core notes") }, + "aranges, frame, info, loc, line, ranges, pubnames, str, or macinfo."), + 0 }, + { "notes", 'n', NULL, 0, N_("Display the core notes"), 0 }, { "arch-specific", 'A', NULL, 0, - N_("Display architecture specific information (if any)") }, - - { NULL, 0, NULL, 0, N_("Output control:") }, - - { NULL, 0, NULL, 0, NULL } + N_("Display architecture specific information (if any)"), 0 }, + { "hex-dump", 'x', "SECTION", 0, + N_("Dump the uninterpreted contents of SECTION, by number or name"), 0 }, + { "strings", 'p', "SECTION", OPTION_ARG_OPTIONAL, + N_("Print string contents of sections"), 0 }, + { "string-dump", 'p', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, + { "archive-index", 'c', NULL, 0, + N_("Display the symbol index of an archive"), 0 }, + + { NULL, 0, NULL, 0, N_("Output control:"), 0 }, + + { NULL, 0, NULL, 0, NULL, 0 } }; /* Short description of program. */ @@ -81,21 +112,15 @@ static const char args_doc[] = N_("FILE..."); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp = { - options, parse_opt, args_doc, doc, NULL, more_help + options, parse_opt, args_doc, doc, NULL, NULL, NULL }; /* Flags set by the option controlling the output. */ -/* True if any of the control options is set. */ -static bool any_control_option; - /* True if dynamic segment should be printed. */ static bool print_dynamic_table; @@ -129,6 +154,15 @@ static bool print_arch; /* True if note section content should be printed. */ static bool print_notes; +/* True if SHF_STRINGS section content should be printed. */ +static bool print_string_sections; + +/* True if archive index should be printed. */ +static bool print_archive_index; + +/* True if any of the control options except print_archive_index is set. */ +static bool any_control_option; + /* Select printing of debugging sections. */ static enum section_e { @@ -141,102 +175,89 @@ static enum section_e section_pubnames = 64,/* .debug_pubnames */ section_str = 128, /* .debug_str */ section_macinfo = 256,/* .debug_macinfo */ + section_ranges = 512, /* .debug_ranges */ section_all = (section_abbrev | section_aranges | section_frame | section_info | section_line | section_loc - | section_pubnames | section_str | section_macinfo) + | section_pubnames | section_str | section_macinfo + | section_ranges) } print_debug_sections; +/* Select hex dumping of sections. */ +static struct section_argument *dump_data_sections; +static struct section_argument **dump_data_sections_tail = &dump_data_sections; + +/* Select string dumping of sections. */ +static struct section_argument *string_sections; +static struct section_argument **string_sections_tail = &string_sections; + +struct section_argument +{ + struct section_argument *next; + const char *arg; +}; + /* Number of sections in the file. */ static size_t shnum; /* Declarations of local functions. */ -static void process_file (int fd, Elf *elf, const char *prefix, - const char *fname, bool only_one); -static void process_elf_file (Elf *elf, const char *prefix, const char *fname, - bool only_one); +static void process_file (int fd, const char *fname, bool only_one); +static void process_elf_file (Dwfl_Module *dwflmod, int fd); static void print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr); static void print_shdr (Ebl *ebl, GElf_Ehdr *ehdr); static void print_phdr (Ebl *ebl, GElf_Ehdr *ehdr); -static void print_scngrp (Ebl *ebl, GElf_Ehdr *ehdr); +static void print_scngrp (Ebl *ebl); static void print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr); -static void print_relocs (Ebl *ebl, GElf_Ehdr *ehdr); -static void handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr); -static void handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr); -static void print_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int type); -static void handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr); -static void print_verinfo (Ebl *ebl, GElf_Ehdr *ehdr); -static void handle_verneed (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr); -static void handle_verdef (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr); -static void handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +static void print_relocs (Ebl *ebl); +static void handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); +static void handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); +static void print_symtab (Ebl *ebl, int type); +static void handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); +static void print_verinfo (Ebl *ebl); +static void handle_verneed (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); +static void handle_verdef (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); +static void handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr); -static void print_debug (Ebl *ebl, GElf_Ehdr *ehdr); -static void handle_hash (Ebl *ebl, GElf_Ehdr *ehdr); +static void print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr); +static void handle_hash (Ebl *ebl); static void handle_notes (Ebl *ebl, GElf_Ehdr *ehdr); -static void print_liblist (Ebl *ebl, GElf_Ehdr *ehdr); +static void print_liblist (Ebl *ebl); +static void print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr); +static void dump_data (Ebl *ebl); +static void dump_strings (Ebl *ebl); +static void print_strings (Ebl *ebl); +static void dump_archive_index (Elf *, const char *); int main (int argc, char *argv[]) { - int remaining; - bool only_one; - /* Set locale. */ setlocale (LC_ALL, ""); /* Initialize the message catalog. */ - textdomain (PACKAGE); + textdomain (PACKAGE_TARNAME); /* Parse and process arguments. */ + int remaining; argp_parse (&argp, argc, argv, 0, &remaining, NULL); - /* If no control option or no ELF file is given punt. */ - if ((any_control_option == 0 && print_debug_sections == 0) - || remaining >= argc) - { - argp_help (&argp, stdout, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, - program_invocation_short_name); - exit (1); - } - /* Before we start tell the ELF library which version we are using. */ elf_version (EV_CURRENT); /* Now process all the files given at the command line. */ - only_one = remaining + 1 == argc; + bool only_one = remaining + 1 == argc; do { - int fd; - Elf *elf; - /* Open the file. */ - fd = open (argv[remaining], O_RDONLY); + int fd = open (argv[remaining], O_RDONLY); if (fd == -1) { error (0, errno, gettext ("cannot open input file")); continue; } - /* Create an `Elf' descriptor. */ - elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); - if (elf == NULL) - error (0, 0, gettext ("cannot generate Elf descriptor: %s\n"), - elf_errmsg (-1)); - else - { - process_file (fd, elf, NULL, argv[remaining], only_one); - - /* Now we can close the descriptor. */ - if (elf_end (elf) != 0) - error (0, 0, gettext ("error while closing Elf descriptor: %s"), - elf_errmsg (-1)); - } + process_file (fd, argv[remaining], only_one); close (fd); } @@ -248,7 +269,8 @@ main (int argc, char *argv[]) /* Handle program arguments. */ static error_t -parse_opt (int key, char *arg, struct argp_state *state) +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) { switch (key) { @@ -310,6 +332,9 @@ parse_opt (int key, char *arg, struct argp_state *state) print_version_info = true; any_control_option = true; break; + case 'c': + print_archive_index = true; + break; case 'w': if (arg == NULL) print_debug_sections = section_all; @@ -317,6 +342,8 @@ parse_opt (int key, char *arg, struct argp_state *state) print_debug_sections |= section_abbrev; else if (strcmp (arg, "aranges") == 0) print_debug_sections |= section_aranges; + else if (strcmp (arg, "ranges") == 0) + print_debug_sections |= section_ranges; else if (strcmp (arg, "frame") == 0) print_debug_sections |= section_frame; else if (strcmp (arg, "info") == 0) @@ -339,6 +366,40 @@ parse_opt (int key, char *arg, struct argp_state *state) program_invocation_short_name); exit (1); } + any_control_option = true; + break; + case 'p': + any_control_option = true; + if (arg == NULL) + { + print_string_sections = true; + break; + } + /* Fall through. */ + case 'x': + { + struct section_argument *a = xmalloc (sizeof *a); + a->arg = arg; + a->next = NULL; + struct section_argument ***tailp + = key == 'x' ? &dump_data_sections_tail : &string_sections_tail; + **tailp = a; + *tailp = &a->next; + } + any_control_option = true; + break; + case ARGP_KEY_NO_ARGS: + fputs (gettext ("Missing file name.\n"), stderr); + goto do_argp_help; + case ARGP_KEY_FINI: + if (! any_control_option && ! print_archive_index) + { + fputs (gettext ("No operation specified.\n"), stderr); + do_argp_help: + argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, + program_invocation_short_name); + exit (1); + } break; default: return ARGP_ERR_UNKNOWN; @@ -347,177 +408,265 @@ parse_opt (int key, char *arg, struct argp_state *state) } -static char * -more_help (int key, const char *text, void *input) -{ - char *buf; - - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - - default: - break; - } - return (char *) text; -} - - /* Print the version information. */ static void -print_version (FILE *stream, struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "readelf (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "readelf (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } -/* Process one file. */ +/* Check if the file is an archive, and if so dump its index. */ static void -process_file (int fd, Elf *elf, const char *prefix, const char *fname, - bool only_one) +check_archive_index (int fd, const char *fname, bool only_one) +{ + /* Create an `Elf' descriptor. */ + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf == NULL) + error (0, 0, gettext ("cannot generate Elf descriptor: %s"), + elf_errmsg (-1)); + else + { + if (elf_kind (elf) == ELF_K_AR) + { + if (!only_one) + printf ("\n%s:\n\n", fname); + dump_archive_index (elf, fname); + } + else + error (0, 0, + gettext ("'%s' is not an archive, cannot print archive index"), + fname); + + /* Now we can close the descriptor. */ + if (elf_end (elf) != 0) + error (0, 0, gettext ("error while closing Elf descriptor: %s"), + elf_errmsg (-1)); + } +} + +/* Trivial callback used for checking if we opened an archive. */ +static int +count_dwflmod (Dwfl_Module *dwflmod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + void *arg) +{ + if (*(bool *) arg) + return DWARF_CB_ABORT; + *(bool *) arg = true; + return DWARF_CB_OK; +} + +struct process_dwflmod_args { - /* We can handle two types of files: ELF files and archives. */ - Elf_Kind kind = elf_kind (elf); - struct stat64 st; + int fd; + bool only_one; +}; - switch (kind) +static int +process_dwflmod (Dwfl_Module *dwflmod, + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + void *arg) +{ + const struct process_dwflmod_args *a = arg; + + /* Print the file name. */ + if (!a->only_one) { - case ELF_K_ELF: - /* Yes! It's an ELF file. */ - process_elf_file (elf, prefix, fname, only_one); - break; + const char *fname; + dwfl_module_info (dwflmod, NULL, NULL, NULL, NULL, NULL, &fname, NULL); - case ELF_K_AR: - { - Elf *subelf; - Elf_Cmd cmd = ELF_C_READ_MMAP; - size_t prefix_len = prefix == NULL ? 0 : strlen (prefix); - size_t fname_len = strlen (fname) + 1; - char new_prefix[prefix_len + 1 + fname_len]; - char *cp = new_prefix; - - /* Create the full name of the file. */ - if (prefix != NULL) - { - cp = mempcpy (cp, prefix, prefix_len); - *cp++ = ':'; - } - memcpy (cp, fname, fname_len); + printf ("\n%s:\n\n", fname); + } - /* It's an archive. We process each file in it. */ - while ((subelf = elf_begin (fd, cmd, elf)) != NULL) - { - kind = elf_kind (subelf); + process_elf_file (dwflmod, a->fd); - /* Call this function recursively. */ - if (kind == ELF_K_ELF || kind == ELF_K_AR) - { - Elf_Arhdr *arhdr = elf_getarhdr (subelf); - assert (arhdr != NULL); + return DWARF_CB_OK; +} - process_file (fd, subelf, new_prefix, arhdr->ar_name, false); - } +/* Stub libdwfl callback, only the ELF handle already open is ever used. */ +static int +find_no_debuginfo (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *modname __attribute__ ((unused)), + Dwarf_Addr base __attribute__ ((unused)), + const char *file_name __attribute__ ((unused)), + const char *debuglink_file __attribute__ ((unused)), + GElf_Word debuglink_crc __attribute__ ((unused)), + char **debuginfo_file_name __attribute__ ((unused))) +{ + return -1; +} - /* Get next archive element. */ - cmd = elf_next (subelf); - if (elf_end (subelf) != 0) - error (0, 0, - gettext (" error while freeing sub-ELF descriptor: %s\n"), - elf_errmsg (-1)); - } - } - break; +/* Process one input file. */ +static void +process_file (int fd, const char *fname, bool only_one) +{ + if (print_archive_index) + check_archive_index (fd, fname, only_one); - default: + if (!any_control_option) + return; + + /* Duplicate an fd for dwfl_report_offline to swallow. */ + int dwfl_fd = dup (fd); + if (unlikely (dwfl_fd < 0)) + error (EXIT_FAILURE, errno, "dup"); + + /* Use libdwfl in a trivial way to open the libdw handle for us. + This takes care of applying relocations to DWARF data in ET_REL files. */ + static const Dwfl_Callbacks callbacks = + { + .section_address = dwfl_offline_section_address, + .find_debuginfo = find_no_debuginfo + }; + Dwfl *dwfl = dwfl_begin (&callbacks); + if (likely (dwfl != NULL)) + /* Let 0 be the logical address of the file (or first in archive). */ + dwfl->offline_next_address = 0; + if (dwfl_report_offline (dwfl, fname, fname, dwfl_fd) == NULL) + { + struct stat64 st; if (fstat64 (fd, &st) != 0) error (0, errno, gettext ("cannot stat input file")); - else if (st.st_size == 0) + else if (unlikely (st.st_size == 0)) error (0, 0, gettext ("input file is empty")); else - /* We cannot do anything. */ - error (0, 0, gettext ("\ -Not an ELF file - it has the wrong magic bytes at the start")); - break; + error (0, 0, gettext ("failed reading '%s': %s"), + fname, dwfl_errmsg (-1)); } + else + { + dwfl_report_end (dwfl, NULL, NULL); + + if (only_one) + { + /* Clear ONLY_ONE if we have multiple modules, from an archive. */ + bool seen = false; + only_one = dwfl_getmodules (dwfl, &count_dwflmod, &seen, 0) == 0; + } + + /* Process the one or more modules gleaned from this file. */ + struct process_dwflmod_args a = { .fd = fd, .only_one = only_one }; + dwfl_getmodules (dwfl, &process_dwflmod, &a, 0); + } + dwfl_end (dwfl); } -/* Process one file. */ +/* Process one ELF file. */ static void -process_elf_file (Elf *elf, const char *prefix, const char *fname, - bool only_one) +process_elf_file (Dwfl_Module *dwflmod, int fd) { + GElf_Addr dwflbias; + Elf *elf = dwfl_module_getelf (dwflmod, &dwflbias); + GElf_Ehdr ehdr_mem; GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); - Ebl *ebl; - - /* Print the file name. */ - if (!only_one) - { - if (prefix != NULL) - printf ("\n%s(%s):\n\n", prefix, fname); - else - printf ("\n%s:\n\n", fname); - } if (ehdr == NULL) { + elf_error: error (0, 0, gettext ("cannot read ELF header: %s"), elf_errmsg (-1)); return; } - ebl = ebl_openbackend (elf); - if (ebl == NULL) + Ebl *ebl = ebl_openbackend (elf); + if (unlikely (ebl == NULL)) { + ebl_error: error (0, errno, gettext ("cannot create EBL handle")); return; } /* Determine the number of sections. */ - if (elf_getshnum (ebl->elf, &shnum) < 0) + if (unlikely (elf_getshnum (ebl->elf, &shnum) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot determine number of sections: %s"), elf_errmsg (-1)); + /* For an ET_REL file, libdwfl has adjusted the in-core shdrs + and may have applied relocation to some sections. + So we need to get a fresh Elf handle on the file to display those. */ + bool print_unrelocated = (print_section_header + || print_relocations + || dump_data_sections != NULL + || print_notes); + + Elf *pure_elf = NULL; + Ebl *pure_ebl = ebl; + if (ehdr->e_type == ET_REL && print_unrelocated) + { + /* Read the file afresh. */ + off64_t aroff = elf_getaroff (elf); + pure_elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (aroff > 0) + { + /* Archive member. */ + (void) elf_rand (pure_elf, aroff); + Elf *armem = elf_begin (-1, ELF_C_READ_MMAP, pure_elf); + elf_end (pure_elf); + pure_elf = armem; + } + if (pure_elf == NULL) + goto elf_error; + pure_ebl = ebl_openbackend (pure_elf); + if (pure_ebl == NULL) + goto ebl_error; + } + if (print_file_header) print_ehdr (ebl, ehdr); if (print_section_header) - print_shdr (ebl, ehdr); + print_shdr (pure_ebl, ehdr); if (print_program_header) print_phdr (ebl, ehdr); if (print_section_groups) - print_scngrp (ebl, ehdr); + print_scngrp (ebl); if (print_dynamic_table) print_dynamic (ebl, ehdr); if (print_relocations) - print_relocs (ebl, ehdr); + print_relocs (pure_ebl); if (print_histogram) - handle_hash (ebl, ehdr); + handle_hash (ebl); if (print_symbol_table) - print_symtab (ebl, ehdr, SHT_DYNSYM); + print_symtab (ebl, SHT_DYNSYM); if (print_version_info) - print_verinfo (ebl, ehdr); + print_verinfo (ebl); if (print_symbol_table) - print_symtab (ebl, ehdr, SHT_SYMTAB); + print_symtab (ebl, SHT_SYMTAB); + if (print_arch) + print_liblist (ebl); if (print_arch) - print_liblist (ebl, ehdr); + print_attributes (ebl, ehdr); + if (dump_data_sections != NULL) + dump_data (pure_ebl); + if (string_sections != NULL) + dump_strings (ebl); if (print_debug_sections != 0) - print_debug (ebl, ehdr); + print_debug (dwflmod, ebl, ehdr); if (print_notes) - handle_notes (ebl, ehdr); + handle_notes (pure_ebl, ehdr); + if (print_string_sections) + print_strings (ebl); ebl_closebackend (ebl); + + if (pure_ebl != ebl) + { + ebl_closebackend (pure_ebl); + elf_end (pure_elf); + } } @@ -525,9 +674,9 @@ process_elf_file (Elf *elf, const char *prefix, const char *fname, static void print_file_type (unsigned short int e_type) { - if (e_type <= ET_CORE) + if (likely (e_type <= ET_CORE)) { - static const char *knowntypes[] = + static const char *const knowntypes[] = { N_("NONE (None)"), N_("REL (Relocatable file)"), @@ -550,11 +699,8 @@ print_file_type (unsigned short int e_type) static void print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) { - char buf[512]; - size_t cnt; - fputs_unlocked (gettext ("ELF Header:\n Magic: "), stdout); - for (cnt = 0; cnt < EI_NIDENT; ++cnt) + for (size_t cnt = 0; cnt < EI_NIDENT; ++cnt) printf (" %02hhx", ehdr->e_ident[cnt]); printf (gettext ("\n Class: %s\n"), @@ -568,11 +714,12 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) : ehdr->e_ident[EI_DATA] == ELFDATA2MSB ? "2's complement, big endian" : "\?\?\?"); - printf (gettext (" Version: %hhd %s\n"), + printf (gettext (" Ident Version: %hhd %s\n"), ehdr->e_ident[EI_VERSION], ehdr->e_ident[EI_VERSION] == EV_CURRENT ? gettext ("(current)") : "(\?\?\?)"); + char buf[512]; printf (gettext (" OS/ABI: %s\n"), ebl_osabi_name (ebl, ehdr->e_ident[EI_OSABI], buf, sizeof (buf))); @@ -617,9 +764,7 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) if (ehdr->e_shnum == 0) { GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - - shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); if (shdr != NULL) printf (gettext (" (%" PRIu32 " in [0].sh_size)"), (uint32_t) shdr->sh_size); @@ -628,12 +773,10 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) } fputc_unlocked ('\n', stdout); - if (ehdr->e_shstrndx == SHN_XINDEX) + if (unlikely (ehdr->e_shstrndx == SHN_XINDEX)) { GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - - shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); if (shdr != NULL) /* We managed to get the zeroth section. */ snprintf (buf, sizeof (buf), gettext (" (%" PRIu32 " in [0].sh_link)"), @@ -686,7 +829,7 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\ ehdr->e_shnum, ehdr->e_shoff); /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -699,24 +842,21 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\ for (cnt = 0; cnt < shnum; ++cnt) { - char buf[128]; - char flagbuf[20]; - char *cp; Elf_Scn *scn = elf_getscn (ebl->elf, cnt); - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - if (scn == NULL) + if (unlikely (scn == NULL)) error (EXIT_FAILURE, 0, gettext ("cannot get section: %s"), elf_errmsg (-1)); /* Get the section header. */ - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (unlikely (shdr == NULL)) error (EXIT_FAILURE, 0, gettext ("cannot get section header: %s"), elf_errmsg (-1)); - cp = flagbuf; + char flagbuf[20]; + char *cp = flagbuf; if (shdr->sh_flags & SHF_WRITE) *cp++ = 'W'; if (shdr->sh_flags & SHF_ALLOC) @@ -743,6 +883,7 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\ *cp++ = 'E'; *cp = '\0'; + char buf[128]; printf ("[%2zu] %-20s %-12s %0*" PRIx64 " %0*" PRIx64 " %0*" PRIx64 " %2" PRId64 " %-5s %2" PRId32 " %3" PRId32 " %2" PRId64 "\n", @@ -765,9 +906,6 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\ static void print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) { - size_t cnt; - size_t shstrndx; - if (ehdr->e_phnum == 0) /* No program header, this is OK in relocatable objects. */ return; @@ -784,14 +922,14 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) bool has_relro = false; GElf_Addr relro_from = 0; GElf_Addr relro_to = 0; - for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) { char buf[128]; GElf_Phdr mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, cnt, &mem); /* If for some reason the header cannot be returned show this. */ - if (phdr == NULL) + if (unlikely (phdr == NULL)) { puts (" ???"); continue; @@ -829,42 +967,40 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) } /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); puts (gettext ("\n Section to Segment mapping:\n Segment Sections...")); - for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) { - GElf_Phdr phdr_mem; - GElf_Phdr *phdr = gelf_getphdr (ebl->elf, cnt, &phdr_mem); - size_t inner; - /* Print the segment number. */ printf (" %2.2zu ", cnt); + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, cnt, &phdr_mem); /* This must not happen. */ - if (phdr == NULL) + if (unlikely (phdr == NULL)) error (EXIT_FAILURE, 0, gettext ("cannot get program header: %s"), elf_errmsg (-1)); /* Iterate over the sections. */ bool in_relro = false; - for (inner = 1; inner < shnum; ++inner) + bool in_ro = false; + for (size_t inner = 1; inner < shnum; ++inner) { Elf_Scn *scn = elf_getscn (ebl->elf, inner); - GElf_Shdr shdr_mem; - GElf_Shdr *shdr; - - /* It should not happen. */ - if (scn == NULL) + /* This should not happen. */ + if (unlikely (scn == NULL)) error (EXIT_FAILURE, 0, gettext ("cannot get section: %s"), elf_errmsg (-1)); /* Get the section header. */ - shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL) + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (unlikely (shdr == NULL)) error (EXIT_FAILURE, 0, gettext ("cannot get section header: %s"), elf_errmsg (-1)); @@ -895,6 +1031,45 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) else if (has_relro && in_relro && shdr->sh_addr + shdr->sh_size > relro_to) fputs_unlocked ("] <RELRO:", stdout); + else if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_W) == 0) + { + if (!in_ro) + { + fputs_unlocked (" [RO:", stdout); + in_ro = true; + } + } + else + { + /* Determine the segment this section is part of. */ + size_t cnt2; + GElf_Phdr *phdr2 = NULL; + for (cnt2 = 0; cnt2 < ehdr->e_phnum; ++cnt2) + { + GElf_Phdr phdr2_mem; + phdr2 = gelf_getphdr (ebl->elf, cnt2, &phdr2_mem); + + if (phdr2 != NULL && phdr2->p_type == PT_LOAD + && shdr->sh_addr >= phdr2->p_vaddr + && (shdr->sh_addr + shdr->sh_size + <= phdr2->p_vaddr + phdr2->p_memsz)) + break; + } + + if (cnt2 < ehdr->e_phnum) + { + if ((phdr2->p_flags & PF_W) == 0 && !in_ro) + { + fputs_unlocked (" [RO:", stdout); + in_ro = true; + } + else if ((phdr2->p_flags & PF_W) != 0 && in_ro) + { + fputs_unlocked ("]", stdout); + in_ro = false; + } + } + } printf (" %s", elf_strptr (ebl->elf, shstrndx, shdr->sh_name)); @@ -908,7 +1083,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) } } } - if (in_relro) + if (in_relro || in_ro) fputs_unlocked ("]", stdout); /* Finish the line. */ @@ -918,36 +1093,29 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) static void -handle_scngrp (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_scngrp (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { - Elf_Data *data; - Elf32_Word *grpref; - Elf_Scn *symscn; - GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr; - Elf_Data *symdata; - GElf_Sym sym_mem; - size_t cnt; - size_t shstrndx; - /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); - symscn = elf_getscn (ebl->elf, shdr->sh_link); - symshdr = gelf_getshdr (symscn, &symshdr_mem); - symdata = elf_getdata (symscn, NULL); + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); + Elf_Data *symdata = elf_getdata (symscn, NULL); if (data == NULL || data->d_size < sizeof (Elf32_Word) || symshdr == NULL || symdata == NULL) return; /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); - grpref = (Elf32_Word *) data->d_buf; + Elf32_Word *grpref = (Elf32_Word *) data->d_buf; + GElf_Sym sym_mem; printf ((grpref[0] & GRP_COMDAT) ? ngettext ("\ \nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n", @@ -965,27 +1133,24 @@ handle_scngrp (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) ?: gettext ("<INVALID SYMBOL>"), data->d_size / sizeof (Elf32_Word) - 1); - for (cnt = 1; cnt < data->d_size / sizeof (Elf32_Word); ++cnt) + for (size_t cnt = 1; cnt < data->d_size / sizeof (Elf32_Word); ++cnt) { GElf_Shdr grpshdr_mem; - GElf_Shdr *grpshdr; - - grpshdr = gelf_getshdr (elf_getscn (ebl->elf, grpref[cnt]), - &grpshdr_mem); - - if (grpshdr == NULL) - printf (gettext (" [%2u] <INVALID SECTION>\n"), grpref[cnt]); - else - printf (" [%2u] %s\n", - grpref[cnt], - elf_strptr (ebl->elf, shstrndx, grpshdr->sh_name) - ?: gettext ("<INVALID SECTION>")); + GElf_Shdr *grpshdr = gelf_getshdr (elf_getscn (ebl->elf, grpref[cnt]), + &grpshdr_mem); + + const char *str; + printf (" [%2u] %s\n", + grpref[cnt], + grpshdr != NULL + && (str = elf_strptr (ebl->elf, shstrndx, grpshdr->sh_name)) + ? str : gettext ("<INVALID SECTION>")); } } static void -print_scngrp (Ebl *ebl, GElf_Ehdr *ehdr) +print_scngrp (Ebl *ebl) { /* Find all relocation sections and handle them. */ Elf_Scn *scn = NULL; @@ -997,7 +1162,7 @@ print_scngrp (Ebl *ebl, GElf_Ehdr *ehdr) GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr != NULL && shdr->sh_type == SHT_GROUP) - handle_scngrp (ebl, ehdr, scn, shdr); + handle_scngrp (ebl, scn, shdr); } } @@ -1112,7 +1277,7 @@ print_dt_posflag_1 (int class, GElf_Xword d_val) static void -handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); GElf_Shdr glink; @@ -1126,7 +1291,7 @@ handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) return; /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1146,14 +1311,12 @@ handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { - char buf[64]; GElf_Dyn dynmem; - GElf_Dyn *dyn; - - dyn = gelf_getdyn (data, cnt, &dynmem); + GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem); if (dyn == NULL) break; + char buf[64]; printf (" %-17s ", ebl_dynamic_tag_name (ebl, dyn->d_tag, buf, sizeof (buf))); @@ -1164,7 +1327,7 @@ handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) case DT_BIND_NOW: case DT_TEXTREL: /* No further output. */ - fputc ('\n', stdout); + fputc_unlocked ('\n', stdout); break; case DT_NEEDED: @@ -1246,18 +1409,18 @@ handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) static void print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr) { - /* Find all relocation sections and handle them. */ - Elf_Scn *scn = NULL; - - while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + for (int i = 0; i < ehdr->e_phnum; ++i) { - /* Handle the section if it is a symbol table. */ - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (ebl->elf, i, &phdr_mem); - if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC) + if (phdr != NULL && phdr->p_type == PT_DYNAMIC) { - handle_dynamic (ebl, ehdr, scn, shdr); + Elf_Scn *scn = gelf_offscn (ebl->elf, phdr->p_offset); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC) + handle_dynamic (ebl, scn, shdr); break; } } @@ -1266,7 +1429,7 @@ print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr) /* Print relocations. */ static void -print_relocs (Ebl *ebl, GElf_Ehdr *ehdr) +print_relocs (Ebl *ebl) { /* Find all relocation sections and handle them. */ Elf_Scn *scn = NULL; @@ -1277,12 +1440,12 @@ print_relocs (Ebl *ebl, GElf_Ehdr *ehdr) GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr != NULL) + if (likely (shdr != NULL)) { if (shdr->sh_type == SHT_REL) - handle_relocs_rel (ebl, ehdr, scn, shdr); + handle_relocs_rel (ebl, scn, shdr); else if (shdr->sh_type == SHT_RELA) - handle_relocs_rela (ebl, ehdr, scn, shdr); + handle_relocs_rela (ebl, scn, shdr); } } } @@ -1290,37 +1453,28 @@ print_relocs (Ebl *ebl, GElf_Ehdr *ehdr) /* Handle a relocation section. */ static void -handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); int nentries = shdr->sh_size / shdr->sh_entsize; - int cnt; - Elf_Data *data; - Elf_Scn *symscn; - GElf_Shdr symshdr_mem; - GElf_Shdr *symshdr; - Elf_Data *symdata; - GElf_Shdr destshdr_mem; - GElf_Shdr *destshdr; - Elf_Scn *xndxscn; - Elf_Data *xndxdata = NULL; - size_t shstrndx; /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) return; /* Get the symbol table information. */ - symscn = elf_getscn (ebl->elf, shdr->sh_link); - symshdr = gelf_getshdr (symscn, &symshdr_mem); - symdata = elf_getdata (symscn, NULL); + Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link); + GElf_Shdr symshdr_mem; + GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem); + Elf_Data *symdata = elf_getdata (symscn, NULL); /* Get the section header of the section the relocations are for. */ - destshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), - &destshdr_mem); + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), + &destshdr_mem); - if (symshdr == NULL || symdata == NULL || destshdr == NULL) + if (unlikely (symshdr == NULL || symdata == NULL || destshdr == NULL)) { printf (gettext ("\nInvalid symbol table at offset %#0" PRIx64 "\n"), shdr->sh_offset); @@ -1328,24 +1482,14 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) } /* Search for the optional extended section index table. */ - xndxscn = NULL; - while ((xndxscn = elf_nextscn (ebl->elf, xndxscn)) != NULL) - { - GElf_Shdr xndxshdr_mem; - GElf_Shdr *xndxshdr; - - xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem); - if (xndxshdr != NULL && xndxshdr->sh_type == SHT_SYMTAB_SHNDX - && xndxshdr->sh_link == elf_ndxscn (symscn)) - { - /* Found it. */ - xndxdata = elf_getdata (xndxscn, NULL); - break; - } - } + Elf_Data *xndxdata = NULL; + int xndxscnidx = elf_scnshndx (scn); + if (unlikely (xndxscnidx > 0)) + xndxdata = elf_getdata (elf_getscn (ebl->elf, xndxscnidx), NULL); /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1381,22 +1525,19 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) Offset Type Value Name\n"), stdout); - for (cnt = 0; cnt < nentries; ++cnt) + for (int cnt = 0; cnt < nentries; ++cnt) { GElf_Rel relmem; - GElf_Rel *rel; - - rel = gelf_getrel (data, cnt, &relmem); - if (rel != NULL) + GElf_Rel *rel = gelf_getrel (data, cnt, &relmem); + if (likely (rel != NULL)) { char buf[128]; GElf_Sym symmem; - GElf_Sym *sym; Elf32_Word xndx; - - sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), - &symmem, &xndx); - if (sym == NULL) + GElf_Sym *sym = gelf_getsymshndx (symdata, xndxdata, + GELF_R_SYM (rel->r_info), + &symmem, &xndx); + if (unlikely (sym == NULL)) printf (" %#0*" PRIx64 " %-20s <%s %ld>\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) @@ -1410,7 +1551,8 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) printf (" %#0*" PRIx64 " %-20s %#0*" PRIx64 " %s\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + likely (ebl_reloc_type_check (ebl, + GELF_R_TYPE (rel->r_info))) /* Avoid the leading R_ which isn't carrying any information. */ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), @@ -1425,7 +1567,7 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) ? xndx : sym->st_shndx), &destshdr_mem); - if (shdr == NULL) + if (unlikely (destshdr == NULL)) printf (" %#0*" PRIx64 " %-20s <%s %ld>\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) @@ -1456,7 +1598,7 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) /* Handle a relocation section. */ static void -handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); int nentries = shdr->sh_size / shdr->sh_entsize; @@ -1477,7 +1619,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Shdr *destshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_info), &destshdr_mem); - if (symshdr == NULL || symdata == NULL || destshdr == NULL) + if (unlikely (symshdr == NULL || symdata == NULL || destshdr == NULL)) { printf (gettext ("\nInvalid symbol table at offset %#0" PRIx64 "\n"), shdr->sh_offset); @@ -1486,25 +1628,13 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) /* Search for the optional extended section index table. */ Elf_Data *xndxdata = NULL; - Elf_Scn *xndxscn = NULL; - while ((xndxscn = elf_nextscn (ebl->elf, xndxscn)) != NULL) - { - GElf_Shdr xndxshdr_mem; - GElf_Shdr *xndxshdr; - - xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem); - if (xndxshdr != NULL && xndxshdr->sh_type == SHT_SYMTAB_SHNDX - && xndxshdr->sh_link == elf_ndxscn (symscn)) - { - /* Found it. */ - xndxdata = elf_getdata (xndxscn, NULL); - break; - } - } + int xndxscnidx = elf_scnshndx (scn); + if (unlikely (xndxscnidx > 0)) + xndxdata = elf_getdata (elf_getscn (ebl->elf, xndxscnidx), NULL); /* Get the section header string table index. */ size_t shstrndx; - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1530,17 +1660,16 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) { GElf_Rela relmem; GElf_Rela *rel = gelf_getrela (data, cnt, &relmem); - if (rel != NULL) + if (likely (rel != NULL)) { char buf[64]; GElf_Sym symmem; - GElf_Sym *sym; Elf32_Word xndx; + GElf_Sym *sym = gelf_getsymshndx (symdata, xndxdata, + GELF_R_SYM (rel->r_info), + &symmem, &xndx); - sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), - &symmem, &xndx); - - if (sym == NULL) + if (unlikely (sym == NULL)) printf (" %#0*" PRIx64 " %-15s <%s %ld>\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) @@ -1553,9 +1682,10 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) (long int) GELF_R_SYM (rel->r_info)); else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) printf ("\ - %#0*" PRIx64 " %-15s %#0*" PRIx64 " +%5" PRId64 " %s\n", + %#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) + likely (ebl_reloc_type_check (ebl, + GELF_R_TYPE (rel->r_info))) /* Avoid the leading R_ which isn't carrying any information. */ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), @@ -1571,7 +1701,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) ? xndx : sym->st_shndx), &destshdr_mem); - if (shdr == NULL) + if (unlikely (shdr == NULL)) printf (" %#0*" PRIx64 " %-15s <%s %ld>\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) @@ -1585,7 +1715,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) ? xndx : sym->st_shndx)); else printf ("\ - %#0*" PRIx64 " %-15s %#0*" PRIx64 " +%5" PRId64 " %s\n", + %#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n", class == ELFCLASS32 ? 10 : 18, rel->r_offset, ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) /* Avoid the leading R_ which isn't carrying any @@ -1604,7 +1734,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) /* Print the program header. */ static void -print_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int type) +print_symtab (Ebl *ebl, int type) { /* Find the symbol table(s). For this we have to search through the section table. */ @@ -1617,41 +1747,35 @@ print_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int type) GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr != NULL && shdr->sh_type == (GElf_Word) type) - handle_symtab (ebl, ehdr, scn, shdr); + handle_symtab (ebl, scn, shdr); } } static void -handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { Elf_Data *versym_data = NULL; Elf_Data *verneed_data = NULL; Elf_Data *verdef_data = NULL; Elf_Data *xndx_data = NULL; - Elf_Scn *runscn; - Elf_Data *data; int class = gelf_getclass (ebl->elf); - unsigned int nsyms; - unsigned int cnt; Elf32_Word verneed_stridx = 0; Elf32_Word verdef_stridx = 0; - GElf_Shdr glink; - size_t shstrndx; /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) return; /* Find out whether we have other sections we might need. */ - runscn = NULL; + Elf_Scn *runscn = NULL; while ((runscn = elf_nextscn (ebl->elf, runscn)) != NULL) { GElf_Shdr runshdr_mem; GElf_Shdr *runshdr = gelf_getshdr (runscn, &runshdr_mem); - if (runshdr != NULL) + if (likely (runshdr != NULL)) { if (runshdr->sh_type == SHT_GNU_versym && runshdr->sh_link == elf_ndxscn (scn)) @@ -1677,19 +1801,22 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) } /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); /* Now we can compute the number of entries in the section. */ - nsyms = data->d_size / (class == ELFCLASS32 - ? sizeof (Elf32_Sym) : sizeof (Elf64_Sym)); + unsigned int nsyms = data->d_size / (class == ELFCLASS32 + ? sizeof (Elf32_Sym) + : sizeof (Elf64_Sym)); printf (ngettext ("\nSymbol table [%2u] '%s' contains %u entry:\n", "\nSymbol table [%2u] '%s' contains %u entries:\n", nsyms), (unsigned int) elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms); + GElf_Shdr glink; printf (ngettext (" %lu local symbol String table: [%2u] '%s'\n", " %lu local symbols String table: [%2u] '%s'\n", shdr->sh_info), @@ -1706,7 +1833,7 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) Num: Value Size Type Bind Vis Ndx Name\n"), stdout); - for (cnt = 0; cnt < nsyms; ++cnt) + for (unsigned int cnt = 0; cnt < nsyms; ++cnt) { char typebuf[64]; char bindbuf[64]; @@ -1715,11 +1842,11 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Sym sym_mem; GElf_Sym *sym = gelf_getsymshndx (data, xndx_data, cnt, &sym_mem, &xndx); - if (sym == NULL) + if (unlikely (sym == NULL)) continue; /* Determine the real section index. */ - if (sym->st_shndx != SHN_XINDEX) + if (likely (sym->st_shndx != SHN_XINDEX)) xndx = sym->st_shndx; printf (gettext ("\ @@ -1741,9 +1868,7 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) { /* Get the version information. */ GElf_Versym versym_mem; - GElf_Versym *versym; - - versym = gelf_getversym (versym_data, cnt, &versym_mem); + GElf_Versym *versym = gelf_getversym (versym_data, cnt, &versym_mem); if (versym != NULL && ((*versym & 0x8000) != 0 || *versym > 1)) { @@ -1763,13 +1888,13 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) if (is_nobits || ! check_def) { /* We must test both. */ - GElf_Verneed verneed_mem; - GElf_Verneed *verneed; GElf_Vernaux vernaux_mem; GElf_Vernaux *vernaux = NULL; size_t vn_offset = 0; - verneed = gelf_getverneed (verneed_data, 0, &verneed_mem); + GElf_Verneed verneed_mem; + GElf_Verneed *verneed = gelf_getverneed (verneed_data, 0, + &verneed_mem); while (verneed != NULL) { size_t vna_offset = vn_offset; @@ -1811,7 +1936,7 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) (unsigned int) vernaux->vna_other); check_def = 0; } - else if (! is_nobits) + else if (unlikely (! is_nobits)) error (0, 0, gettext ("bad dynamic symbol")); else check_def = 1; @@ -1820,11 +1945,11 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) if (check_def && *versym != 0x8001) { /* We must test both. */ - GElf_Verdef verdef_mem; - GElf_Verdef *verdef; size_t vd_offset = 0; - verdef = gelf_getverdef (verdef_data, 0, &verdef_mem); + GElf_Verdef verdef_mem; + GElf_Verdef *verdef = gelf_getverdef (verdef_data, 0, + &verdef_mem); while (verdef != NULL) { if (verdef->vd_ndx == (*versym & 0x7fff)) @@ -1841,11 +1966,10 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) if (verdef != NULL) { GElf_Verdaux verdaux_mem; - GElf_Verdaux *verdaux; - - verdaux = gelf_getverdaux (verdef_data, - vd_offset + verdef->vd_aux, - &verdaux_mem); + GElf_Verdaux *verdaux + = gelf_getverdaux (verdef_data, + vd_offset + verdef->vd_aux, + &verdaux_mem); if (verdaux != NULL) printf ((*versym & 0x8000) ? "@%s" : "@@%s", @@ -1856,14 +1980,14 @@ handle_symtab (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) } } - putchar ('\n'); + putchar_unlocked ('\n'); } } /* Print version information. */ static void -print_verinfo (Ebl *ebl, GElf_Ehdr *ehdr) +print_verinfo (Ebl *ebl) { /* Find the version information sections. For this we have to search through the section table. */ @@ -1875,14 +1999,14 @@ print_verinfo (Ebl *ebl, GElf_Ehdr *ehdr) GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr != NULL) + if (likely (shdr != NULL)) { if (shdr->sh_type == SHT_GNU_verneed) - handle_verneed (ebl, ehdr, scn, shdr); + handle_verneed (ebl, scn, shdr); else if (shdr->sh_type == SHT_GNU_verdef) - handle_verdef (ebl, ehdr, scn, shdr); + handle_verdef (ebl, scn, shdr); else if (shdr->sh_type == SHT_GNU_versym) - handle_versym (ebl, ehdr, scn, shdr); + handle_versym (ebl, scn, shdr); } } } @@ -1910,7 +2034,7 @@ get_ver_flags (unsigned int flags) endp = stpcpy (endp, "WEAK "); } - if (flags & ~(VER_FLG_BASE | VER_FLG_WEAK)) + if (unlikely (flags & ~(VER_FLG_BASE | VER_FLG_WEAK))) { strncpy (endp, gettext ("| <unknown>"), buf + sizeof (buf) - endp); buf[sizeof (buf) - 1] = '\0'; @@ -1921,25 +2045,22 @@ get_ver_flags (unsigned int flags) static void -handle_verneed (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_verneed (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { - Elf_Data *data; int class = gelf_getclass (ebl->elf); - GElf_Shdr glink; - int cnt; - unsigned int offset; - size_t shstrndx; /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) return; /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); + GElf_Shdr glink; printf (ngettext ("\ \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ @@ -1954,17 +2075,13 @@ handle_verneed (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink)->sh_name)); - offset = 0; - for (cnt = shdr->sh_info; --cnt >= 0; ) + unsigned int offset = 0; + for (int cnt = shdr->sh_info; --cnt >= 0; ) { - GElf_Verneed needmem; - GElf_Verneed *need; - unsigned int auxoffset; - int cnt2; - /* Get the data at the next offset. */ - need = gelf_getverneed (data, offset, &needmem); - if (need == NULL) + GElf_Verneed needmem; + GElf_Verneed *need = gelf_getverneed (data, offset, &needmem); + if (unlikely (need == NULL)) break; printf (gettext (" %#06x: Version: %hu File: %s Cnt: %hu\n"), @@ -1972,14 +2089,12 @@ handle_verneed (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) elf_strptr (ebl->elf, shdr->sh_link, need->vn_file), (unsigned short int) need->vn_cnt); - auxoffset = offset + need->vn_aux; - for (cnt2 = need->vn_cnt; --cnt2 >= 0; ) + unsigned int auxoffset = offset + need->vn_aux; + for (int cnt2 = need->vn_cnt; --cnt2 >= 0; ) { GElf_Vernaux auxmem; - GElf_Vernaux *aux; - - aux = gelf_getvernaux (data, auxoffset, &auxmem); - if (aux == NULL) + GElf_Vernaux *aux = gelf_getvernaux (data, auxoffset, &auxmem); + if (unlikely (aux == NULL)) break; printf (gettext (" %#06x: Name: %s Flags: %s Version: %hu\n"), @@ -1998,25 +2113,21 @@ handle_verneed (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) static void -handle_verdef (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_verdef (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { - Elf_Data *data; - int class = gelf_getclass (ebl->elf); - GElf_Shdr glink; - int cnt; - unsigned int offset; - size_t shstrndx; - /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) return; /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); + int class = gelf_getclass (ebl->elf); + GElf_Shdr glink; printf (ngettext ("\ \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ @@ -2032,24 +2143,19 @@ handle_verdef (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink)->sh_name)); - offset = 0; - for (cnt = shdr->sh_info; --cnt >= 0; ) + unsigned int offset = 0; + for (int cnt = shdr->sh_info; --cnt >= 0; ) { - GElf_Verdef defmem; - GElf_Verdef *def; - GElf_Verdaux auxmem; - GElf_Verdaux *aux; - unsigned int auxoffset; - int cnt2; - /* Get the data at the next offset. */ - def = gelf_getverdef (data, offset, &defmem); - if (def == NULL) + GElf_Verdef defmem; + GElf_Verdef *def = gelf_getverdef (data, offset, &defmem); + if (unlikely (def == NULL)) break; - auxoffset = offset + def->vd_aux; - aux = gelf_getverdaux (data, auxoffset, &auxmem); - if (aux == NULL) + unsigned int auxoffset = offset + def->vd_aux; + GElf_Verdaux auxmem; + GElf_Verdaux *aux = gelf_getverdaux (data, auxoffset, &auxmem); + if (unlikely (aux == NULL)) break; printf (gettext ("\ @@ -2061,10 +2167,10 @@ handle_verdef (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) elf_strptr (ebl->elf, shdr->sh_link, aux->vda_name)); auxoffset += aux->vda_next; - for (cnt2 = 1; cnt2 < def->vd_cnt; ++cnt2) + for (int cnt2 = 1; cnt2 < def->vd_cnt; ++cnt2) { aux = gelf_getverdaux (data, auxoffset, &auxmem); - if (aux == NULL) + if (unlikely (aux == NULL)) break; printf (gettext (" %#06x: Parent %d: %s\n"), @@ -2081,42 +2187,35 @@ handle_verdef (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) static void -handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) +handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { - Elf_Data *data; int class = gelf_getclass (ebl->elf); - Elf_Scn *verscn; - GElf_Shdr glink; - Elf_Scn *defscn; - Elf_Scn *needscn; const char **vername; const char **filename; - size_t nvername; - unsigned int cnt; - size_t shstrndx; /* Get the data of the section. */ - data = elf_getdata (scn, NULL); + Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) return; /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); /* We have to find the version definition section and extract the version names. */ - defscn = NULL; - needscn = NULL; + Elf_Scn *defscn = NULL; + Elf_Scn *needscn = NULL; - verscn = NULL; + Elf_Scn *verscn = NULL; while ((verscn = elf_nextscn (ebl->elf, verscn)) != NULL) { GElf_Shdr vershdr_mem; GElf_Shdr *vershdr = gelf_getshdr (verscn, &vershdr_mem); - if (vershdr != NULL) + if (likely (vershdr != NULL)) { if (vershdr->sh_type == SHT_GNU_verdef) defscn = verscn; @@ -2125,6 +2224,7 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) } } + size_t nvername; if (defscn != NULL || needscn != NULL) { /* We have a version information (better should have). Now get @@ -2140,21 +2240,21 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Shdr *defshdr; defdata = elf_getdata (defscn, NULL); - if (defdata == NULL) + if (unlikely (defdata == NULL)) return; defshdr = gelf_getshdr (defscn, &defshdrmem); - if (defshdr == NULL) + if (unlikely (defshdr == NULL)) return; - for (cnt = 0; cnt < defshdr->sh_info; ++cnt) + for (unsigned int cnt = 0; cnt < defshdr->sh_info; ++cnt) { GElf_Verdef defmem; GElf_Verdef *def; /* Get the data at the next offset. */ def = gelf_getverdef (defdata, offset, &defmem); - if (def == NULL) + if (unlikely (def == NULL)) break; nvername = MAX (nvername, (size_t) (def->vd_ndx & 0x7fff)); @@ -2170,14 +2270,14 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Shdr *needshdr; needdata = elf_getdata (needscn, NULL); - if (needdata == NULL) + if (unlikely (needdata == NULL)) return; needshdr = gelf_getshdr (needscn, &needshdrmem); - if (needshdr == NULL) + if (unlikely (needshdr == NULL)) return; - for (cnt = 0; cnt < needshdr->sh_info; ++cnt) + for (unsigned int cnt = 0; cnt < needshdr->sh_info; ++cnt) { GElf_Verneed needmem; GElf_Verneed *need; @@ -2186,7 +2286,7 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) /* Get the data at the next offset. */ need = gelf_getverneed (needdata, offset, &needmem); - if (need == NULL) + if (unlikely (need == NULL)) break; /* Run through the auxiliary entries. */ @@ -2197,7 +2297,7 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Vernaux *aux; aux = gelf_getvernaux (needdata, auxoffset, &auxmem); - if (aux == NULL) + if (unlikely (aux == NULL)) break; nvername = MAX (nvername, @@ -2228,27 +2328,24 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) GElf_Shdr *defshdr; defdata = elf_getdata (defscn, NULL); - if (defdata == NULL) + if (unlikely (defdata == NULL)) return; defshdr = gelf_getshdr (defscn, &defshdrmem); - if (defshdr == NULL) + if (unlikely (defshdr == NULL)) return; - for (cnt = 0; cnt < defshdr->sh_info; ++cnt) + for (unsigned int cnt = 0; cnt < defshdr->sh_info; ++cnt) { - GElf_Verdef defmem; - GElf_Verdef *def; - GElf_Verdaux auxmem; - GElf_Verdaux *aux; /* Get the data at the next offset. */ - def = gelf_getverdef (defdata, offset, &defmem); - if (def == NULL) - break; - - aux = gelf_getverdaux (defdata, offset + def->vd_aux, &auxmem); - if (aux == NULL) + GElf_Verdef defmem; + GElf_Verdef *def = gelf_getverdef (defdata, offset, &defmem); + GElf_Verdaux auxmem; + GElf_Verdaux *aux = gelf_getverdaux (defdata, + offset + def->vd_aux, + &auxmem); + if (unlikely (def == NULL || aux == NULL)) break; vername[def->vd_ndx & 0x7fff] @@ -2261,39 +2358,30 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) if (needscn != NULL) { unsigned int offset = 0; - Elf_Data *needdata; - GElf_Shdr needshdrmem; - GElf_Shdr *needshdr; - needdata = elf_getdata (needscn, NULL); - if (needdata == NULL) - return; - - needshdr = gelf_getshdr (needscn, &needshdrmem); - if (needshdr == NULL) + Elf_Data *needdata = elf_getdata (needscn, NULL); + GElf_Shdr needshdrmem; + GElf_Shdr *needshdr = gelf_getshdr (needscn, &needshdrmem); + if (unlikely (needdata == NULL || needshdr == NULL)) return; - for (cnt = 0; cnt < needshdr->sh_info; ++cnt) + for (unsigned int cnt = 0; cnt < needshdr->sh_info; ++cnt) { - GElf_Verneed needmem; - GElf_Verneed *need; - unsigned int auxoffset; - int cnt2; - /* Get the data at the next offset. */ - need = gelf_getverneed (needdata, offset, &needmem); - if (need == NULL) + GElf_Verneed needmem; + GElf_Verneed *need = gelf_getverneed (needdata, offset, + &needmem); + if (unlikely (need == NULL)) break; /* Run through the auxiliary entries. */ - auxoffset = offset + need->vn_aux; - for (cnt2 = need->vn_cnt; --cnt2 >= 0; ) + unsigned int auxoffset = offset + need->vn_aux; + for (int cnt2 = need->vn_cnt; --cnt2 >= 0; ) { GElf_Vernaux auxmem; - GElf_Vernaux *aux; - - aux = gelf_getvernaux (needdata, auxoffset, &auxmem); - if (aux == NULL) + GElf_Vernaux *aux = gelf_getvernaux (needdata, auxoffset, + &auxmem); + if (unlikely (aux == NULL)) break; vername[aux->vna_other & 0x7fff] @@ -2316,6 +2404,7 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) } /* Print the header. */ + GElf_Shdr glink; printf (ngettext ("\ \nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'", "\ @@ -2332,21 +2421,19 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) &glink)->sh_name)); /* Now we can finally look at the actual contents of this section. */ - for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) + for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) { - GElf_Versym symmem; - GElf_Versym *sym; - ssize_t n; - if (cnt % 2 == 0) printf ("\n %4d:", cnt); - sym = gelf_getversym (data, cnt, &symmem); + GElf_Versym symmem; + GElf_Versym *sym = gelf_getversym (data, cnt, &symmem); if (sym == NULL) break; switch (*sym) { + ssize_t n; case 0: fputs_unlocked (gettext (" 0 *local* "), stdout); @@ -2369,138 +2456,276 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) break; } } - putchar ('\n'); + putchar_unlocked ('\n'); } static void -handle_hash (Ebl *ebl, GElf_Ehdr *ehdr) +print_hash_info (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx, + uint_fast32_t maxlength, Elf32_Word nbucket, + uint_fast32_t nsyms, uint32_t *lengths, const char *extrastr) { - /* Find the symbol table(s). For this we have to search through the - section table. */ - Elf_Scn *scn = NULL; - size_t shstrndx; + uint32_t *counts = (uint32_t *) xcalloc (maxlength + 1, sizeof (uint32_t)); - /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) - error (EXIT_FAILURE, 0, - gettext ("cannot get section header string table index")); + for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) + ++counts[lengths[cnt]]; - while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + GElf_Shdr glink; + printf (ngettext ("\ +\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", + "\ +\nHistogram for bucket list length in section [%2u] '%s' (total of %d buckets):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", + nbucket), + (unsigned int) elf_ndxscn (scn), + elf_strptr (ebl->elf, shstrndx, shdr->sh_name), + (int) nbucket, + gelf_getclass (ebl->elf) == ELFCLASS32 ? 10 : 18, + shdr->sh_addr, + shdr->sh_offset, + (unsigned int) shdr->sh_link, + elf_strptr (ebl->elf, shstrndx, + gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + &glink)->sh_name)); + + if (extrastr != NULL) + fputs (extrastr, stdout); + + if (likely (nbucket > 0)) { - /* Handle the section if it is a symbol table. */ - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + uint64_t success = 0; + + fputs_unlocked (gettext ("\ + Length Number % of total Coverage\n"), stdout); + printf (gettext (" 0 %6" PRIu32 " %5.1f%%\n"), + counts[0], (counts[0] * 100.0) / nbucket); - if (shdr != NULL && shdr->sh_type == SHT_HASH) + uint64_t nzero_counts = 0; + for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt) { - Elf_Data *data = elf_getdata (scn, NULL); - Elf32_Word nbucket; - Elf32_Word nchain; - Elf32_Word *bucket; - Elf32_Word *chain; - uint32_t *lengths; - uint32_t *counts; - Elf32_Word cnt; - Elf32_Word maxlength = 0; - Elf32_Word nsyms = 0; - uint64_t nzero_counts = 0; - GElf_Shdr glink; + nzero_counts += counts[cnt] * cnt; + printf (gettext ("\ +%7d %6" PRIu32 " %5.1f%% %5.1f%%\n"), + (int) cnt, counts[cnt], (counts[cnt] * 100.0) / nbucket, + (nzero_counts * 100.0) / nsyms); + } - if (data == NULL) - { - error (0, 0, gettext ("cannot get data for section %d: %s"), - (int) elf_ndxscn (scn), elf_errmsg (-1)); - continue; - } + Elf32_Word acc = 0; + for (Elf32_Word cnt = 1; cnt <= maxlength; ++cnt) + { + acc += cnt; + success += counts[cnt] * acc; + } + + printf (gettext ("\ + Average number of tests: successful lookup: %f\n\ + unsuccessful lookup: %f\n"), + (double) success / (double) nzero_counts, + (double) nzero_counts / (double) nbucket); + } - nbucket = ((Elf32_Word *) data->d_buf)[0]; - nchain = ((Elf32_Word *) data->d_buf)[1]; - bucket = &((Elf32_Word *) data->d_buf)[2]; - chain = &((Elf32_Word *) data->d_buf)[2 + nbucket]; + free (counts); +} - printf (ngettext ("\ -\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", - "\ -\nHistogram for bucket list length in section [%2u] '%s' (total of %d buckets):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", - nbucket), - (unsigned int) elf_ndxscn (scn), - elf_strptr (ebl->elf, shstrndx, shdr->sh_name), - (int) nbucket, - gelf_getclass (ebl->elf) == ELFCLASS32 ? 10 : 18, - shdr->sh_addr, - shdr->sh_offset, - (unsigned int) shdr->sh_link, - elf_strptr (ebl->elf, shstrndx, - gelf_getshdr (elf_getscn (ebl->elf, - shdr->sh_link), - &glink)->sh_name)); - lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t)); +/* This function handles the traditional System V-style hash table format. */ +static void +handle_sysv_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx) +{ + Elf_Data *data = elf_getdata (scn, NULL); + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get data for section %d: %s"), + (int) elf_ndxscn (scn), elf_errmsg (-1)); + return; + } - for (cnt = 0; cnt < nbucket; ++cnt) - if (bucket[cnt] != 0) - { - Elf32_Word inner; + Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0]; + Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1]; + Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[2]; + Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[2 + nbucket]; - inner = bucket[cnt]; - while (inner > 0 && inner < nchain) - { - ++nsyms; - if (maxlength < ++lengths[cnt]) - ++maxlength; + uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t)); - inner = chain[inner]; - } - } + uint_fast32_t maxlength = 0; + uint_fast32_t nsyms = 0; + for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) + { + Elf32_Word inner = bucket[cnt]; + while (inner > 0 && inner < nchain) + { + ++nsyms; + if (maxlength < ++lengths[cnt]) + ++maxlength; - counts = (uint32_t *) xcalloc (maxlength + 1, sizeof (uint32_t)); + inner = chain[inner]; + } + } - for (cnt = 0; cnt < nbucket; ++cnt) - ++counts[lengths[cnt]]; + print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms, + lengths, NULL); - if (nbucket > 0) - { - uint64_t success = 0; - Elf32_Word acc; + free (lengths); +} - puts (gettext (" Length Number % of total Coverage")); - printf (gettext (" 0 %6" PRIu32 " %5.1f%%\n"), - counts[0], (counts[0] * 100.0) / nbucket); - for (cnt = 1; cnt <= maxlength; ++cnt) - { - nzero_counts += counts[cnt] * cnt; - printf (gettext ("\ -%7d %6" PRIu32 " %5.1f%% %5.1f%%\n"), - (int) cnt, - counts[cnt], (counts[cnt] * 100.0) / nbucket, - (nzero_counts * 100.0) / nsyms); - } +/* This function handles the incorrect, System V-style hash table + format some 64-bit architectures use. */ +static void +handle_sysv_hash64 (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx) +{ + Elf_Data *data = elf_getdata (scn, NULL); + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get data for section %d: %s"), + (int) elf_ndxscn (scn), elf_errmsg (-1)); + return; + } - acc = 0; - for (cnt = 1; cnt <= maxlength; ++cnt) - { - acc += cnt; - success += counts[cnt] * acc; - } + Elf64_Xword nbucket = ((Elf64_Xword *) data->d_buf)[0]; + Elf64_Xword nchain = ((Elf64_Xword *) data->d_buf)[1]; + Elf64_Xword *bucket = &((Elf64_Xword *) data->d_buf)[2]; + Elf64_Xword *chain = &((Elf64_Xword *) data->d_buf)[2 + nbucket]; - printf (gettext ("\ - Average number of tests: successful lookup: %f\n\ - unsuccessful lookup: %f\n"), - (double) success / (double) nzero_counts, - (double) nzero_counts / (double) nbucket); - } + uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t)); - free (counts); - free (lengths); + uint_fast32_t maxlength = 0; + uint_fast32_t nsyms = 0; + for (Elf64_Xword cnt = 0; cnt < nbucket; ++cnt) + { + Elf64_Xword inner = bucket[cnt]; + while (inner > 0 && inner < nchain) + { + ++nsyms; + if (maxlength < ++lengths[cnt]) + ++maxlength; + + inner = chain[inner]; } } + + print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms, + lengths, NULL); + + free (lengths); +} + + +/* This function handles the GNU-style hash table format. */ +static void +handle_gnu_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx) +{ + Elf_Data *data = elf_getdata (scn, NULL); + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get data for section %d: %s"), + (int) elf_ndxscn (scn), elf_errmsg (-1)); + return; + } + + Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0]; + Elf32_Word symbias = ((Elf32_Word *) data->d_buf)[1]; + + /* Next comes the size of the bitmap. It's measured in words for + the architecture. It's 32 bits for 32 bit archs, and 64 bits for + 64 bit archs. */ + Elf32_Word bitmask_words = ((Elf32_Word *) data->d_buf)[2]; + if (gelf_getclass (ebl->elf) == ELFCLASS64) + bitmask_words *= 2; + + Elf32_Word shift = ((Elf32_Word *) data->d_buf)[3]; + + uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t)); + + Elf32_Word *bitmask = &((Elf32_Word *) data->d_buf)[4]; + Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[4 + bitmask_words]; + Elf32_Word *chain = &((Elf32_Word *) data->d_buf)[4 + bitmask_words + + nbucket]; + + /* Compute distribution of chain lengths. */ + uint_fast32_t maxlength = 0; + uint_fast32_t nsyms = 0; + for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) + if (bucket[cnt] != 0) + { + Elf32_Word inner = bucket[cnt] - symbias; + do + { + ++nsyms; + if (maxlength < ++lengths[cnt]) + ++maxlength; + } + while ((chain[inner++] & 1) == 0); + } + + /* Count bits in bitmask. */ + uint_fast32_t nbits = 0; + for (Elf32_Word cnt = 0; cnt < bitmask_words; ++cnt) + { + uint_fast32_t word = bitmask[cnt]; + + word = (word & 0x55555555) + ((word >> 1) & 0x55555555); + word = (word & 0x33333333) + ((word >> 2) & 0x33333333); + word = (word & 0x0f0f0f0f) + ((word >> 4) & 0x0f0f0f0f); + word = (word & 0x00ff00ff) + ((word >> 8) & 0x00ff00ff); + nbits += (word & 0x0000ffff) + ((word >> 16) & 0x0000ffff); + } + + char *str; + if (unlikely (asprintf (&str, gettext ("\ + Symbol Bias: %u\n\ + Bitmask Size: %zu bytes %" PRIuFAST32 "%% bits set 2nd hash shift: %u\n"), + (unsigned int) symbias, + bitmask_words * sizeof (Elf32_Word), + ((nbits * 100 + 50) + / (uint_fast32_t) (bitmask_words + * sizeof (Elf32_Word) * 8)), + (unsigned int) shift) == -1)) + error (EXIT_FAILURE, 0, gettext ("memory exhausted")); + + print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms, + lengths, str); + + free (str); + free (lengths); } +/* Find the symbol table(s). For this we have to search through the + section table. */ static void -print_liblist (Ebl *ebl, GElf_Ehdr *ehdr) +handle_hash (Ebl *ebl) +{ + /* Get the section header string table index. */ + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + /* Handle the section if it is a symbol table. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (likely (shdr != NULL)) + { + if (shdr->sh_type == SHT_HASH) + { + if (ebl_sysvhash_entrysize (ebl) == sizeof (Elf64_Xword)) + handle_sysv_hash64 (ebl, scn, shdr, shstrndx); + else + handle_sysv_hash (ebl, scn, shdr, shstrndx); + } + else if (shdr->sh_type == SHT_GNU_HASH) + handle_gnu_hash (ebl, scn, shdr, shstrndx); + } + } +} + + +static void +print_liblist (Ebl *ebl) { /* Find the library list sections. For this we have to search through the section table. */ @@ -2508,7 +2733,7 @@ print_liblist (Ebl *ebl, GElf_Ehdr *ehdr) /* Get the section header string table index. */ size_t shstrndx; - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -2541,12 +2766,12 @@ print_liblist (Ebl *ebl, GElf_Ehdr *ehdr) { GElf_Lib lib_mem; GElf_Lib *lib = gelf_getlib (data, cnt, &lib_mem); - if (lib == NULL) + if (unlikely (lib == NULL)) continue; time_t t = (time_t) lib->l_time_stamp; struct tm *tm = gmtime (&t); - if (tm == NULL) + if (unlikely (tm == NULL)) continue; printf (" [%2d] %-29s %04u-%02u-%02uT%02u:%02u:%02u %08x %-7u %u\n", @@ -2561,11 +2786,244 @@ print_liblist (Ebl *ebl, GElf_Ehdr *ehdr) } } +static void +print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) +{ + /* Find the object attributes sections. For this we have to search + through the section table. */ + Elf_Scn *scn = NULL; + + /* Get the section header string table index. */ + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL || shdr->sh_type != SHT_GNU_ATTRIBUTES) + continue; + + printf (gettext ("\ +\nObject attributes section [%2zu] '%s' of %" PRIu64 + " bytes at offset %#0" PRIx64 ":\n"), + elf_ndxscn (scn), + elf_strptr (ebl->elf, shstrndx, shdr->sh_name), + shdr->sh_size, shdr->sh_offset); + + Elf_Data *data = elf_rawdata (scn, NULL); + if (data == NULL) + return; + + const unsigned char *p = data->d_buf; + + if (unlikely (*p++ != 'A')) + return; + + fputs_unlocked (gettext (" Owner Size\n"), stdout); + + inline size_t left (void) + { + return (const unsigned char *) data->d_buf + data->d_size - p; + } + + while (left () >= 4) + { + uint32_t len; + memcpy (&len, p, sizeof len); + + if (MY_ELFDATA != ehdr->e_ident[EI_DATA]) + CONVERT (len); + + if (unlikely (len > left ())) + break; + + const unsigned char *name = p + sizeof len; + p += len; + + unsigned const char *q = memchr (name, '\0', len); + if (unlikely (q == NULL)) + continue; + ++q; + + printf (gettext (" %-13s %4" PRIu32 "\n"), name, len); + + if (q - name == sizeof "gnu" + && !memcmp (name, "gnu", sizeof "gnu")) + while (q < p) + { + const unsigned char *const sub = q; + + unsigned int subsection_tag; + get_uleb128 (subsection_tag, q); + if (unlikely (q >= p)) + break; + + uint32_t subsection_len; + if (unlikely (p - sub < (ptrdiff_t) sizeof subsection_len)) + break; + + memcpy (&subsection_len, q, sizeof subsection_len); + + if (MY_ELFDATA != ehdr->e_ident[EI_DATA]) + CONVERT (subsection_len); + + if (unlikely (p - sub < (ptrdiff_t) subsection_len)) + break; + + const unsigned char *r = q + sizeof subsection_len; + q = sub + subsection_len; + + switch (subsection_tag) + { + default: + printf (gettext (" %-4u %12" PRIu32 "\n"), + subsection_tag, subsection_len); + break; + + case 1: /* Tag_File */ + printf (gettext (" File: %11" PRIu32 "\n"), + subsection_len); + + while (r < q) + { + unsigned int tag; + get_uleb128 (tag, r); + if (unlikely (r >= q)) + break; + + uint64_t value = 0; + const char *string = NULL; + if (tag == 32 || (tag & 1) == 0) + { + get_uleb128 (value, r); + if (r > q) + break; + } + if (tag == 32 || (tag & 1) != 0) + { + r = memchr (r, '\0', q - r); + if (r == NULL) + break; + ++r; + } + + const char *tag_name = NULL; + const char *value_name = NULL; + ebl_check_object_attribute (ebl, (const char *) name, + tag, value, + &tag_name, &value_name); + + if (tag_name != NULL) + { + if (tag == 32) + printf (gettext (" %s: %" PRId64 ", %s\n"), + tag_name, value, string); + else if (string == NULL && value_name == NULL) + printf (gettext (" %s: %" PRId64 "\n"), + tag_name, value); + else + printf (gettext (" %s: %s\n"), + tag_name, string ?: value_name); + } + else + { + assert (tag != 32); + if (string == NULL) + printf (gettext (" %u: %" PRId64 "\n"), + tag, value); + else + printf (gettext (" %u: %s\n"), + tag, string); + } + } + } + } + } + } +} + + +static char * +format_dwarf_addr (Dwfl_Module *dwflmod, + int address_size, Dwarf_Addr address) +{ + /* See if there is a name we can give for this address. */ + GElf_Sym sym; + const char *name = dwfl_module_addrsym (dwflmod, address, &sym, NULL); + if (name != NULL) + sym.st_value = address - sym.st_value; + + /* Relativize the address. */ + int n = dwfl_module_relocations (dwflmod); + int i = n < 1 ? -1 : dwfl_module_relocate_address (dwflmod, &address); + + /* In an ET_REL file there is a section name to refer to. */ + const char *scn = (i < 0 ? NULL + : dwfl_module_relocation_info (dwflmod, i, NULL)); + + char *result; + if ((name != NULL + ? (sym.st_value != 0 + ? (scn != NULL + ? (address_size == 0 + ? asprintf (&result, + gettext ("%s+%#" PRIx64 " <%s+%#" PRIx64 ">"), + scn, address, name, sym.st_value) + : asprintf (&result, + gettext ("%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">"), + scn, 2 + address_size * 2, address, + name, sym.st_value)) + : (address_size == 0 + ? asprintf (&result, + gettext ("%#" PRIx64 " <%s+%#" PRIx64 ">"), + address, name, sym.st_value) + : asprintf (&result, + gettext ("%#0*" PRIx64 " <%s+%#" PRIx64 ">"), + 2 + address_size * 2, address, + name, sym.st_value))) + : (scn != NULL + ? (address_size == 0 + ? asprintf (&result, + gettext ("%s+%#" PRIx64 " <%s>"), + scn, address, name) + : asprintf (&result, + gettext ("%s+%#0*" PRIx64 " <%s>"), + scn, 2 + address_size * 2, address, name)) + : (address_size == 0 + ? asprintf (&result, + gettext ("%#" PRIx64 " <%s>"), + address, name) + : asprintf (&result, + gettext ("%#0*" PRIx64 " <%s>"), + 2 + address_size * 2, address, name)))) + : (scn != NULL + ? (address_size == 0 + ? asprintf (&result, + gettext ("%s+%#" PRIx64), + scn, address) + : asprintf (&result, + gettext ("%s+%#0*" PRIx64), + scn, 2 + address_size * 2, address)) + : (address_size == 0 + ? asprintf (&result, + "%#" PRIx64, + address) + : asprintf (&result, + "%#0*" PRIx64, + 2 + address_size * 2, address)))) < 0) + error (EXIT_FAILURE, 0, _("memory exhausted")); + + return result; +} static const char * dwarf_tag_string (unsigned int tag) { - static const char *known_tags[] = + static const char *const known_tags[] = { [DW_TAG_array_type] = "array_type", [DW_TAG_class_type] = "class_type", @@ -2607,23 +3065,34 @@ dwarf_tag_string (unsigned int tag) [DW_TAG_namelist_item] = "namelist_item", [DW_TAG_packed_type] = "packed_type", [DW_TAG_subprogram] = "subprogram", - [DW_TAG_template_type_param] = "template_type_param", - [DW_TAG_template_value_param] = "template_value_param", + [DW_TAG_template_type_parameter] = "template_type_parameter", + [DW_TAG_template_value_parameter] = "template_value_parameter", [DW_TAG_thrown_type] = "thrown_type", [DW_TAG_try_block] = "try_block", [DW_TAG_variant_part] = "variant_part", [DW_TAG_variable] = "variable", [DW_TAG_volatile_type] = "volatile_type", + [DW_TAG_dwarf_procedure] = "dwarf_procedure", + [DW_TAG_restrict_type] = "restrict_type", + [DW_TAG_interface_type] = "interface_type", + [DW_TAG_namespace] = "namespace", + [DW_TAG_imported_module] = "imported_module", + [DW_TAG_unspecified_type] = "unspecified_type", + [DW_TAG_partial_unit] = "partial_unit", + [DW_TAG_imported_unit] = "imported_unit", + [DW_TAG_mutable_type] = "mutable_type", + [DW_TAG_condition] = "condition", + [DW_TAG_shared_type] = "shared_type", }; const unsigned int nknown_tags = (sizeof (known_tags) / sizeof (known_tags[0])); static char buf[40]; const char *result = NULL; - if (tag < nknown_tags) + if (likely (tag < nknown_tags)) result = known_tags[tag]; - if (result == NULL) + if (unlikely (result == NULL)) /* There are a few known extensions. */ switch (tag) { @@ -2659,7 +3128,7 @@ dwarf_tag_string (unsigned int tag) static const char * dwarf_attr_string (unsigned int attrnum) { - static const char *known_attrs[] = + static const char *const known_attrs[] = { [DW_AT_sibling] = "sibling", [DW_AT_location] = "location", @@ -2692,7 +3161,7 @@ dwarf_attr_string (unsigned int attrnum) [DW_AT_prototyped] = "prototyped", [DW_AT_return_addr] = "return_addr", [DW_AT_start_scope] = "start_scope", - [DW_AT_stride_size] = "stride_size", + [DW_AT_bit_stride] = "bit_stride", [DW_AT_upper_bound] = "upper_bound", [DW_AT_abstract_origin] = "abstract_origin", [DW_AT_accessibility] = "accessibility", @@ -2713,7 +3182,7 @@ dwarf_attr_string (unsigned int attrnum) [DW_AT_friend] = "friend", [DW_AT_identifier_case] = "identifier_case", [DW_AT_macro_info] = "macro_info", - [DW_AT_namelist_items] = "namelist_items", + [DW_AT_namelist_item] = "namelist_item", [DW_AT_priority] = "priority", [DW_AT_segment] = "segment", [DW_AT_specification] = "specification", @@ -2722,17 +3191,44 @@ dwarf_attr_string (unsigned int attrnum) [DW_AT_use_location] = "use_location", [DW_AT_variable_parameter] = "variable_parameter", [DW_AT_virtuality] = "virtuality", - [DW_AT_vtable_elem_location] = "vtable_elem_location" + [DW_AT_vtable_elem_location] = "vtable_elem_location", + [DW_AT_allocated] = "allocated", + [DW_AT_associated] = "associated", + [DW_AT_data_location] = "data_location", + [DW_AT_byte_stride] = "byte_stride", + [DW_AT_entry_pc] = "entry_pc", + [DW_AT_use_UTF8] = "use_UTF8", + [DW_AT_extension] = "extension", + [DW_AT_ranges] = "ranges", + [DW_AT_trampoline] = "trampoline", + [DW_AT_call_column] = "call_column", + [DW_AT_call_file] = "call_file", + [DW_AT_call_line] = "call_line", + [DW_AT_description] = "description", + [DW_AT_binary_scale] = "binary_scale", + [DW_AT_decimal_scale] = "decimal_scale", + [DW_AT_small] = "small", + [DW_AT_decimal_sign] = "decimal_sign", + [DW_AT_digit_count] = "digit_count", + [DW_AT_picture_string] = "picture_string", + [DW_AT_mutable] = "mutable", + [DW_AT_threads_scaled] = "threads_scaled", + [DW_AT_explicit] = "explicit", + [DW_AT_object_pointer] = "object_pointer", + [DW_AT_endianity] = "endianity", + [DW_AT_elemental] = "elemental", + [DW_AT_pure] = "pure", + [DW_AT_recursive] = "recursive", }; const unsigned int nknown_attrs = (sizeof (known_attrs) / sizeof (known_attrs[0])); static char buf[40]; const char *result = NULL; - if (attrnum < nknown_attrs) + if (likely (attrnum < nknown_attrs)) result = known_attrs[attrnum]; - if (result == NULL) + if (unlikely (result == NULL)) /* There are a few known extensions. */ switch (attrnum) { @@ -2846,7 +3342,7 @@ dwarf_attr_string (unsigned int attrnum) static const char * dwarf_form_string (unsigned int form) { - static const char *known_forms[] = + static const char *const known_forms[] = { [DW_FORM_addr] = "addr", [DW_FORM_block2] = "block2", @@ -2875,10 +3371,10 @@ dwarf_form_string (unsigned int form) static char buf[40]; const char *result = NULL; - if (form < nknown_forms) + if (likely (form < nknown_forms)) result = known_forms[form]; - if (result == NULL) + if (unlikely (result == NULL)) snprintf (buf, sizeof buf, gettext ("unknown form %" PRIx64), (uint64_t) form); @@ -2889,12 +3385,12 @@ dwarf_form_string (unsigned int form) static const char * dwarf_lang_string (unsigned int lang) { - static const char *known[] = + static const char *const known[] = { [DW_LANG_C89] = "ISO C89", [DW_LANG_C] = "C", [DW_LANG_Ada83] = "Ada83", - [DW_LANG_C_plus_plus ] = "C++", + [DW_LANG_C_plus_plus] = "C++", [DW_LANG_Cobol74] = "Cobol74", [DW_LANG_Cobol85] = "Cobol85", [DW_LANG_Fortran77] = "Fortran77", @@ -2905,10 +3401,14 @@ dwarf_lang_string (unsigned int lang) [DW_LANG_C99] = "ISO C99", [DW_LANG_Ada95] = "Ada95", [DW_LANG_Fortran95] = "Fortran95", - [DW_LANG_PL1] = "PL1" + [DW_LANG_PL1] = "PL1", + [DW_LANG_Objc] = "Objective C", + [DW_LANG_ObjC_plus_plus] = "Objective C++", + [DW_LANG_UPC] = "UPC", + [DW_LANG_D] = "D", }; - if (lang < sizeof (known) / sizeof (known[0])) + if (likely (lang < sizeof (known) / sizeof (known[0]))) return known[lang]; else if (lang == DW_LANG_Mips_Assembler) /* This language tag is used for assembler in general. */ @@ -2916,7 +3416,7 @@ dwarf_lang_string (unsigned int lang) if (lang >= DW_LANG_lo_user && lang <= DW_LANG_hi_user) { - static char buf[100]; + static char buf[30]; snprintf (buf, sizeof (buf), "lo_user+%u", lang - DW_LANG_lo_user); return buf; } @@ -2925,11 +3425,191 @@ dwarf_lang_string (unsigned int lang) } +static const char * +dwarf_inline_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_INL_not_inlined] = "not_inlined", + [DW_INL_inlined] = "inlined", + [DW_INL_declared_not_inlined] = "declared_not_inlined", + [DW_INL_declared_inlined] = "declared_inlined" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_encoding_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_ATE_void] = "void", + [DW_ATE_address] = "address", + [DW_ATE_boolean] = "boolean", + [DW_ATE_complex_float] = "complex_float", + [DW_ATE_float] = "float", + [DW_ATE_signed] = "signed", + [DW_ATE_signed_char] = "signed_char", + [DW_ATE_unsigned] = "unsigned", + [DW_ATE_unsigned_char] = "unsigned_char", + [DW_ATE_imaginary_float] = "imaginary_float", + [DW_ATE_packed_decimal] = "packed_decimal", + [DW_ATE_numeric_string] = "numeric_string", + [DW_ATE_edited] = "edited", + [DW_ATE_signed_fixed] = "signed_fixed", + [DW_ATE_unsigned_fixed] = "unsigned_fixed", + [DW_ATE_decimal_float] = "decimal_float", + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + if (code >= DW_ATE_lo_user && code <= DW_ATE_hi_user) + { + static char buf[30]; + snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_ATE_lo_user); + return buf; + } + + return "???"; +} + + +static const char * +dwarf_access_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_ACCESS_public] = "public", + [DW_ACCESS_protected] = "protected", + [DW_ACCESS_private] = "private" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_visibility_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_VIS_local] = "local", + [DW_VIS_exported] = "exported", + [DW_VIS_qualified] = "qualified" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_virtuality_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_VIRTUALITY_none] = "none", + [DW_VIRTUALITY_virtual] = "virtual", + [DW_VIRTUALITY_pure_virtual] = "pure_virtual" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_identifier_case_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_ID_case_sensitive] = "sensitive", + [DW_ID_up_case] = "up_case", + [DW_ID_down_case] = "down_case", + [DW_ID_case_insensitive] = "insensitive" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_calling_convention_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_CC_normal] = "normal", + [DW_CC_program] = "program", + [DW_CC_nocall] = "nocall", + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + if (code >= DW_CC_lo_user && code <= DW_CC_hi_user) + { + static char buf[30]; + snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_CC_lo_user); + return buf; + } + + return "???"; +} + + +static const char * +dwarf_ordering_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_ORD_row_major] = "row_major", + [DW_ORD_col_major] = "col_major" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + +static const char * +dwarf_discr_list_string (unsigned int code) +{ + static const char *const known[] = + { + [DW_DSC_label] = "label", + [DW_DSC_range] = "range" + }; + + if (likely (code < sizeof (known) / sizeof (known[0]))) + return known[code]; + + return "???"; +} + + static void -print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, - unsigned char *data) +print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, + unsigned int addrsize, Dwarf_Word len, const unsigned char *data) { - static const char *known[] = + static const char *const known[] = { [DW_OP_addr] = "addr", [DW_OP_deref] = "deref", @@ -3080,13 +3760,15 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, [DW_OP_call2] = "call2", [DW_OP_call4] = "call4", [DW_OP_call_ref] = "call_ref", + [DW_OP_form_tls_address] = "form_tls_address", + [DW_OP_call_frame_cfa] = "call_frame_cfa", + [DW_OP_bit_piece] = "bit_piece", }; Dwarf_Word offset = 0; while (len-- > 0) { - size_t op = *((unsigned char *) data); - ++data; + uint_fast8_t op = *data++; switch (op) { @@ -3104,18 +3786,27 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, data += addrsize; len -= addrsize; - printf (" %*s [%4" PRIuMAX "] %s %" PRIuMAX "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, - known[op] ?: "???", (uintmax_t) addr); + if (op == DW_OP_addr) + { + char *a = format_dwarf_addr (dwflmod, 0, addr); + printf ("%*s[%4" PRIuMAX "] %s %s\n", + indent, "", (uintmax_t) offset, + known[op] ?: "???", a); + free (a); + } + else + printf ("%*s[%4" PRIuMAX "] %s %#" PRIxMAX "\n", + indent, "", (uintmax_t) offset, + known[op] ?: "???", (uintmax_t) addr); offset += 1 + addrsize; break; - case DW_OP_deref_size: /* XXX Correct? */ - case DW_OP_xderef_size: /* XXX Correct? */ + case DW_OP_deref_size: + case DW_OP_xderef_size: case DW_OP_pick: case DW_OP_const1u: - printf (" %*s [%4" PRIuMAX "] %s %" PRIu8 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRIu8 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", *((uint8_t *) data)); ++data; --len; @@ -3123,8 +3814,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const2u: - printf (" %*s [%4" PRIuMAX "] %s %" PRIu16 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRIu16 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_2ubyte_unaligned (dbg, data)); len -= 2; data += 2; @@ -3132,8 +3823,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const4u: - printf (" %*s [%4" PRIuMAX "] %s %" PRIu32 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRIu32 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_4ubyte_unaligned (dbg, data)); len -= 4; data += 4; @@ -3141,8 +3832,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const8u: - printf (" %*s [%4" PRIuMAX "] %s %" PRIu64 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRIu64 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_8ubyte_unaligned (dbg, data)); len -= 8; data += 8; @@ -3150,8 +3841,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const1s: - printf (" %*s [%4" PRIuMAX "] %s %" PRId8 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRId8 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", *((int8_t *) data)); ++data; --len; @@ -3159,8 +3850,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const2s: - printf (" %*s [%4" PRIuMAX "] %s %" PRId16 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRId16 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_2sbyte_unaligned (dbg, data)); len -= 2; data += 2; @@ -3168,8 +3859,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const4s: - printf (" %*s [%4" PRIuMAX "] %s %" PRId32 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRId32 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_4sbyte_unaligned (dbg, data)); len -= 4; data += 4; @@ -3177,36 +3868,48 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, break; case DW_OP_const8s: - printf (" %*s [%4" PRIuMAX "] %s %" PRId64 "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRId64 "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", read_8sbyte_unaligned (dbg, data)); len -= 8; data += 8; offset += 9; break; - case DW_OP_piece: /* XXX Correct? */ + case DW_OP_piece: case DW_OP_regx: case DW_OP_plus_uconst: case DW_OP_constu:; - unsigned char *start = data; + const unsigned char *start = data; unsigned int uleb; get_uleb128 (uleb, data); - printf (" %*s [%4" PRIuMAX "] %s %u\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %u\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", uleb); len -= data - start; offset += 1 + (data - start); break; + case DW_OP_bit_piece: + start = data; + unsigned int uleb2; + get_uleb128 (uleb, data); + get_uleb128 (uleb2, data); + printf ("%*s[%4" PRIuMAX "] %s %u, %u\n", + indent, "", (uintmax_t) offset, + known[op] ?: "???", uleb, uleb2); + len -= data - start; + offset += 1 + (data - start); + break; + case DW_OP_fbreg: case DW_OP_breg0 ... DW_OP_breg31: case DW_OP_consts: start = data; unsigned int sleb; get_sleb128 (sleb, data); - printf (" %*s [%4" PRIuMAX "] %s %d\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %d\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", sleb); len -= data - start; offset += 1 + (data - start); @@ -3216,8 +3919,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, start = data; get_uleb128 (uleb, data); get_sleb128 (sleb, data); - printf (" %*s [%4" PRIuMAX "] %s %u %d\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %u %d\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", uleb, sleb); len -= data - start; offset += 1 + (data - start); @@ -3227,8 +3930,8 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, case DW_OP_call4: case DW_OP_skip: case DW_OP_bra: - printf (" %*s [%4" PRIuMAX "] %s %" PRIuMAX "\n", - (int) (20 + level * 2), "", (uintmax_t) offset, + printf ("%*s[%4" PRIuMAX "] %s %" PRIuMAX "\n", + indent, "", (uintmax_t) offset, known[op] ?: "???", (uintmax_t) (offset + read_2sbyte_unaligned (dbg, data))); len -= 2; @@ -3238,18 +3941,26 @@ print_ops (Dwarf *dbg, int level, unsigned int addrsize, Dwarf_Word len, default: /* No Operand. */ - printf (" %*s [%4" PRIuMAX "] %s\n", - (int) (20 + level * 2), "", (uintmax_t) offset, - known[op] ?: "???"); + if (op < sizeof known / sizeof known[0] && known[op] != NULL) + printf ("%*s[%4" PRIuMAX "] %s\n", + indent, "", (uintmax_t) offset, known[op]); + else + printf ("%*s[%4" PRIuMAX "] %#x\n", + indent, "", (uintmax_t) offset, op); ++offset; break; } + + indent = indentrest; } } static void -print_debug_abbrev_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +print_debug_abbrev_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\nDWARF section '%s' at offset %#" PRIx64 ":\n" @@ -3257,47 +3968,59 @@ print_debug_abbrev_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, ".debug_abbrev", (uint64_t) shdr->sh_offset); Dwarf_Off offset = 0; - while (1) + while (offset < shdr->sh_size) { - size_t length; - Dwarf_Abbrev abbrev; + printf (gettext ("\nAbbreviation section at offset %" PRIu64 ":\n"), + offset); - if (dwarf_offabbrev (dbg, offset, &length, &abbrev) != 0) + while (1) { - printf (gettext (" *** error while reading abbreviation: %s\n"), - dwarf_errmsg (-1)); - break; - } + size_t length; + Dwarf_Abbrev abbrev; - if (length == 1) - /* This is the NUL byte at the end of the section. */ - break; + int res = dwarf_offabbrev (dbg, offset, &length, &abbrev); + if (res != 0) + { + if (unlikely (res < 0)) + { + printf (gettext ("\ + *** error while reading abbreviation: %s\n"), + dwarf_errmsg (-1)); + return; + } - /* We know these calls can never fail. */ - unsigned int code = dwarf_getabbrevcode (&abbrev); - unsigned int tag = dwarf_getabbrevtag (&abbrev); - int has_children = dwarf_abbrevhaschildren (&abbrev); + /* This is the NUL byte at the end of the section. */ + ++offset; + break; + } - printf (gettext (" [%5u] offset: %" PRId64 - ", children: %s, tag: %s\n"), - code, (int64_t) offset, - has_children ? gettext ("yes") : gettext ("no"), - dwarf_tag_string (tag)); + /* We know these calls can never fail. */ + unsigned int code = dwarf_getabbrevcode (&abbrev); + unsigned int tag = dwarf_getabbrevtag (&abbrev); + int has_children = dwarf_abbrevhaschildren (&abbrev); + + printf (gettext (" [%5u] offset: %" PRId64 + ", children: %s, tag: %s\n"), + code, (int64_t) offset, + has_children ? gettext ("yes") : gettext ("no"), + dwarf_tag_string (tag)); + + size_t cnt = 0; + unsigned int name; + unsigned int form; + Dwarf_Off enoffset; + while (dwarf_getabbrevattr (&abbrev, cnt, + &name, &form, &enoffset) == 0) + { + printf (" attr: %s, form: %s, offset: %#" PRIx64 "\n", + dwarf_attr_string (name), dwarf_form_string (form), + (uint64_t) enoffset); - size_t cnt = 0; - unsigned int name; - unsigned int form; - Dwarf_Off enoffset; - while (dwarf_getabbrevattr (&abbrev, cnt, &name, &form, &enoffset) == 0) - { - printf (" attr: %s, form: %s, offset: %#" PRIx64 "\n", - dwarf_attr_string (name), dwarf_form_string (form), - (uint64_t) enoffset); + ++cnt; + } - ++cnt; + offset += length; } - - offset += length; } } @@ -3306,12 +4029,15 @@ print_debug_abbrev_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, not have to know a bit about the structure of the section, libdwarf takes care of it. */ static void -print_debug_aranges_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), GElf_Shdr *shdr, Dwarf *dbg) { Dwarf_Aranges *aranges; size_t cnt; - if (dwarf_getaranges (dbg, &aranges, &cnt) != 0) + if (unlikely (dwarf_getaranges (dbg, &aranges, &cnt) != 0)) { error (0, 0, gettext ("cannot get .debug_aranges content: %s"), dwarf_errmsg (-1)); @@ -3337,7 +4063,7 @@ print_debug_aranges_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, for (size_t n = 0; n < cnt; ++n) { Dwarf_Arange *runp = dwarf_onearange (aranges, n); - if (runp == NULL) + if (unlikely (runp == NULL)) { printf ("cannot get arange %zu: %s\n", n, dwarf_errmsg (-1)); return; @@ -3347,7 +4073,7 @@ print_debug_aranges_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Dwarf_Word length; Dwarf_Off offset; - if (dwarf_getarangeinfo (runp, &start, &length, &offset) != 0) + if (unlikely (dwarf_getarangeinfo (runp, &start, &length, &offset) != 0)) printf (gettext (" [%*zu] ???\n"), digits, n); else printf (gettext (" [%*zu] start: %0#*" PRIx64 @@ -3358,16 +4084,95 @@ print_debug_aranges_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, } } +/* Print content of DWARF .debug_ranges section. */ +static void +print_debug_ranges_section (Dwfl_Module *dwflmod, + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr, + Dwarf *dbg) +{ + Elf_Data *data = elf_rawdata (scn, NULL); + + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get .debug_ranges content: %s"), + elf_errmsg (-1)); + return; + } + + printf (gettext ("\ +\nDWARF section '%s' at offset %#" PRIx64 ":\n"), + ".debug_ranges", (uint64_t) shdr->sh_offset); + + size_t address_size = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + + bool first = true; + unsigned char *readp = data->d_buf; + while (readp < (unsigned char *) data->d_buf + data->d_size) + { + ptrdiff_t offset = readp - (unsigned char *) data->d_buf; + + if (unlikely (data->d_size - offset < address_size * 2)) + { + printf (gettext (" [%6tx] <INVALID DATA>\n"), offset); + break; + } + + Dwarf_Addr begin; + Dwarf_Addr end; + if (address_size == 8) + { + begin = read_8ubyte_unaligned_inc (dbg, readp); + end = read_8ubyte_unaligned_inc (dbg, readp); + } + else + { + begin = read_4ubyte_unaligned_inc (dbg, readp); + end = read_4ubyte_unaligned_inc (dbg, readp); + if (begin == (Dwarf_Addr) (uint32_t) -1) + begin = (Dwarf_Addr) -1l; + } + + if (begin == (Dwarf_Addr) -1l) /* Base address entry. */ + { + char *b = format_dwarf_addr (dwflmod, address_size, end); + printf (gettext (" [%6tx] base address %s\n"), offset, b); + free (b); + } + else if (begin == 0 && end == 0) /* End of list entry. */ + first = true; + else + { + char *b = format_dwarf_addr (dwflmod, address_size, begin); + char *e = format_dwarf_addr (dwflmod, address_size, end); + /* We have an address range entry. */ + if (first) /* First address range entry in a list. */ + printf (gettext (" [%6tx] %s..%s\n"), offset, b, e); + else + printf (gettext (" %s..%s\n"), b, e); + free (b); + free (e); + + first = false; + } + } +} + static void -print_debug_frame_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr, Dwarf *dbg) +print_debug_frame_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), + GElf_Shdr *shdr __attribute__ ((unused)), + Dwarf *dbg __attribute__ ((unused))) { } struct attrcb_args { + Dwfl_Module *dwflmod; Dwarf *dbg; int level; unsigned int addrsize; @@ -3399,18 +4204,21 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) switch (form) { - case DW_FORM_addr:; - Dwarf_Addr addr; - if (unlikely (dwarf_formaddr (attrp, &addr) != 0)) - { - attrval_out: - error (0, 0, gettext ("cannot get attribute value: %s"), - dwarf_errmsg (-1)); - return DWARF_CB_ABORT; - } - printf (" %*s%-20s %#0*" PRIxMAX "\n", - (int) (level * 2), "", dwarf_attr_string (attr), - (int) (cbargs->addrsize * 2), (uintmax_t) addr); + case DW_FORM_addr: + { + Dwarf_Addr addr; + if (unlikely (dwarf_formaddr (attrp, &addr) != 0)) + { + attrval_out: + error (0, 0, gettext ("cannot get attribute value: %s"), + dwarf_errmsg (-1)); + return DWARF_CB_ABORT; + } + char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize, addr); + printf (" %*s%-20s %s\n", + (int) (level * 2), "", dwarf_attr_string (attr), a); + free (a); + } break; case DW_FORM_indirect: @@ -3429,13 +4237,13 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) case DW_FORM_ref4: case DW_FORM_ref2: case DW_FORM_ref1:; - Dwarf_Off ref; - if (unlikely (dwarf_formref (attrp, &ref) != 0)) + Dwarf_Die ref; + if (unlikely (dwarf_formref_die (attrp, &ref) == NULL)) goto attrval_out; printf (" %*s%-20s [%6" PRIxMAX "]\n", (int) (level * 2), "", dwarf_attr_string (attr), - (uintmax_t) (ref + cbargs->cu_offset)); + (uintmax_t) dwarf_dieoffset (&ref)); break; case DW_FORM_udata: @@ -3448,17 +4256,72 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) if (unlikely (dwarf_formudata (attrp, &num) != 0)) goto attrval_out; - if (attr == DW_AT_language) + const char *valuestr = NULL; + switch (attr) { - printf (" %*s%-20s %s (%d)\n", + case DW_AT_location: + case DW_AT_data_location: + case DW_AT_data_member_location: + case DW_AT_vtable_elem_location: + case DW_AT_string_length: + case DW_AT_use_location: + case DW_AT_frame_base: + case DW_AT_return_addr: + case DW_AT_static_link: + printf (" %*s%-20s location list [%6" PRIxMAX "]\n", (int) (level * 2), "", dwarf_attr_string (attr), - dwarf_lang_string (num), (int) num); + (uintmax_t) num); + return DWARF_CB_OK; + + case DW_AT_ranges: + printf (" %*s%-20s range list [%6" PRIxMAX "]\n", + (int) (level * 2), "", dwarf_attr_string (attr), + (uintmax_t) num); + return DWARF_CB_OK; + + case DW_AT_language: + valuestr = dwarf_lang_string (num); + break; + case DW_AT_encoding: + valuestr = dwarf_encoding_string (num); + break; + case DW_AT_accessibility: + valuestr = dwarf_access_string (num); + break; + case DW_AT_visibility: + valuestr = dwarf_visibility_string (num); + break; + case DW_AT_virtuality: + valuestr = dwarf_virtuality_string (num); + break; + case DW_AT_identifier_case: + valuestr = dwarf_identifier_case_string (num); + break; + case DW_AT_calling_convention: + valuestr = dwarf_calling_convention_string (num); + break; + case DW_AT_inline: + valuestr = dwarf_inline_string (num); + break; + case DW_AT_ordering: + valuestr = dwarf_ordering_string (num); + break; + case DW_AT_discr_list: + valuestr = dwarf_discr_list_string (num); + break; + default: + /* Nothing. */ break; } - printf (" %*s%-20s %" PRIuMAX "\n", - (int) (level * 2), "", dwarf_attr_string (attr), - (uintmax_t) num); + if (valuestr == NULL) + printf (" %*s%-20s %" PRIuMAX "\n", + (int) (level * 2), "", dwarf_attr_string (attr), + (uintmax_t) num); + else + printf (" %*s%-20s %s (%" PRIuMAX ")\n", + (int) (level * 2), "", dwarf_attr_string (attr), + valuestr, (uintmax_t) num); break; case DW_FORM_flag:; @@ -3483,9 +4346,32 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) (int) (level * 2), "", dwarf_attr_string (attr), (uintmax_t) block.length); - if (attr == DW_AT_data_member_location) - print_ops (cbargs->dbg, level, cbargs->addrsize, block.length, - block.data); + switch (attr) + { + case DW_AT_location: + case DW_AT_data_location: + case DW_AT_data_member_location: + case DW_AT_vtable_elem_location: + case DW_AT_string_length: + case DW_AT_use_location: + case DW_AT_frame_base: + case DW_AT_return_addr: + case DW_AT_static_link: + case DW_AT_allocated: + case DW_AT_associated: + case DW_AT_bit_size: + case DW_AT_bit_offset: + case DW_AT_bit_stride: + case DW_AT_byte_size: + case DW_AT_byte_stride: + case DW_AT_count: + case DW_AT_lower_bound: + case DW_AT_upper_bound: + print_ops (cbargs->dwflmod, cbargs->dbg, + 12 + level * 2, 12 + level * 2, + cbargs->addrsize, block.length, block.data); + break; + } break; default: @@ -3500,7 +4386,10 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) static void -print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +print_debug_info_section (Dwfl_Module *dwflmod, + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ @@ -3511,7 +4400,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, if (shdr->sh_size == 0) return; - size_t maxdies = 20; + int maxdies = 20; Dwarf_Die *dies = (Dwarf_Die *) xmalloc (maxdies * sizeof (Dwarf_Die)); Dwarf_Off offset = 0; @@ -3535,6 +4424,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, struct attrcb_args args; + args.dwflmod = dwflmod; args.dbg = dbg; args.addrsize = addrsize; args.cu_offset = offset; @@ -3554,7 +4444,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, do { offset = dwarf_dieoffset (&dies[level]); - if (offset == -1l) + if (unlikely (offset == ~0ul)) { error (0, 0, gettext ("cannot get DIE offset: %s"), dwarf_errmsg (-1)); @@ -3562,7 +4452,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, } int tag = dwarf_tag (&dies[level]); - if (tag == DW_TAG_invalid) + if (unlikely (tag == DW_TAG_invalid)) { error (0, 0, gettext ("cannot get tag of DIE at offset %" PRIu64 " in section '%s': %s"), @@ -3570,93 +4460,9 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, goto do_return; } - static const char *const lowtags[] = - { - [DW_TAG_array_type] = "array_type", - [DW_TAG_class_type] = "class_type", - [DW_TAG_entry_point] = "entry_point", - [DW_TAG_enumeration_type] = "enumeration_type", - [DW_TAG_formal_parameter] = "formal_parameter", - [DW_TAG_imported_declaration] = "imported_declaration", - [DW_TAG_label] = "label", - [DW_TAG_lexical_block] = "lexical_block", - [DW_TAG_member] = "member", - [DW_TAG_pointer_type] = "pointer_type", - [DW_TAG_reference_type] = "reference_type", - [DW_TAG_compile_unit] = "compile_unit", - [DW_TAG_string_type] = "string_type", - [DW_TAG_structure_type] = "structure_type", - [DW_TAG_subroutine_type] = "subroutine_type", - [DW_TAG_typedef] = "typedef", - [DW_TAG_union_type] = "union_type", - [DW_TAG_unspecified_parameters] = "unspecified_parameters", - [DW_TAG_variant] = "variant", - [DW_TAG_common_block] = "common_block", - [DW_TAG_common_inclusion] = "common_inclusion", - [DW_TAG_inheritance] = "inheritance", - [DW_TAG_inlined_subroutine] = "inlined_subroutine", - [DW_TAG_module] = "module", - [DW_TAG_ptr_to_member_type] = "ptr_to_member_type", - [DW_TAG_set_type] = "set_type", - [DW_TAG_subrange_type] = "subrange_type", - [DW_TAG_with_stmt] = "with_stmt", - [DW_TAG_access_declaration] = "access_declaration", - [DW_TAG_base_type] = "base_type", - [DW_TAG_catch_block] = "catch_block", - [DW_TAG_const_type] = "const_type", - [DW_TAG_constant] = "constant", - [DW_TAG_enumerator] = "enumerator", - [DW_TAG_file_type] = "file_type", - [DW_TAG_friend] = "friend", - [DW_TAG_namelist] = "namelist", - [DW_TAG_namelist_item] = "namelist_item", - [DW_TAG_packed_type] = "packed_type", - [DW_TAG_subprogram] = "subprogram", - [DW_TAG_template_type_param] = "template_type_param", - [DW_TAG_template_value_param] = "template_value_param", - [DW_TAG_thrown_type] = "thrown_type", - [DW_TAG_try_block] = "try_block", - [DW_TAG_variant_part] = "variant_part", - [DW_TAG_variable] = "variable", - [DW_TAG_volatile_type] = "volatile_type" - }; - - const char *tagstr; - switch (tag) - { - case DW_TAG_lo_user: - tagstr = "lo_user"; - break; - - case DW_TAG_MIPS_loop: - tagstr = "MIPS_loop"; - break; - - case DW_TAG_format_label: - tagstr = "format_label"; - break; - - case DW_TAG_function_template: - tagstr = "function_template"; - break; - - case DW_TAG_class_template: - tagstr = "class_template"; - break; - case DW_TAG_hi_user: - tagstr = "hi_user"; - break; - - default: - if (tag < sizeof (lowtags) / sizeof (lowtags[0])) - tagstr = lowtags[tag]; - else - tagstr = "???"; - break; - } - printf (" [%6" PRIx64 "] %*s%s\n", - (uint64_t) offset, (int) (level * 2), "", tagstr); + (uint64_t) offset, (int) (level * 2), "", + dwarf_tag_string (tag)); /* Print the attribute values. */ args.level = level; @@ -3675,7 +4481,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, if (level-- == 0) break; - if (res == -1) + if (unlikely (res == -1)) { error (0, 0, gettext ("cannot get next DIE: %s\n"), dwarf_errmsg (-1)); @@ -3703,8 +4509,9 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, static void -print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr, Dwarf *dbg) +print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ \nDWARF section '%s' at offset %#" PRIx64 ":\n"), @@ -3716,7 +4523,7 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, /* There is no functionality in libdw to read the information in the way it is represented here. Hardcode the decoder. */ Elf_Data *data = elf_getdata (scn, NULL); - if (data == NULL || data->d_buf == NULL) + if (unlikely (data == NULL || data->d_buf == NULL)) { error (0, 0, gettext ("cannot get line data section data: %s"), elf_errmsg (-1)); @@ -3731,6 +4538,8 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, { size_t start_offset = linep - (const unsigned char *) data->d_buf; + printf (gettext ("\nTable at offset %Zu:\n"), start_offset); + Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep); unsigned int length = 4; if (unlikely (unit_length == 0xffffffff)) @@ -3797,7 +4606,15 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, line_range, opcode_base); if (unlikely (linep + opcode_base - 1 >= lineendp)) - goto invalid_data; + { + invalid_unit: + error (0, 0, + gettext ("invalid data at offset %tu in section [%zu] '%s'"), + linep - (const unsigned char *) data->d_buf, + elf_ndxscn (scn), ".debug_line"); + linep = lineendp; + continue; + } int opcode_base_l10 = 1; unsigned int tmp = opcode_base; while (tmp > 10) @@ -3813,14 +4630,14 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, opcode_base_l10, cnt, linep[cnt - 1]); linep += opcode_base - 1; if (unlikely (linep >= lineendp)) - goto invalid_data; + goto invalid_unit; puts (gettext ("\nDirectory table:")); while (*linep != 0) { unsigned char *endp = memchr (linep, '\0', lineendp - linep); - if (endp == NULL) - goto invalid_data; + if (unlikely (endp == NULL)) + goto invalid_unit; printf (" %s\n", (char *) linep); @@ -3830,7 +4647,7 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, ++linep; if (unlikely (linep >= lineendp)) - goto invalid_data; + goto invalid_unit; puts (gettext ("\nFile name table:\n" " Entry Dir Time Size Name")); for (unsigned int cnt = 1; *linep != 0; ++cnt) @@ -3838,8 +4655,8 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, /* First comes the file name. */ char *fname = (char *) linep; unsigned char *endp = memchr (fname, '\0', lineendp - linep); - if (endp == NULL) - goto invalid_data; + if (unlikely (endp == NULL)) + goto invalid_unit; linep = endp + 1; /* Then the index. */ @@ -3920,22 +4737,23 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, line += line_increment; address += address_increment; + char *a = format_dwarf_addr (dwflmod, 0, address); printf (gettext ("\ - special opcode %u: address+%u = %#" PRIx64 ", line%+d = %zu\n"), - opcode, address_increment, (uint64_t) address, - line_increment, line); + special opcode %u: address+%u = %s, line%+d = %zu\n"), + opcode, address_increment, a, line_increment, line); + free (a); } else if (opcode == 0) { /* This an extended opcode. */ if (unlikely (linep + 2 > lineendp)) - goto invalid_data; + goto invalid_unit; /* The length. */ unsigned int len = *linep++; if (unlikely (linep + len > lineendp)) - goto invalid_data; + goto invalid_unit; /* The sub-opcode. */ opcode = *linep++; @@ -3958,8 +4776,11 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, address = read_4ubyte_unaligned_inc (dbg, linep); else address = read_8ubyte_unaligned_inc (dbg, linep); - printf (gettext ("set address to %#" PRIx64 "\n"), - (uint64_t) address); + { + char *a = format_dwarf_addr (dwflmod, 0, address); + printf (gettext ("set address to %s\n"), a); + free (a); + } break; case DW_LNE_define_file: @@ -3967,8 +4788,8 @@ print_debug_line_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, char *fname = (char *) linep; unsigned char *endp = memchr (linep, '\0', lineendp - linep); - if (endp == NULL) - goto invalid_data; + if (unlikely (endp == NULL)) + goto invalid_unit; linep = endp + 1; unsigned int diridx; @@ -3992,7 +4813,7 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), break; } } - else if (opcode <= DW_LNS_set_epilog_begin) + else if (opcode <= DW_LNS_set_epilogue_begin) { /* This is a known standard opcode. */ switch (opcode) @@ -4007,9 +4828,12 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), address. */ get_uleb128 (u128, linep); address += minimum_instr_len * u128; - printf (gettext ("\ - advance address by %u to %#" PRIx64 "\n"), - u128, (uint64_t) address); + { + char *a = format_dwarf_addr (dwflmod, 0, address); + printf (gettext ("advance address by %u to %s\n"), + u128, a); + free (a); + } break; case DW_LNS_advance_line: @@ -4032,7 +4856,7 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), case DW_LNS_set_column: /* Takes one uleb128 parameter which is stored in column. */ if (unlikely (standard_opcode_lengths[opcode] != 1)) - goto invalid_data; + goto invalid_unit; get_uleb128 (u128, linep); printf (gettext (" set column to %" PRIu64 "\n"), @@ -4056,22 +4880,29 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), u128 = (minimum_instr_len * ((255 - opcode_base) / line_range)); address += u128; - printf (gettext ("\ - advance address by constant %u to %#" PRIx64 "\n"), - u128, (uint64_t) address); + { + char *a = format_dwarf_addr (dwflmod, 0, address); + printf (gettext ("advance address by constant %u to %s\n"), + u128, a); + free (a); + } break; case DW_LNS_fixed_advance_pc: /* Takes one 16 bit parameter which is added to the address. */ if (unlikely (standard_opcode_lengths[opcode] != 1)) - goto invalid_data; + goto invalid_unit; u128 = read_2ubyte_unaligned_inc (dbg, linep); address += u128; - printf (gettext ("\ - advance address by fixed value %u to %#" PRIx64 "\n"), - u128, (uint64_t) address); + { + char *a = format_dwarf_addr (dwflmod, 0, address); + printf (gettext ("\ +advance address by fixed value %u to %s\n"), + u128, a); + free (a); + } break; case DW_LNS_set_prologue_end: @@ -4079,7 +4910,7 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), puts (gettext (" set prologue end flag")); break; - case DW_LNS_set_epilog_begin: + case DW_LNS_set_epilogue_begin: /* Takes no argument. */ puts (gettext (" set epilogue begin flag")); break; @@ -4114,16 +4945,87 @@ define new file: dir=%u, mtime=%" PRIu64 ", length=%" PRIu64 ", name=%s\n"), static void -print_debug_loc_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr, Dwarf *dbg) +print_debug_loc_section (Dwfl_Module *dwflmod, + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), + GElf_Shdr *shdr, + Dwarf *dbg __attribute__ ((unused))) { + Elf_Data *data = elf_rawdata (scn, NULL); + + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get .debug_loc content: %s"), + elf_errmsg (-1)); + return; + } + printf (gettext ("\ \nDWARF section '%s' at offset %#" PRIx64 ":\n"), ".debug_loc", (uint64_t) shdr->sh_offset); - // XXX add something -} + size_t address_size = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + + bool first = true; + unsigned char *readp = data->d_buf; + while (readp < (unsigned char *) data->d_buf + data->d_size) + { + ptrdiff_t offset = readp - (unsigned char *) data->d_buf; + if (unlikely (data->d_size - offset < address_size * 2)) + { + printf (gettext (" [%6tx] <INVALID DATA>\n"), offset); + break; + } + + Dwarf_Addr begin; + Dwarf_Addr end; + if (address_size == 8) + { + begin = read_8ubyte_unaligned_inc (dbg, readp); + end = read_8ubyte_unaligned_inc (dbg, readp); + } + else + { + begin = read_4ubyte_unaligned_inc (dbg, readp); + end = read_4ubyte_unaligned_inc (dbg, readp); + if (begin == (Dwarf_Addr) (uint32_t) -1) + begin = (Dwarf_Addr) -1l; + } + + if (begin == (Dwarf_Addr) -1l) /* Base address entry. */ + { + char *b = format_dwarf_addr (dwflmod, address_size, end); + printf (gettext (" [%6tx] base address %s\n"), offset, b); + free (b); + } + else if (begin == 0 && end == 0) /* End of list entry. */ + first = true; + else + { + /* We have a location expression entry. */ + uint_fast16_t len = read_2ubyte_unaligned_inc (dbg, readp); + + char *b = format_dwarf_addr (dwflmod, address_size, begin); + char *e = format_dwarf_addr (dwflmod, address_size, end); + + if (first) /* First entry in a list. */ + printf (gettext (" [%6tx] %s..%s"), offset, b, e); + else + printf (gettext (" %s..%s"), b, e); + + free (b); + free (e); + + print_ops (dwflmod, dbg, 1, 18 + (address_size * 4), + address_size, len, readp); + + first = false; + readp += len; + } + } +} struct mac_culist { @@ -4149,8 +5051,10 @@ mac_compare (const void *p1, const void *p2) static void -print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, - GElf_Shdr *shdr, Dwarf *dbg) +print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ \nDWARF section '%s' at offset %#" PRIx64 ":\n"), @@ -4160,7 +5064,7 @@ print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, /* There is no function in libdw to iterate over the raw content of the section but it is easy enough to do. */ Elf_Data *data = elf_getdata (scn, NULL); - if (data == NULL || data->d_buf == NULL) + if (unlikely (data == NULL || data->d_buf == NULL)) { error (0, 0, gettext ("cannot get macro information section data: %s"), elf_errmsg (-1)); @@ -4239,7 +5143,7 @@ print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, get_uleb128 (u128, readp); endp = memchr (readp, '\0', readendp - readp); - if (endp == NULL) + if (unlikely (endp == NULL)) { printf (gettext ("\ %*s*** non-terminated string at end of section"), @@ -4265,7 +5169,7 @@ print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, get_uleb128 (u128_2, readp); /* Find the CU DIE for this file. */ - ptrdiff_t macoff = readp - (const unsigned char *) data->d_buf; + size_t macoff = readp - (const unsigned char *) data->d_buf; const char *fname = "???"; if (macoff >= cus[0].offset) { @@ -4294,7 +5198,7 @@ print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, default: // XXX gcc seems to generate files with a trailing zero. - if (opcode != 0 || readp != readendp) + if (unlikely (opcode != 0 || readp != readendp)) printf ("%*s*** invalid opcode %u\n", level, "", opcode); break; } @@ -4304,7 +5208,8 @@ print_debug_macinfo_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, /* Callback for printing global names. */ static int -print_pubnames (Dwarf *dbg, Dwarf_Global *global, void *arg) +print_pubnames (Dwarf *dbg __attribute__ ((unused)), Dwarf_Global *global, + void *arg) { int *np = (int *) arg; @@ -4318,7 +5223,10 @@ print_pubnames (Dwarf *dbg, Dwarf_Global *global, void *arg) /* Print the known exported symbols in the DWARF section '.debug_pubnames'. */ static void -print_debug_pubnames_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +print_debug_pubnames_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\nDWARF section '%s' at offset %#" PRIx64 ":\n"), @@ -4330,7 +5238,10 @@ print_debug_pubnames_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, /* Print the content of the DWARF string section '.debug_str'. */ static void -print_debug_str_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, +print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn __attribute__ ((unused)), GElf_Shdr *shdr, Dwarf *dbg) { /* Compute floor(log16(shdr->sh_size)). */ @@ -4354,7 +5265,7 @@ print_debug_str_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, { size_t len; const char *str = dwarf_getstring (dbg, offset, &len); - if (str == NULL) + if (unlikely (str == NULL)) { printf (gettext (" *** error while reading strings: %s\n"), dwarf_errmsg (-1)); @@ -4367,44 +5278,40 @@ print_debug_str_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, } } - static void -print_debug (Ebl *ebl, GElf_Ehdr *ehdr) +print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) { - /* Find the version information sections. For this we have to - search through the section table. */ - Dwarf *dbg; - Elf_Scn *scn; - size_t shstrndx; - /* Before we start the real work get a debug context descriptor. */ - dbg = dwarf_begin_elf (ebl->elf, DWARF_C_READ, NULL); + Dwarf_Addr dwbias; + Dwarf *dbg = dwfl_module_getdwarf (dwflmod, &dwbias); if (dbg == NULL) { error (0, 0, gettext ("cannot get debug context descriptor: %s"), - dwarf_errmsg (-1)); + dwfl_errmsg (-1)); return; } /* Get the section header string table index. */ - if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); - scn = NULL; + /* Look through all the sections for the debugging sections to print. */ + Elf_Scn *scn = NULL; while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) { - /* Handle the section if it is part of the versioning handling. */ GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr != NULL || shdr->sh_type != SHT_PROGBITS) + if (shdr != NULL && shdr->sh_type == SHT_PROGBITS) { static const struct { const char *name; enum section_e bitmask; - void (*fp) (Ebl *, GElf_Ehdr *, Elf_Scn *, GElf_Shdr *, Dwarf *); + void (*fp) (Dwfl_Module *, Ebl *, + GElf_Ehdr *, Elf_Scn *, GElf_Shdr *, Dwarf *); } debug_sections[] = { #define NEW_SECTION(name) \ @@ -4418,6 +5325,7 @@ print_debug (Ebl *ebl, GElf_Ehdr *ehdr) NEW_SECTION (pubnames), NEW_SECTION (str), NEW_SECTION (macinfo), + NEW_SECTION (ranges), { ".eh_frame", section_frame, print_debug_frame_section } }; const int ndebug_sections = (sizeof (debug_sections) @@ -4430,26 +5338,851 @@ print_debug (Ebl *ebl, GElf_Ehdr *ehdr) if (strcmp (name, debug_sections[n].name) == 0) { if (print_debug_sections & debug_sections[n].bitmask) - debug_sections[n].fp (ebl, ehdr, scn, shdr, dbg); + debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg); break; } } } +} + + +#define ITEM_INDENT 4 +#define ITEM_WRAP_COLUMN 150 +#define REGISTER_WRAP_COLUMN 75 + +/* Print "NAME: FORMAT", wrapping when FORMAT_MAX chars of FORMAT would + make the line exceed ITEM_WRAP_COLUMN. Unpadded numbers look better + for the core items. But we do not want the line breaks to depend on + the particular values. */ +static unsigned int +__attribute__ ((format (printf, 7, 8))) +print_core_item (unsigned int colno, char sep, unsigned int wrap, + size_t name_width, const char *name, + size_t format_max, const char *format, ...) +{ + size_t len = strlen (name); + if (name_width < len) + name_width = len; + + size_t n = name_width + sizeof ": " - 1 + format_max; + + if (colno == 0) + { + printf ("%*s", ITEM_INDENT, ""); + colno = ITEM_INDENT + n; + } + else if (colno + 2 + n < wrap) + { + printf ("%c ", sep); + colno += 2 + n; + } + else + { + printf ("\n%*s", ITEM_INDENT, ""); + colno = ITEM_INDENT + n; + } + + printf ("%s: %*s", name, (int) (name_width - len), ""); + + va_list ap; + va_start (ap, format); + vprintf (format, ap); + va_end (ap); + + return colno; +} + +static const void * +convert (Elf *core, Elf_Type type, uint_fast16_t count, + void *value, const void *data, size_t size) +{ + Elf_Data valuedata = + { + .d_type = type, + .d_buf = value, + .d_size = size ?: gelf_fsize (core, type, count, EV_CURRENT), + .d_version = EV_CURRENT, + }; + Elf_Data indata = + { + .d_type = type, + .d_buf = (void *) data, + .d_size = valuedata.d_size, + .d_version = EV_CURRENT, + }; + + Elf_Data *d = (gelf_getclass (core) == ELFCLASS32 + ? elf32_xlatetom : elf64_xlatetom) + (&valuedata, &indata, elf_getident (core, NULL)[EI_DATA]); + if (d == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot convert core note data: %s"), elf_errmsg (-1)); + + return data + indata.d_size; +} + +typedef uint8_t GElf_Byte; + +static unsigned int +handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc, + unsigned int colno, size_t *repeated_size) +{ + uint_fast16_t count = item->count ?: 1; + +#define TYPES \ + DO_TYPE (BYTE, Byte, "0x%.2" PRIx8, "%" PRId8, 4); \ + DO_TYPE (HALF, Half, "0x%.4" PRIx16, "%" PRId16, 6); \ + DO_TYPE (WORD, Word, "0x%.8" PRIx32, "%" PRId32, 11); \ + DO_TYPE (SWORD, Sword, "%" PRId32, "%" PRId32, 11); \ + DO_TYPE (XWORD, Xword, "0x%.16" PRIx64, "%" PRId64, 20); \ + DO_TYPE (SXWORD, Sxword, "%" PRId64, "%" PRId64, 20) + +#define DO_TYPE(NAME, Name, hex, dec, max) GElf_##Name Name[count] + union { TYPES; } value; +#undef DO_TYPE + + void *data = &value; + size_t size = gelf_fsize (core, item->type, count, EV_CURRENT); + size_t convsize = size; + if (repeated_size != NULL) + { + if (*repeated_size > size && (item->format == 'b' || item->format == 'B')) + { + data = alloca (*repeated_size); + count *= *repeated_size / size; + convsize = count * size; + *repeated_size -= convsize; + } + else + *repeated_size -= size; + } + + desc = convert (core, item->type, count, data, desc + item->offset, convsize); + + Elf_Type type = item->type; + if (type == ELF_T_ADDR) + type = gelf_getclass (core) == ELFCLASS32 ? ELF_T_WORD : ELF_T_XWORD; + + switch (item->format) + { + case 'd': + assert (count == 1); + switch (type) + { +#define DO_TYPE(NAME, Name, hex, dec, max) \ + case ELF_T_##NAME: \ + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, \ + 0, item->name, max, dec, value.Name[0]); \ + break + TYPES; +#undef DO_TYPE + default: + abort (); + } + break; + + case 'x': + assert (count == 1); + switch (type) + { +#define DO_TYPE(NAME, Name, hex, dec, max) \ + case ELF_T_##NAME: \ + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, \ + 0, item->name, max, hex, value.Name[0]); \ + break + TYPES; +#undef DO_TYPE + default: + abort (); + } + break; + + case 'b': + case 'B': + assert (size % sizeof (unsigned int) == 0); + unsigned int nbits = count * size * 8; + unsigned int pop = 0; + for (const unsigned int *i = data; (void *) i < data + count * size; ++i) + pop += __builtin_popcount (*i); + bool negate = pop > nbits / 2; + const unsigned int bias = item->format == 'b'; + + { + char printed[(negate ? nbits - pop : pop) * 16]; + char *p = printed; + *p = '\0'; + + if (BYTE_ORDER != LITTLE_ENDIAN && size > sizeof (unsigned int)) + { + assert (size == sizeof (unsigned int) * 2); + for (unsigned int *i = data; + (void *) i < data + count * size; i += 2) + { + unsigned int w = i[1]; + i[1] = i[0]; + i[0] = w; + } + } + + unsigned int lastbit = 0; + for (const unsigned int *i = data; + (void *) i < data + count * size; ++i) + { + unsigned int bit = ((void *) i - data) * 8; + unsigned int w = negate ? ~*i : *i; + while (w != 0) + { + int n = ffs (w); + w >>= n; + bit += n; + + if (lastbit + 1 != bit) + p += sprintf (p, "-%u,%u", lastbit - bias, bit - bias); + else if (lastbit == 0) + p += sprintf (p, "%u", bit - bias); + + lastbit = bit; + } + } + if (lastbit > 0 && lastbit + 1 != nbits) + p += sprintf (p, "-%u", nbits - bias); + + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, 0, item->name, + 4 + nbits * 4, + negate ? "~<%s>" : "<%s>", printed); + } + break; + + case 'T': + case (char) ('T'|0x80): + assert (count == 2); + Dwarf_Word sec; + Dwarf_Word usec; + size_t maxfmt = 7; + switch (type) + { +#define DO_TYPE(NAME, Name, hex, dec, max) \ + case ELF_T_##NAME: \ + sec = value.Name[0]; \ + usec = value.Name[1]; \ + maxfmt += max; \ + break + TYPES; +#undef DO_TYPE + default: + abort (); + } + if (unlikely (item->format == (char) ('T'|0x80))) + { + /* This is a hack for an ill-considered 64-bit ABI where + tv_usec is actually a 32-bit field with 32 bits of padding + rounding out struct timeval. We've already converted it as + a 64-bit field. For little-endian, this just means the + high half is the padding; it's presumably zero, but should + be ignored anyway. For big-endian, it means the 32-bit + field went into the high half of USEC. */ + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (core, &ehdr_mem); + if (likely (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)) + usec >>= 32; + else + usec &= UINT32_MAX; + } + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, 0, item->name, + maxfmt, "%" PRIu64 ".%.6" PRIu64, sec, usec); + break; + + case 'c': + assert (count == 1); + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, 0, item->name, + 1, "%c", value.Byte[0]); + break; + + case 's': + colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, 0, item->name, + count, "%.*s", (int) count, value.Byte); + break; + + default: + error (0, 0, "XXX not handling format '%c' for %s", + item->format, item->name); + break; + } + +#undef TYPES + + return colno; +} + + +/* Sort items by group, and by layout offset within each group. */ +static int +compare_core_items (const void *a, const void *b) +{ + const Ebl_Core_Item *const *p1 = a; + const Ebl_Core_Item *const *p2 = b; + const Ebl_Core_Item *item1 = *p1; + const Ebl_Core_Item *item2 = *p2; + + return ((item1->group == item2->group ? 0 + : strcmp (item1->group, item2->group)) + ?: (int) item1->offset - (int) item2->offset); +} + +/* Sort item groups by layout offset of the first item in the group. */ +static int +compare_core_item_groups (const void *a, const void *b) +{ + const Ebl_Core_Item *const *const *p1 = a; + const Ebl_Core_Item *const *const *p2 = b; + const Ebl_Core_Item *const *group1 = *p1; + const Ebl_Core_Item *const *group2 = *p2; + const Ebl_Core_Item *item1 = *group1; + const Ebl_Core_Item *item2 = *group2; + + return (int) item1->offset - (int) item2->offset; +} + +static unsigned int +handle_core_items (Elf *core, const void *desc, size_t descsz, + const Ebl_Core_Item *items, size_t nitems) +{ + if (nitems == 0) + return 0; + + /* Sort to collect the groups together. */ + const Ebl_Core_Item *sorted_items[nitems]; + for (size_t i = 0; i < nitems; ++i) + sorted_items[i] = &items[i]; + qsort (sorted_items, nitems, sizeof sorted_items[0], &compare_core_items); + + /* Collect the unique groups and sort them. */ + const Ebl_Core_Item **groups[nitems]; + groups[0] = &sorted_items[0]; + size_t ngroups = 1; + for (size_t i = 1; i < nitems; ++i) + if (sorted_items[i]->group != sorted_items[i - 1]->group + && strcmp (sorted_items[i]->group, sorted_items[i - 1]->group)) + groups[ngroups++] = &sorted_items[i]; + qsort (groups, ngroups, sizeof groups[0], &compare_core_item_groups); + + /* Write out all the groups. */ + unsigned int colno = 0; + + const void *last = desc; + if (nitems == 1) + { + size_t size = descsz; + colno = handle_core_item (core, sorted_items[0], desc, colno, &size); + if (size == 0) + return colno; + desc += descsz - size; + descsz = size; + } + + do + { + for (size_t i = 0; i < ngroups; ++i) + { + for (const Ebl_Core_Item **item = groups[i]; + (item < &sorted_items[nitems] + && ((*item)->group == groups[i][0]->group + || !strcmp ((*item)->group, groups[i][0]->group))); + ++item) + colno = handle_core_item (core, *item, desc, colno, NULL); + + /* Force a line break at the end of the group. */ + colno = ITEM_WRAP_COLUMN; + } + + if (descsz == 0) + break; + + /* This set of items consumed a certain amount of the note's data. + If there is more data there, we have another unit of the same size. + Loop to print that out too. */ + const Ebl_Core_Item *item = &items[nitems - 1]; + size_t eltsz = item->offset + gelf_fsize (core, item->type, + item->count ?: 1, EV_CURRENT); + + int reps = -1; + do + { + ++reps; + desc += eltsz; + descsz -= eltsz; + } + while (descsz >= eltsz && !memcmp (desc, last, eltsz)); + + if (reps == 1) + { + /* For just one repeat, print it unabridged twice. */ + desc -= eltsz; + descsz += eltsz; + } + else if (reps > 1) + printf (gettext ("\n%*s... <repeats %u more times> ..."), + ITEM_INDENT, "", reps); + + last = desc; + } + while (descsz > 0); + + return colno; +} + +static unsigned int +handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc, + unsigned int colno) +{ + desc += regloc->offset; + + abort (); /* XXX */ + return colno; +} + + +static unsigned int +handle_core_register (Ebl *ebl, Elf *core, int maxregname, + const Ebl_Register_Location *regloc, const void *desc, + unsigned int colno) +{ + if (regloc->bits % 8 != 0) + return handle_bit_registers (regloc, desc, colno); + + desc += regloc->offset; + + for (int reg = regloc->regno; reg < regloc->regno + regloc->count; ++reg) + { + const char *pfx; + const char *set; + char name[16]; + int bits; + int type; + ssize_t n = ebl_register_info (ebl, reg, name, sizeof name, + &pfx, &set, &bits, &type); + if (n <= 0) + error (EXIT_FAILURE, 0, + gettext ("unable to handle register number %d"), + regloc->regno); + +#define TYPES \ + BITS (8, BYTE, "%4" PRId8, "0x%.2" PRIx8, 4); \ + BITS (16, HALF, "%6" PRId16, "0x%.4" PRIx16, 6); \ + BITS (32, WORD, "%11" PRId32, " 0x%.8" PRIx32, 11); \ + BITS (64, XWORD, "%20" PRId64, " 0x%.16" PRIx64, 20) + +#define BITS(bits, xtype, sfmt, ufmt, max) \ + uint##bits##_t b##bits; int##bits##_t b##bits##s + union { TYPES; uint64_t b128[2]; } value; +#undef BITS + + switch (type) + { + case DW_ATE_unsigned: + case DW_ATE_signed: + case DW_ATE_address: + switch (bits) + { +#define BITS(bits, xtype, sfmt, ufmt, max) \ + case bits: \ + desc = convert (core, ELF_T_##xtype, 1, &value, desc, 0); \ + if (type == DW_ATE_signed) \ + colno = print_core_item (colno, ' ', REGISTER_WRAP_COLUMN, \ + maxregname, name, \ + max, sfmt, value.b##bits##s); \ + else \ + colno = print_core_item (colno, ' ', REGISTER_WRAP_COLUMN, \ + maxregname, name, \ + max, ufmt, value.b##bits); \ + break + + TYPES; + + case 128: + assert (type == DW_ATE_unsigned); + desc = convert (core, ELF_T_XWORD, 2, &value, desc, 0); + int be = elf_getident (core, NULL)[EI_DATA] == ELFDATA2MSB; + colno = print_core_item (colno, ' ', REGISTER_WRAP_COLUMN, + maxregname, name, + 34, "0x%.16" PRIx64 "%.16" PRIx64, + value.b128[!be], value.b128[be]); + break; + + default: + abort (); +#undef BITS + } + break; + + default: + /* Print each byte in hex, the whole thing in native byte order. */ + assert (bits % 8 == 0); + const uint8_t *bytes = desc; + desc += bits / 8; + char hex[bits / 4 + 1]; + hex[bits / 4] = '\0'; + int incr = 1; + if (elf_getident (core, NULL)[EI_DATA] == ELFDATA2LSB) + { + bytes += bits / 8 - 1; + incr = -1; + } + size_t idx = 0; + for (char *h = hex; bits > 0; bits -= 8, idx += incr) + { + *h++ = "0123456789abcdef"[bytes[idx] >> 4]; + *h++ = "0123456789abcdef"[bytes[idx] & 0xf]; + } + colno = print_core_item (colno, ' ', REGISTER_WRAP_COLUMN, + maxregname, name, + 2 + sizeof hex - 1, "0x%s", hex); + break; + } + desc += regloc->pad; + +#undef TYPES + } + + return colno; +} + + +struct register_info +{ + const Ebl_Register_Location *regloc; + const char *set; + char name[16]; + Dwarf_Half regno; + uint8_t bits; + uint8_t type; +}; + +static int +register_bitpos (const struct register_info *r) +{ + return (r->regloc->offset * 8 + + ((r->regno - r->regloc->regno) + * (r->regloc->bits + r->regloc->pad * 8))); +} + +static int +compare_sets_by_info (const struct register_info *r1, + const struct register_info *r2) +{ + return ((int) r2->bits - (int) r1->bits + ?: register_bitpos (r1) - register_bitpos (r2)); +} + +/* Sort registers by set, and by size and layout offset within each set. */ +static int +compare_registers (const void *a, const void *b) +{ + const struct register_info *r1 = a; + const struct register_info *r2 = b; + + /* Unused elements sort last. */ + if (r1->regloc == NULL) + return r2->regloc == NULL ? 0 : 1; + if (r2->regloc == NULL) + return -1; + + return ((r1->set == r2->set ? 0 : strcmp (r1->set, r2->set)) + ?: compare_sets_by_info (r1, r2)); +} + +/* Sort register sets by layout offset of the first register in the set. */ +static int +compare_register_sets (const void *a, const void *b) +{ + const struct register_info *const *p1 = a; + const struct register_info *const *p2 = b; + return compare_sets_by_info (*p1, *p2); +} + +static unsigned int +handle_core_registers (Ebl *ebl, Elf *core, const void *desc, + const Ebl_Register_Location *reglocs, size_t nregloc) +{ + if (nregloc == 0) + return 0; + + ssize_t maxnreg = ebl_register_info (ebl, 0, NULL, 0, NULL, NULL, NULL, NULL); + if (maxnreg <= 0) + error (EXIT_FAILURE, 0, + gettext ("cannot register info: %s"), elf_errmsg (-1)); + + struct register_info regs[maxnreg]; + memset (regs, 0, sizeof regs); + + /* Sort to collect the sets together. */ + int maxreg = 0; + for (size_t i = 0; i < nregloc; ++i) + for (int reg = reglocs[i].regno; + reg < reglocs[i].regno + reglocs[i].count; + ++reg) + { + assert (reg < maxnreg); + if (reg > maxreg) + maxreg = reg; + struct register_info *info = ®s[reg]; + + const char *pfx; + int bits; + int type; + ssize_t n = ebl_register_info (ebl, reg, info->name, sizeof info->name, + &pfx, &info->set, &bits, &type); + if (n <= 0) + error (EXIT_FAILURE, 0, + gettext ("cannot register info: %s"), elf_errmsg (-1)); + + info->regloc = ®locs[i]; + info->regno = reg; + info->bits = bits; + info->type = type; + } + qsort (regs, maxreg + 1, sizeof regs[0], &compare_registers); + + /* Collect the unique sets and sort them. */ + inline bool same_set (const struct register_info *a, + const struct register_info *b) + { + return (a < ®s[maxnreg] && a->regloc != NULL + && b < ®s[maxnreg] && b->regloc != NULL + && a->bits == b->bits + && (a->set == b->set || !strcmp (a->set, b->set))); + } + struct register_info *sets[maxreg + 1]; + sets[0] = ®s[0]; + size_t nsets = 1; + for (int i = 1; i <= maxreg; ++i) + if (regs[i].regloc != NULL && !same_set (®s[i], ®s[i - 1])) + sets[nsets++] = ®s[i]; + qsort (sets, nsets, sizeof sets[0], &compare_register_sets); + + /* Write out all the sets. */ + unsigned int colno = 0; + for (size_t i = 0; i < nsets; ++i) + { + /* Find the longest name of a register in this set. */ + size_t maxname = 0; + const struct register_info *end; + for (end = sets[i]; same_set (sets[i], end); ++end) + { + size_t len = strlen (end->name); + if (len > maxname) + maxname = len; + } + + for (const struct register_info *reg = sets[i]; + reg < end; + reg += reg->regloc->count ?: 1) + colno = handle_core_register (ebl, core, maxname, + reg->regloc, desc, colno); + + /* Force a line break at the end of the group. */ + colno = REGISTER_WRAP_COLUMN; + } - /* We are done with the DWARF handling. */ - dwarf_end (dbg); + return colno; } +static void +handle_auxv_note (Ebl *ebl, Elf *core, GElf_Word descsz, GElf_Off desc_pos) +{ + Elf_Data *data = elf_getdata_rawchunk (core, desc_pos, descsz, ELF_T_AUXV); + if (data == NULL) + elf_error: + error (EXIT_FAILURE, 0, + gettext ("cannot convert core note data: %s"), elf_errmsg (-1)); + + const size_t nauxv = descsz / gelf_fsize (core, ELF_T_AUXV, 1, EV_CURRENT); + for (size_t i = 0; i < nauxv; ++i) + { + GElf_auxv_t av_mem; + GElf_auxv_t *av = gelf_getauxv (data, i, &av_mem); + if (av == NULL) + goto elf_error; + + const char *name; + const char *fmt; + if (ebl_auxv_info (ebl, av->a_type, &name, &fmt) == 0) + { + /* Unknown type. */ + if (av->a_un.a_val == 0) + printf (" %" PRIu64 "\n", av->a_type); + else + printf (" %" PRIu64 ": %#" PRIx64 "\n", + av->a_type, av->a_un.a_val); + } + else + switch (fmt[0]) + { + case '\0': /* Normally zero. */ + if (av->a_un.a_val == 0) + { + printf (" %s\n", name); + break; + } + /* Fall through */ + case 'x': /* hex */ + case 'p': /* address */ + case 's': /* address of string */ + printf (" %s: %#" PRIx64 "\n", name, av->a_un.a_val); + break; + case 'u': + printf (" %s: %" PRIu64 "\n", name, av->a_un.a_val); + break; + case 'd': + printf (" %s: %" PRId64 "\n", name, av->a_un.a_val); + break; + + case 'b': + printf (" %s: %#" PRIx64 " ", name, av->a_un.a_val); + GElf_Xword bit = 1; + const char *pfx = "<"; + for (const char *p = fmt + 1; *p != 0; p = strchr (p, '\0') + 1) + { + if (av->a_un.a_val & bit) + { + printf ("%s%s", pfx, p); + pfx = " "; + } + bit <<= 1; + } + printf (">\n"); + break; + + default: + abort (); + } + } +} + +static void +handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const void *desc) +{ + GElf_Word regs_offset; + size_t nregloc; + const Ebl_Register_Location *reglocs; + size_t nitems; + const Ebl_Core_Item *items; + + if (! ebl_core_note (ebl, nhdr->n_type, nhdr->n_descsz, + ®s_offset, &nregloc, ®locs, &nitems, &items)) + return; + + /* Pass 0 for DESCSZ when there are registers in the note, + so that the ITEMS array does not describe the whole thing. + For non-register notes, the actual descsz might be a multiple + of the unit size, not just exactly the unit size. */ + unsigned int colno = handle_core_items (ebl->elf, desc, + nregloc == 0 ? nhdr->n_descsz : 0, + items, nitems); + if (colno != 0) + putchar_unlocked ('\n'); + + colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset, + reglocs, nregloc); + if (colno != 0) + putchar_unlocked ('\n'); +} + +static void +handle_notes_data (Ebl *ebl, const GElf_Ehdr *ehdr, + GElf_Off start, Elf_Data *data) +{ + fputs_unlocked (gettext (" Owner Data size Type\n"), stdout); + + if (data == NULL) + goto bad_note; + + size_t offset = 0; + GElf_Nhdr nhdr; + size_t name_offset; + size_t desc_offset; + while (offset < data->d_size + && (offset = gelf_getnote (data, offset, + &nhdr, &name_offset, &desc_offset)) > 0) + { + const char *name = data->d_buf + name_offset; + const char *desc = data->d_buf + desc_offset; + + char buf[100]; + char buf2[100]; + printf (gettext (" %-13.*s %9" PRId32 " %s\n"), + (int) nhdr.n_namesz, name, nhdr.n_descsz, + ehdr->e_type == ET_CORE + ? ebl_core_note_type_name (ebl, nhdr.n_type, + buf, sizeof (buf)) + : ebl_object_note_type_name (ebl, nhdr.n_type, + buf2, sizeof (buf2))); + + /* Filter out invalid entries. */ + if (memchr (name, '\0', nhdr.n_namesz) != NULL + /* XXX For now help broken Linux kernels. */ + || 1) + { + if (ehdr->e_type == ET_CORE) + { + if (nhdr.n_type == NT_AUXV) + handle_auxv_note (ebl, ebl->elf, nhdr.n_descsz, + start + desc_offset); + else + handle_core_note (ebl, &nhdr, desc); + } + else + ebl_object_note (ebl, name, nhdr.n_type, nhdr.n_descsz, desc); + } + } + + if (offset == data->d_size) + return; + + bad_note: + error (EXIT_FAILURE, 0, + gettext ("cannot get content of note section: %s"), + elf_errmsg (-1)); +} static void handle_notes (Ebl *ebl, GElf_Ehdr *ehdr) { - int class = gelf_getclass (ebl->elf); - size_t cnt; + /* If we have section headers, just look for SHT_NOTE sections. + In a debuginfo file, the program headers are not reliable. */ + if (shnum != 0) + { + /* Get the section header string table index. */ + size_t shstrndx; + if (elf_getshstrndx (ebl->elf, &shstrndx) < 0) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + if (shdr == NULL || shdr->sh_type != SHT_NOTE) + /* Not what we are looking for. */ + continue; + + printf (gettext ("\ +\nNote section [%2zu] '%s' of %" PRIu64 " bytes at offset %#0" PRIx64 ":\n"), + elf_ndxscn (scn), + elf_strptr (ebl->elf, shstrndx, shdr->sh_name), + shdr->sh_size, shdr->sh_offset); + + handle_notes_data (ebl, ehdr, shdr->sh_offset, + elf_getdata (scn, NULL)); + } + return; + } /* We have to look through the program header to find the note sections. There can be more than one. */ - for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) { GElf_Phdr mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, cnt, &mem); @@ -4459,83 +6192,254 @@ handle_notes (Ebl *ebl, GElf_Ehdr *ehdr) continue; printf (gettext ("\ -\nNote segment of %" PRId64 " bytes at offset %#0" PRIx64 ":\n"), +\nNote segment of %" PRIu64 " bytes at offset %#0" PRIx64 ":\n"), phdr->p_filesz, phdr->p_offset); - char *notemem = gelf_rawchunk (ebl->elf, phdr->p_offset, phdr->p_filesz); - if (notemem == NULL) - error (EXIT_FAILURE, 0, - gettext ("cannot get content of note section: %s"), - elf_errmsg (-1)); + handle_notes_data (ebl, ehdr, phdr->p_offset, + elf_getdata_rawchunk (ebl->elf, + phdr->p_offset, phdr->p_filesz, + ELF_T_NHDR)); + } +} - fputs_unlocked (gettext (" Owner Data size Type\n"), stdout); +static void +hex_dump (const uint8_t *data, size_t len) +{ + size_t pos = 0; + while (pos < len) + { + printf (" 0x%08Zx ", pos); - /* Handle the note section content. It consists of one or more - entries each of which consists of five parts: + const size_t chunk = MIN (len - pos, 16); - - a 32-bit name length - - a 32-bit descriptor length - - a 32-bit type field - - the NUL-terminated name, length as specified in the first field - - the descriptor, length as specified in the second field + for (size_t i = 0; i < chunk; ++i) + if (i % 4 == 3) + printf ("%02x ", data[pos + i]); + else + printf ("%02x", data[pos + i]); - The variable sized fields are padded to 32- or 64-bits - depending on whether the file is a 32- or 64-bit ELF file. - */ - size_t align = class == ELFCLASS32 ? 4 : 8; -#define ALIGNED_LEN(len) (((len) + align - 1) & ~(align - 1)) + if (chunk < 16) + printf ("%*s", (int) ((16 - chunk) * 2 + (16 - chunk + 3) / 4), ""); - size_t idx = 0; - while (idx < phdr->p_filesz) + for (size_t i = 0; i < chunk; ++i) { - /* XXX Handle 64-bit note section entries correctly. */ - struct - { - uint32_t namesz; - uint32_t descsz; - uint32_t type; - char name[0]; - } *noteentry = (__typeof (noteentry)) (notemem + idx); - - if (idx + 12 > phdr->p_filesz - || (idx + 12 + ALIGNED_LEN (noteentry->namesz) - + ALIGNED_LEN (noteentry->descsz) > phdr->p_filesz)) - /* This entry isn't completely contained in the note - section. Ignore it. */ - break; + unsigned char b = data[pos + i]; + printf ("%c", isprint (b) ? b : '.'); + } + + putchar ('\n'); + pos += chunk; + } +} + +static void +dump_data_section (Elf_Scn *scn, const GElf_Shdr *shdr, const char *name) +{ + if (shdr->sh_size == 0 || shdr->sh_type == SHT_NOBITS) + printf (gettext ("\nSection [%Zu] '%s' has no data to dump.\n"), + elf_ndxscn (scn), name); + else + { + Elf_Data *data = elf_rawdata (scn, NULL); + if (data == NULL) + error (0, 0, gettext ("cannot get data for section [%Zu] '%s': %s"), + elf_ndxscn (scn), name, elf_errmsg (-1)); + else + { + printf (gettext ("\nHex dump of section [%Zu] '%s', %" PRIu64 + " bytes at offset %#0" PRIx64 ":\n"), + elf_ndxscn (scn), name, + shdr->sh_size, shdr->sh_offset); + hex_dump (data->d_buf, data->d_size); + } + } +} - char buf[100]; - char buf2[100]; - printf (gettext (" %-13.*s %9" PRId32 " %s\n"), - (int) noteentry->namesz, noteentry->name, - noteentry->descsz, - ehdr->e_type == ET_CORE - ? ebl_core_note_type_name (ebl, noteentry->type, - buf, sizeof (buf)) - : ebl_object_note_type_name (ebl, noteentry->type, - buf2, sizeof (buf2))); - - /* Filter out invalid entries. */ - if (memchr (noteentry->name, '\0', noteentry->namesz) != NULL - /* XXX For now help broken Linux kernels. */ - || 1) +static void +print_string_section (Elf_Scn *scn, const GElf_Shdr *shdr, const char *name) +{ + if (shdr->sh_size == 0) + printf (gettext ("\nSection [%Zu] '%s' is empty.\n"), + elf_ndxscn (scn), name); + + Elf_Data *data = elf_rawdata (scn, NULL); + if (data == NULL) + error (0, 0, gettext ("cannot get data for section [%Zu] '%s': %s"), + elf_ndxscn (scn), name, elf_errmsg (-1)); + else + { + printf (gettext ("\nString section [%Zu] '%s' contains %" PRIu64 + " bytes at offset %#0" PRIx64 ":\n"), + elf_ndxscn (scn), name, + shdr->sh_size, shdr->sh_offset); + + const char *start = data->d_buf; + const char *const limit = start + data->d_size; + do + { + const char *end = memchr (start, '\0', limit - start); + const size_t pos = start - (const char *) data->d_buf; + if (unlikely (end == NULL)) { - if (ehdr->e_type == ET_CORE) - ebl_core_note (ebl, noteentry->name, noteentry->type, - noteentry->descsz, - ¬eentry->name[ALIGNED_LEN (noteentry->namesz)]); - else - ebl_object_note (ebl, noteentry->name, noteentry->type, - noteentry->descsz, - ¬eentry->name[ALIGNED_LEN (noteentry->namesz)]); + printf (" [%6Zx]- %.*s\n", + pos, (int) (limit - start), start); + break; } + printf (" [%6Zx] %s\n", pos, start); + start = end + 1; + } while (start < limit); + } +} - /* Move to the next entry. */ - idx += (12 + ALIGNED_LEN (noteentry->namesz) - + ALIGNED_LEN (noteentry->descsz)); +static void +for_each_section_argument (Elf *elf, const struct section_argument *list, + void (*dump) (Elf_Scn *scn, const GElf_Shdr *shdr, + const char *name)) +{ + /* Get the section header string table index. */ + size_t shstrndx; + if (elf_getshstrndx (elf, &shstrndx) < 0) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + for (const struct section_argument *a = list; a != NULL; a = a->next) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + const char *name = NULL; + + char *endp = NULL; + unsigned long int shndx = strtoul (a->arg, &endp, 0); + if (endp != a->arg && *endp == '\0') + { + scn = elf_getscn (elf, shndx); + if (scn == NULL) + { + error (0, 0, gettext ("\nsection [%lu] does not exist"), shndx); + continue; + } + + if (gelf_getshdr (scn, &shdr_mem) == NULL) + error (EXIT_FAILURE, 0, gettext ("cannot get section header: %s"), + elf_errmsg (-1)); + name = elf_strptr (elf, shstrndx, shdr_mem.sh_name); + } + else + { + /* Need to look up the section by name. */ + scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + if (gelf_getshdr (scn, &shdr_mem) == NULL) + continue; + name = elf_strptr (elf, shstrndx, shdr_mem.sh_name); + if (name == NULL) + continue; + if (!strcmp (name, a->arg)) + break; + } + + if (unlikely (scn == NULL)) + { + error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); + continue; + } + } + + (*dump) (scn, &shdr_mem, name); + } +} + +static void +dump_data (Ebl *ebl) +{ + for_each_section_argument (ebl->elf, dump_data_sections, &dump_data_section); +} + +static void +dump_strings (Ebl *ebl) +{ + for_each_section_argument (ebl->elf, string_sections, &print_string_section); +} + +static void +print_strings (Ebl *ebl) +{ + /* Get the section header string table index. */ + size_t shstrndx; + if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) + error (EXIT_FAILURE, 0, + gettext ("cannot get section header string table index")); + + Elf_Scn *scn; + GElf_Shdr shdr_mem; + const char *name; + scn = NULL; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + if (gelf_getshdr (scn, &shdr_mem) == NULL) + continue; + + if (shdr_mem.sh_type != SHT_PROGBITS + || !(shdr_mem.sh_flags & SHF_STRINGS)) + continue; + + name = elf_strptr (ebl->elf, shstrndx, shdr_mem.sh_name); + if (name == NULL) + continue; + + print_string_section (scn, &shdr_mem, name); + } +} + +static void +dump_archive_index (Elf *elf, const char *fname) +{ + size_t narsym; + const Elf_Arsym *arsym = elf_getarsym (elf, &narsym); + if (arsym == NULL) + { + int result = elf_errno (); + if (unlikely (result != ELF_E_NO_INDEX)) + error (EXIT_FAILURE, 0, + gettext ("cannot get symbol index of archive '%s': %s"), + fname, elf_errmsg (result)); + else + printf (gettext ("\nArchive '%s' has no symbol index\n"), fname); + return; + } + + printf (gettext ("\nIndex of archive '%s' has %Zu entries:\n"), + fname, narsym); + + size_t as_off = 0; + for (const Elf_Arsym *s = arsym; s < &arsym[narsym - 1]; ++s) + { + if (s->as_off != as_off) + { + as_off = s->as_off; + + Elf *subelf; + if (unlikely (elf_rand (elf, as_off) == 0) + || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf)) + == NULL)) +#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) + while (1) +#endif + error (EXIT_FAILURE, 0, + gettext ("cannot extract member at offset %Zu in '%s': %s"), + as_off, fname, elf_errmsg (-1)); + + const Elf_Arhdr *h = elf_getarhdr (subelf); + + printf (gettext ("Archive member '%s' contains:\n"), h->ar_name); + + elf_end (subelf); } - gelf_freechunk (ebl->elf, notemem); + printf ("\t%s\n", s->as_name); } } + +#include "debugpred.h" diff --git a/src/sectionhash.c b/src/sectionhash.c index dc559409..68d734e1 100644 --- a/src/sectionhash.c +++ b/src/sectionhash.c @@ -1,16 +1,28 @@ /* Section hash table implementation. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -34,7 +46,7 @@ scnhead_compare (struct scnhead *one, struct scnhead *two) if (result == 0) { - GElf_Xword diff = (SH_FLAGS_IMPORTANT (one->flags) + GElf_Sxword diff = (SH_FLAGS_IMPORTANT (one->flags) - SH_FLAGS_IMPORTANT (two->flags)); result = diff < 0 ? -1 : diff == 0 ? 0 : 1; diff --git a/src/sectionhash.h b/src/sectionhash.h index 50bcb9c8..ba41ee8c 100644 --- a/src/sectionhash.h +++ b/src/sectionhash.h @@ -1,15 +1,27 @@ /* Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef SECTIONHASH_H #define SECTIONHASH_H 1 @@ -1,16 +1,28 @@ /* Print size information from ELF file. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -40,6 +52,9 @@ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + /* Values for the parameters which have no short form. */ #define OPT_FORMAT 0x100 @@ -48,20 +63,25 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - { NULL, 0, NULL, 0, N_("Output format:") }, - { "format", OPT_FORMAT, "FORMAT", 0, N_("Use the output format FORMAT. FORMAT can be `bsd' or `sysv'. The default is `bsd'") }, - { NULL, 'A', NULL, 0, N_("Same as `--format=sysv'") }, - { NULL, 'B', NULL, 0, N_("Same as `--format=bsd'") }, - { "radix", OPT_RADIX, "RADIX", 0, N_("Use RADIX for printing symbol values") }, - { NULL, 'd', NULL, 0, N_("Same as `--radix=10'") }, - { NULL, 'o', NULL, 0, N_("Same as `--radix=8'") }, - { NULL, 'x', NULL, 0, N_("Same as `--radix=16'") }, - { NULL, 'f', NULL, 0, N_("Similar to `--format=sysv' output but in one line") }, - - { NULL, 0, NULL, 0, N_("Output options:") }, - { NULL, 'F', NULL, 0, N_("Print size and permission flags for loadable segments") }, - { "totals", 't', NULL, 0, N_("Display the total sizes (bsd only)") }, - { NULL, 0, NULL, 0, NULL } + { NULL, 0, NULL, 0, N_("Output format:"), 0 }, + { "format", OPT_FORMAT, "FORMAT", 0, + N_("Use the output format FORMAT. FORMAT can be `bsd' or `sysv'. " + "The default is `bsd'"), 0 }, + { NULL, 'A', NULL, 0, N_("Same as `--format=sysv'"), 0 }, + { NULL, 'B', NULL, 0, N_("Same as `--format=bsd'"), 0 }, + { "radix", OPT_RADIX, "RADIX", 0, N_("Use RADIX for printing symbol values"), + 0}, + { NULL, 'd', NULL, 0, N_("Same as `--radix=10'"), 0 }, + { NULL, 'o', NULL, 0, N_("Same as `--radix=8'"), 0 }, + { NULL, 'x', NULL, 0, N_("Same as `--radix=16'"), 0 }, + { NULL, 'f', NULL, 0, + N_("Similar to `--format=sysv' output but in one line"), 0 }, + + { NULL, 0, NULL, 0, N_("Output options:"), 0 }, + { NULL, 'F', NULL, 0, + N_("Print size and permission flags for loadable segments"), 0 }, + { "totals", 't', NULL, 0, N_("Display the total sizes (bsd only)"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } }; /* Short description of program. */ @@ -74,13 +94,10 @@ static const char args_doc[] = N_("[FILE...]"); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp = { - options, parse_opt, args_doc, doc, NULL, more_help + options, parse_opt, args_doc, doc, NULL, NULL, NULL }; @@ -98,7 +115,7 @@ static void show_bsd_totals (void); #define INTERNAL_ERROR(fname) \ error (EXIT_FAILURE, 0, gettext ("%s: INTERNAL ERROR %d (%s-%s): %s"), \ - fname, __LINE__, VERSION, __DATE__, elf_errmsg (-1)) + fname, __LINE__, PACKAGE_VERSION, __DATE__, elf_errmsg (-1)) /* User-selectable options. */ @@ -163,10 +180,10 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); /* Make sure the message catalog can be found. */ - bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); /* Initialize the message catalog. */ - textdomain (PACKAGE); + textdomain (PACKAGE_TARNAME); /* Parse and process arguments. */ argp_parse (&argp, argc, argv, 0, &remaining, NULL); @@ -196,21 +213,22 @@ main (int argc, char *argv[]) /* Print the version information. */ static void -print_version (FILE *stream, struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "size (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "size (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } /* Handle program arguments. */ static error_t -parse_opt (int key, char *arg, struct argp_state *state) +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) { switch (key) { @@ -245,7 +263,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case OPT_FORMAT: if (strcmp (arg, "bsd") == 0 || strcmp (arg, "berkeley") == 0) format = format_bsd; - else if (strcmp (arg, "sysv") == 0) + else if (likely (strcmp (arg, "sysv") == 0)) format = format_sysv; else error (EXIT_FAILURE, 0, gettext ("Invalid format: %s"), arg); @@ -273,63 +291,38 @@ parse_opt (int key, char *arg, struct argp_state *state) } -static char * -more_help (int key, const char *text, void *input) -{ - char *buf; - - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - - default: - break; - } - return (char *) text; -} - - +/* Open the file and determine the type. */ static int process_file (const char *fname) { - /* Open the file and determine the type. */ - int fd; - Elf *elf; - - /* Open the file. */ - fd = open (fname, O_RDONLY); - if (fd == -1) + int fd = open (fname, O_RDONLY); + if (unlikely (fd == -1)) { - error (0, errno, fname); + error (0, errno, gettext ("cannot open '%s'"), fname); return 1; } /* Now get the ELF descriptor. */ - elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); - if (elf != NULL) + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (likely (elf != NULL)) { if (elf_kind (elf) == ELF_K_ELF) { handle_elf (elf, NULL, fname); - if (elf_end (elf) != 0) + if (unlikely (elf_end (elf) != 0)) INTERNAL_ERROR (fname); - if (close (fd) != 0) - error (EXIT_FAILURE, errno, gettext ("while close `%s'"), fname); + if (unlikely (close (fd) != 0)) + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); return 0; } - else + else if (likely (elf_kind (elf) == ELF_K_AR)) return handle_ar (fd, elf, NULL, fname); /* We cannot handle this type. Close the descriptor anyway. */ - if (elf_end (elf) != 0) + if (unlikely (elf_end (elf) != 0)) INTERNAL_ERROR (fname); } @@ -366,12 +359,9 @@ print_header (Elf *elf) static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname) { - Elf *subelf; - Elf_Cmd cmd = ELF_C_READ_MMAP; size_t prefix_len = prefix == NULL ? 0 : strlen (prefix); size_t fname_len = strlen (fname) + 1; char new_prefix[prefix_len + 1 + fname_len]; - int result = 0; char *cp = new_prefix; /* Create the full name of the file. */ @@ -383,6 +373,9 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname) memcpy (cp, fname, fname_len); /* Process all the files contained in the archive. */ + int result = 0; + Elf *subelf; + Elf_Cmd cmd = ELF_C_READ_MMAP; while ((subelf = elf_begin (fd, cmd, elf)) != NULL) { /* The the header for this element. */ @@ -390,21 +383,21 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname) if (elf_kind (subelf) == ELF_K_ELF) handle_elf (subelf, new_prefix, arhdr->ar_name); - else if (elf_kind (subelf) == ELF_K_AR) + else if (likely (elf_kind (subelf) == ELF_K_AR)) result |= handle_ar (fd, subelf, new_prefix, arhdr->ar_name); /* else signal error??? */ /* Get next archive element. */ cmd = elf_next (subelf); - if (elf_end (subelf) != 0) + if (unlikely (elf_end (subelf) != 0)) INTERNAL_ERROR (fname); } - if (elf_end (elf) != 0) + if (unlikely (elf_end (elf) != 0)) INTERNAL_ERROR (fname); - if (close (fd) != 0) - error (EXIT_FAILURE, errno, gettext ("while closing `%s'"), fname); + if (unlikely (close (fd) != 0)) + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); return result; } @@ -415,22 +408,20 @@ static void show_sysv (Elf *elf, const char *prefix, const char *fname, const char *fullname) { - size_t shstrndx; - Elf_Scn *scn = NULL; - GElf_Shdr shdr_mem; int maxlen = 10; - int digits = length_map[gelf_getclass (elf) - 1][radix]; - const char *fmtstr; - GElf_Off total = 0; + const int digits = length_map[gelf_getclass (elf) - 1][radix]; /* Get the section header string table index. */ - if (elf_getshstrndx (elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); /* First round over the sections: determine the longest section name. */ + Elf_Scn *scn = NULL; while ((scn = elf_nextscn (elf, scn)) != NULL) { + GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr == NULL) @@ -439,7 +430,8 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, /* Ignore all sections which are not used at runtime. */ if ((shdr->sh_flags & SHF_ALLOC) != 0) maxlen = MAX (maxlen, - strlen (elf_strptr (elf, shstrndx, shdr->sh_name))); + (int) strlen (elf_strptr (elf, shstrndx, + shdr->sh_name))); } fputs_unlocked (fname, stdout); @@ -450,6 +442,7 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, digits - 2, sgettext ("sysv|size"), digits, sgettext ("sysv|addr")); + const char *fmtstr; if (radix == radix_hex) fmtstr = "%-*s %*" PRIx64 " %*" PRIx64 "\n"; else if (radix == radix_decimal) @@ -458,8 +451,10 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, fmtstr = "%-*s %*" PRIo64 " %*" PRIo64 "\n"; /* Iterate over all sections. */ + GElf_Off total = 0; while ((scn = elf_nextscn (elf, scn)) != NULL) { + GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); /* Ignore all sections which are not used at runtime. */ @@ -488,21 +483,15 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, /* Show sizes in SysV format in one line. */ static void -show_sysv_one_line (Elf *elf, const char *prefix, const char *fname, - const char *fullname) +show_sysv_one_line (Elf *elf) { - size_t shstrndx; - Elf_Scn *scn = NULL; - GElf_Shdr shdr_mem; - const char *fmtstr; - GElf_Off total = 0; - int first = 1; - /* Get the section header string table index. */ - if (elf_getshstrndx (elf, &shstrndx) < 0) + size_t shstrndx; + if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0)) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); + const char *fmtstr; if (radix == radix_hex) fmtstr = "%" PRIx64 "(%s)"; else if (radix == radix_decimal) @@ -511,8 +500,12 @@ show_sysv_one_line (Elf *elf, const char *prefix, const char *fname, fmtstr = "%" PRIo64 "(%s)"; /* Iterate over all sections. */ + GElf_Off total = 0; + bool first = true; + Elf_Scn *scn = NULL; while ((scn = elf_nextscn (elf, scn)) != NULL) { + GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); /* Ignore all sections which are not used at runtime. */ @@ -521,7 +514,7 @@ show_sysv_one_line (Elf *elf, const char *prefix, const char *fname, if (! first) fputs_unlocked (" + ", stdout); - first = 0; + first = false; printf (fmtstr, shdr->sh_size, elf_strptr (elf, shstrndx, shdr->sh_name)); @@ -549,17 +542,17 @@ static void show_bsd (Elf *elf, const char *prefix, const char *fname, const char *fullname) { - Elf_Scn *scn = NULL; - GElf_Shdr shdr_mem; GElf_Off textsize = 0; GElf_Off datasize = 0; GElf_Off bsssize = 0; - int ddigits = length_map[gelf_getclass (elf) - 1][radix_decimal]; - int xdigits = length_map[gelf_getclass (elf) - 1][radix_hex]; + const int ddigits = length_map[gelf_getclass (elf) - 1][radix_decimal]; + const int xdigits = length_map[gelf_getclass (elf) - 1][radix_hex]; /* Iterate over all sections. */ + Elf_Scn *scn = NULL; while ((scn = elf_nextscn (elf, scn)) != NULL) { + GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr == NULL) @@ -617,20 +610,16 @@ show_bsd_totals (void) /* Show size and permission of loadable segments. */ static void -show_segments (Elf *elf, const char *prefix, const char *fname, - const char *fullname) +show_segments (Elf *elf, const char *fullname) { GElf_Ehdr ehdr_mem; - GElf_Ehdr *ehdr; - size_t cnt; - GElf_Off total = 0; - int first = 1; - - ehdr = gelf_getehdr (elf, &ehdr_mem); + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); if (ehdr == NULL) INTERNAL_ERROR (fullname); - for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) + GElf_Off total = 0; + bool first = true; + for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) { GElf_Phdr phdr_mem; GElf_Phdr *phdr; @@ -645,7 +634,7 @@ show_segments (Elf *elf, const char *prefix, const char *fname, if (! first) fputs_unlocked (" + ", stdout); - first = 0; + first = false; printf (radix == radix_hex ? "%" PRIx64 "(%c%c%c)" : (radix == radix_decimal ? "%" PRId64 "(%c%c%c)" @@ -686,9 +675,9 @@ handle_elf (Elf *elf, const char *prefix, const char *fname) if (format == format_sysv) show_sysv (elf, prefix, fname, fullname); else if (format == format_sysv_one_line) - show_sysv_one_line (elf, prefix, fname, fullname); + show_sysv_one_line (elf); else if (format == format_segments) - show_segments (elf, prefix, fname, fullname); + show_segments (elf, fullname); else { print_header (elf); @@ -696,3 +685,6 @@ handle_elf (Elf *elf, const char *prefix, const char *fname) show_bsd (elf, prefix, fname, fullname); } } + + +#include "debugpred.h" diff --git a/src/strings.c b/src/strings.c new file mode 100644 index 00000000..b2109961 --- /dev/null +++ b/src/strings.c @@ -0,0 +1,744 @@ +/* Print the strings of printable characters in files. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <ctype.h> +#include <endian.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <inttypes.h> +#include <libintl.h> +#include <locale.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/param.h> +#include <sys/stat.h> + +#include <system.h> + + +/* Prototypes of local functions. */ +static int read_fd (int fd, const char *fname, off64_t fdlen); +static int read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen); + + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + { NULL, 0, NULL, 0, N_("Output Selection:"), 0 }, + { "all", 'a', NULL, 0, N_("Scan entire file, not only loaded sections"), 0 }, + { "bytes", 'n', "MIN-LEN", 0, + N_("Only NUL-terminated sequences of MIN-LEN characters or more are printed"), 0 }, + { "encoding", 'e', "SELECTOR", 0, N_("\ +Select character size and endianess: s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit"), + 0}, + { "print-file-name", 'f', NULL, 0, + N_("Print name of the file before each string."), 0 }, + { "radix", 't', "{o,d,x}", 0, + N_("Print location of the string in base 8, 10, or 16 respectively."), 0 }, + { NULL, 'o', NULL, 0, N_("Alias for --radix=o"), 0 }, + + { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +/* Short description of program. */ +static const char doc[] = N_("\ +Print the strings of printable characters in files."); + +/* Strings for arguments in help texts. */ +static const char args_doc[] = N_("[FILE...]"); + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + options, parse_opt, args_doc, doc, NULL, NULL, NULL +}; + + +/* Global variables. */ + +/* True if whole file and not only loaded sections are looked at. */ +static bool entire_file; + +/* Minimum length of any sequence reported. */ +static size_t min_len = 4; + +/* Number of bytes per character. */ +static size_t bytes_per_char = 1; + +/* Minimum length of any sequence reported in bytes. */ +static size_t min_len_bytes; + +/* True if multibyte characters are in big-endian order. */ +static bool big_endian; + +/* True unless 7-bit ASCII are expected. */ +static bool char_7bit; + +/* True if file names should be printed before strings. */ +static bool print_file_name; + +/* Location print format string. */ +static const char *locfmt; + +/* Page size in use. */ +static size_t ps; + + +/* Mapped parts of the ELF file. */ +static unsigned char *elfmap; +static unsigned char *elfmap_base; +static size_t elfmap_size; +static off64_t elfmap_off; + + +int +main (int argc, char *argv[]) +{ + /* We use no threads. */ + __fsetlocking (stdin, FSETLOCKING_BYCALLER); + __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + (void) bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + (void) textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + int remaining; + (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + /* Tell the library which version we are expecting. */ + elf_version (EV_CURRENT); + + /* Determine the page size. We will likely need it a couple of times. */ + ps = sysconf (_SC_PAGESIZE); + + struct stat64 st; + int result = 0; + if (remaining == argc) + /* We read from standard input. This we cannot do for a + structured file. */ + result = read_fd (STDOUT_FILENO, + print_file_name ? "{standard input}" : NULL, + fstat64 (STDOUT_FILENO, &st) == 0 + ? st.st_size : INT64_C (0x7fffffffffffffff)); + else + do + { + int fd = (strcmp (argv[remaining], "-") == 0 + ? STDIN_FILENO : open (argv[remaining], O_RDONLY)); + if (unlikely (fd == -1)) + { + error (0, errno, gettext ("cannot open '%s'"), argv[remaining]); + result = 1; + } + else + { + const char *fname = print_file_name ? argv[remaining] : NULL; + int fstat_fail = fstat64 (fd, &st); + off64_t fdlen = (fstat_fail + ? INT64_C (0x7fffffffffffffff) : st.st_size); + if (fdlen > (off64_t) min_len_bytes) + { + Elf *elf = NULL; + if (entire_file + || fstat_fail + || !S_ISREG (st.st_mode) + || (elf = elf_begin (fd, ELF_C_READ, NULL)) == NULL + || elf_kind (elf) != ELF_K_ELF) + result |= read_fd (fd, fname, fdlen); + else + result |= read_elf (elf, fd, fname, fdlen); + + /* This call will succeed even if ELF is NULL. */ + elf_end (elf); + } + + if (strcmp (argv[remaining], "-") != 0) + close (fd); + } + + if (elfmap != NULL && elfmap != MAP_FAILED) + munmap (elfmap, elfmap_size); + elfmap = NULL; + } + while (++remaining < argc); + + return result; +} + + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "strings (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, gettext ("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case 'a': + entire_file = true; + break; + + case 'e': + /* We expect a string of one character. */ + switch (arg[1] != '\0' ? '\0' : arg[0]) + { + case 's': + case 'S': + char_7bit = arg[0] == 's'; + bytes_per_char = 1; + break; + + case 'b': + case 'B': + big_endian = true; + /* FALLTHROUGH */ + + case 'l': + case 'L': + bytes_per_char = isupper (arg[0]) ? 4 : 2; + break; + + default: + error (0, 0, gettext ("invalid value '%s' for %s parameter"), + arg, "-e"); + argp_help (&argp, stderr, ARGP_HELP_SEE, "strings"); + return ARGP_ERR_UNKNOWN; + } + break; + + case 'f': + print_file_name = true; + break; + + case 'n': + min_len = atoi (arg); + break; + + case 'o': + goto octfmt; + + case 't': + switch (arg[0]) + { + case 'd': + locfmt = "%7" PRId64 " "; + break; + + case 'o': + octfmt: + locfmt = "%7" PRIo64 " "; + break; + + case 'x': + locfmt = "%7" PRIx64 " "; + break; + + default: + error (0, 0, gettext ("invalid value '%s' for %s parameter"), + arg, "-t"); + argp_help (&argp, stderr, ARGP_HELP_SEE, "strings"); + return ARGP_ERR_UNKNOWN; + } + break; + + case ARGP_KEY_FINI: + /* Compute the length in bytes of any match. */ + if (min_len <= 0 || min_len > INT_MAX / bytes_per_char) + error (EXIT_FAILURE, 0, + gettext ("invalid minimum length of matched string size")); + min_len_bytes = min_len * bytes_per_char; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + + +static void +process_chunk_mb (const char *fname, const unsigned char *buf, off64_t to, + size_t len, char **unprinted) +{ + size_t curlen = *unprinted == NULL ? 0 : strlen (*unprinted); + const unsigned char *start = buf; + while (len >= bytes_per_char) + { + uint32_t ch; + + if (bytes_per_char == 2) + { + if (big_endian) + ch = buf[0] << 8 | buf[1]; + else + ch = buf[1] << 8 | buf[0]; + } + else + { + if (big_endian) + ch = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; + else + ch = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]; + } + + if (ch <= 255 && (isprint (ch) || ch == '\t')) + { + ++buf; + ++curlen; + } + else + { + if (curlen >= min_len) + { + /* We found a match. */ + if (unlikely (fname != NULL)) + { + fputs_unlocked (fname, stdout); + fputs_unlocked (": ", stdout); + } + + if (unlikely (locfmt != NULL)) + printf (locfmt, (int64_t) to - len - (buf - start)); + + if (unlikely (*unprinted != NULL)) + { + fputs_unlocked (*unprinted, stdout); + free (*unprinted); + *unprinted = NULL; + } + + /* There is no sane way of printing the string. If we + assume the file data is encoded in UCS-2/UTF-16 or + UCS-4/UTF-32 respectively we could covert the string. + But there is no such guarantee. */ + fwrite_unlocked (start, 1, buf - start, stdout); + putc_unlocked ('\n', stdout); + } + + start = ++buf; + curlen = 0; + + if (len <= min_len) + break; + } + + --len; + } + + if (curlen != 0) + *unprinted = xstrndup ((const char *) start, curlen); +} + + +static void +process_chunk (const char *fname, const unsigned char *buf, off64_t to, + size_t len, char **unprinted) +{ + /* We are not going to slow the check down for the 2- and 4-byte + encodings. Handle them special. */ + if (unlikely (bytes_per_char != 1)) + { + process_chunk_mb (fname, buf, to, len, unprinted); + return; + } + + size_t curlen = *unprinted == NULL ? 0 : strlen (*unprinted); + const unsigned char *start = buf; + while (len > 0) + { + if ((isprint (*buf) || *buf == '\t') && (! char_7bit || *buf <= 127)) + { + ++buf; + ++curlen; + } + else + { + if (curlen >= min_len) + { + /* We found a match. */ + if (likely (fname != NULL)) + { + fputs_unlocked (fname, stdout); + fputs_unlocked (": ", stdout); + } + + if (likely (locfmt != NULL)) + printf (locfmt, (int64_t) to - len - (buf - start)); + + if (unlikely (*unprinted != NULL)) + { + fputs_unlocked (*unprinted, stdout); + free (*unprinted); + *unprinted = NULL; + } + fwrite_unlocked (start, 1, buf - start, stdout); + putc_unlocked ('\n', stdout); + } + + start = ++buf; + curlen = 0; + + if (len <= min_len) + break; + } + + --len; + } + + if (curlen != 0) + *unprinted = xstrndup ((const char *) start, curlen); +} + + +/* Map a file in as large chunks as possible. */ +static void * +map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep) +{ +#if _MUDFLAP + (void) fd; + (void) start_off; + (void) fdlen; + (void) map_sizep; + return MAP_FAILED; +#else + /* Maximum size we mmap. We use an #ifdef to avoid overflows on + 32-bit machines. 64-bit machines these days do not have usable + address spaces larger than about 43 bits. Not that any file + should be that large. */ +# if SIZE_MAX > 0xffffffff + const size_t mmap_max = 0x4000000000lu; +# else + const size_t mmap_max = 0x40000000lu; +# endif + + /* Try to mmap the file. */ + size_t map_size = MIN ((off64_t) mmap_max, fdlen); + const size_t map_size_min = MAX (MAX (SIZE_MAX / 16, 2 * ps), + roundup (2 * min_len_bytes + 1, ps)); + void *mem; + while (1) + { + /* We map the memory for reading only here. Since we will + always look at every byte of the file it makes sense to + use MAP_POPULATE. */ + mem = mmap64 (NULL, map_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, + fd, start_off); + if (mem != MAP_FAILED) + { + /* We will go through the mapping sequentially. */ + (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL); + break; + } + if (errno != EINVAL && errno != ENOMEM) + /* This is an error other than the lack of address space. */ + break; + + /* Maybe the size of the mapping is too big. Try again. */ + map_size /= 2; + if (map_size < map_size_min) + /* That size should have fit. */ + break; + } + + *map_sizep = map_size; + return mem; +#endif +} + + +/* Read the file without mapping. */ +static int +read_block_no_mmap (int fd, const char *fname, off64_t from, off64_t fdlen) +{ + char *unprinted = NULL; +#define CHUNKSIZE 65536 + unsigned char *buf = xmalloc (CHUNKSIZE + min_len_bytes + + bytes_per_char - 1); + size_t ntrailer = 0; + int result = 0; + while (fdlen > 0) + { + ssize_t n = TEMP_FAILURE_RETRY (read (fd, buf + ntrailer, + MIN (fdlen, CHUNKSIZE))); + if (n == 0) + { + /* There are less than MIN_LEN+1 bytes left so there cannot be + another match. */ + assert (unprinted == NULL || ntrailer == 0); + break; + } + if (unlikely (n < 0)) + { + /* Something went wrong. */ + result = 1; + break; + } + + /* Account for the number of bytes read in this round. */ + fdlen -= n; + + /* Do not use the signed N value. Note that the addition cannot + overflow. */ + size_t nb = (size_t) n + ntrailer; + if (nb >= min_len_bytes) + { + /* We only use complete charactesr. */ + nb &= ~(bytes_per_char - 1); + + process_chunk (fname, buf, from + nb, nb, &unprinted); + + /* If the last bytes of the buffer (module the character + size) have been printed we are not copying them. */ + size_t to_keep = unprinted != NULL ? 0 : min_len_bytes; + + memmove (buf, buf + nb - to_keep, to_keep + nb); + ntrailer = to_keep + nb; + from += nb; + } + else + ntrailer = nb; + } + + free (buf); + + /* Don't print anything we collected so far. There is no + terminating NUL byte. */ + free (unprinted); + + return result; +} + + +static int +read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to) +{ + assert ((off64_t) min_len_bytes < fdlen); + + if (elfmap == NULL) + { + /* We need a completely new mapping. */ + elfmap_off = from & ~(ps - 1); + elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size); + + if (unlikely (elfmap == MAP_FAILED)) + /* Let the kernel know we are going to read everything in sequence. */ + (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL); + } + + if (unlikely (elfmap == MAP_FAILED)) + { + /* Read from the file descriptor. For this we must position the + read pointer. */ + // XXX Eventually add flag which avoids this if the position + // XXX is known to match. + if (lseek64 (fd, from, SEEK_SET) != from) + error (EXIT_FAILURE, errno, gettext ("lseek64 failed")); + + return read_block_no_mmap (fd, fname, from, to - from); + } + + if (to < (off64_t) elfmap_off || from > (off64_t) (elfmap_off + elfmap_size)) + { + /* The existing mapping cannot fit at all. Map the new area. + We always map the full range of ELFMAP_SIZE bytes even if + this extend beyond the end of the file. The Linux kernel + handles this OK if the access pages are not touched. */ + elfmap_off = from & ~(ps - 1); + if (mmap64 (elfmap, elfmap_size, PROT_READ, + MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, from) + == MAP_FAILED) + error (EXIT_FAILURE, errno, gettext ("re-mmap failed")); + elfmap_base = elfmap; + } + + char *unprinted = NULL; + + /* Use the existing mapping as much as possible. If necessary, map + new pages. */ + if (from >= (off64_t) elfmap_off + && from < (off64_t) (elfmap_off + elfmap_size)) + /* There are at least a few bytes in this mapping which we can + use. */ + process_chunk (fname, elfmap_base + (from - elfmap_off), + MIN (to, (off64_t) (elfmap_off + elfmap_size)), + MIN (to, (off64_t) (elfmap_off + elfmap_size)) - from, + &unprinted); + + if (to > (off64_t) (elfmap_off + elfmap_size)) + { + unsigned char *remap_base = elfmap_base; + size_t read_now = elfmap_size - (elfmap_base - elfmap); + + assert (from >= (off64_t) elfmap_off + && from < (off64_t) (elfmap_off + elfmap_size)); + off64_t handled_to = elfmap_off + elfmap_size; + assert (elfmap == elfmap_base + || (elfmap_base - elfmap + == (ptrdiff_t) ((min_len_bytes + ps - 1) & ~(ps - 1)))); + if (elfmap == elfmap_base) + { + size_t keep_area = (min_len_bytes + ps - 1) & ~(ps - 1); + assert (elfmap_size >= keep_area + ps); + /* The keep area is used for the content of the previous + buffer we have to keep. This means copying those bytes + and for this we have to make the data writable. */ + if (unlikely (mprotect (elfmap, keep_area, PROT_READ | PROT_WRITE) + != 0)) + error (EXIT_FAILURE, errno, gettext ("mprotect failed")); + + elfmap_base = elfmap + keep_area; + } + + while (1) + { + /* Map the rest of the file, eventually again in pieces. + We speed things up with a nice Linux feature. Note + that we have at least two pages mapped. */ + size_t to_keep = unprinted != NULL ? 0 : min_len_bytes; + + assert (read_now >= to_keep); + memmove (elfmap_base - to_keep, + remap_base + read_now - to_keep, to_keep); + remap_base = elfmap_base; + + assert ((elfmap_size - (elfmap_base - elfmap)) % bytes_per_char + == 0); + read_now = MIN (to - handled_to, + (ptrdiff_t) elfmap_size - (elfmap_base - elfmap)); + + assert (handled_to % ps == 0); + assert (handled_to % bytes_per_char == 0); + if (mmap64 (remap_base, read_now, PROT_READ, + MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, handled_to) + == MAP_FAILED) + error (EXIT_FAILURE, errno, gettext ("re=mmap failed")); + elfmap_off = handled_to; + + process_chunk (fname, remap_base - to_keep, + elfmap_off + (read_now & ~(bytes_per_char - 1)), + to_keep + (read_now & ~(bytes_per_char - 1)), + &unprinted); + handled_to += read_now; + if (handled_to >= to) + break; + } + } + + /* Don't print anything we collected so far. There is no + terminating NUL byte. */ + free (unprinted); + + return 0; +} + + +static int +read_fd (int fd, const char *fname, off64_t fdlen) +{ + return read_block (fd, fname, fdlen, 0, fdlen); +} + + +static int +read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen) +{ + assert (fdlen >= 0); + + /* We will look at each section separately. The ELF file is not + mmapped. The libelf implementation will load the needed parts on + demand. Since we only interate over the section header table the + memory consumption at this stage is kept minimal. */ + Elf_Scn *scn = elf_nextscn (elf, NULL); + if (scn == NULL) + return read_fd (fd, fname, fdlen); + + int result = 0; + do + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + + /* Only look in sections which are loaded at runtime and + actually have content. */ + if (shdr != NULL && shdr->sh_type != SHT_NOBITS + && (shdr->sh_flags & SHF_ALLOC) != 0) + result |= read_block (fd, fname, fdlen, shdr->sh_offset, + shdr->sh_offset + shdr->sh_size); + } + while ((scn = elf_nextscn (elf, scn)) != NULL); + + if (elfmap != NULL && elfmap != MAP_FAILED) + munmap (elfmap, elfmap_size); + elfmap = NULL; + + return result; +} + + +#include "debugpred.h" diff --git a/src/strip.c b/src/strip.c index e5c4289c..0f83e61d 100644 --- a/src/strip.c +++ b/src/strip.c @@ -1,16 +1,28 @@ /* Discard section not used at runtime from object files. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -45,6 +57,9 @@ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + /* Values for the parameters which have no short form. */ #define OPT_REMOVE_COMMENT 0x100 @@ -54,19 +69,24 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - { NULL, 0, NULL, 0, N_("Output selection:") }, - { NULL, 'o', "FILE", 0, N_("Place stripped output into FILE") }, - { NULL, 'f', "FILE", 0, N_("Extract the removed sections into FILE") }, - - { NULL, 0, NULL, 0, N_("Output options:") }, - { "strip-debug", 'g', NULL, 0, N_("Remove all debugging symbols") }, + { NULL, 0, NULL, 0, N_("Output selection:"), 0 }, + { "output", 'o', "FILE", 0, N_("Place stripped output into FILE"), 0 }, + { NULL, 'f', "FILE", 0, N_("Extract the removed sections into FILE"), 0 }, + { NULL, 'F', "FILE", 0, N_("Embed name FILE instead of -f argument"), 0 }, + + { NULL, 0, NULL, 0, N_("Output options:"), 0 }, + { "strip-all", 's', NULL, OPTION_HIDDEN, NULL, 0 }, + { "strip-debug", 'g', NULL, 0, N_("Remove all debugging symbols"), 0 }, + { NULL, 'd', NULL, OPTION_ALIAS, NULL, 0 }, + { NULL, 'S', NULL, OPTION_ALIAS, NULL, 0 }, { "preserve-dates", 'p', NULL, 0, - N_("Copy modified/access timestamps to the output") }, + N_("Copy modified/access timestamps to the output"), 0 }, { "remove-comment", OPT_REMOVE_COMMENT, NULL, 0, - N_("Remove .comment section") }, + N_("Remove .comment section"), 0 }, + { "remove-section", 'R', "SECTION", OPTION_HIDDEN, NULL, 0 }, { "permissive", OPT_PERMISSIVE, NULL, 0, - N_("Relax a few rules to handle slightly broken ELF files") }, - { NULL, 0, NULL, 0, NULL } + N_("Relax a few rules to handle slightly broken ELF files"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } }; /* Short description of program. */ @@ -78,13 +98,10 @@ static const char args_doc[] = N_("[FILE...]"); /* Prototype for option handler. */ static error_t parse_opt (int key, char *arg, struct argp_state *state); -/* Function to print some extra text in the help message. */ -static char *more_help (int key, const char *text, void *input); - /* Data structure to communicate with argp functions. */ static struct argp argp = { - options, parse_opt, args_doc, doc, NULL, more_help + options, parse_opt, args_doc, doc, NULL, NULL, NULL }; @@ -101,7 +118,7 @@ static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, #define INTERNAL_ERROR(fname) \ error (EXIT_FAILURE, 0, gettext ("%s: INTERNAL ERROR %d (%s-%s): %s"), \ - fname, __LINE__, VERSION, __DATE__, elf_errmsg (-1)) + fname, __LINE__, PACKAGE_VERSION, __DATE__, elf_errmsg (-1)) /* Name of the output file. */ @@ -110,6 +127,9 @@ static const char *output_fname; /* Name of the debug output file. */ static const char *debug_fname; +/* Name to pretend the debug output file has. */ +static const char *debug_fname_embed; + /* If true output files shall have same date as the input file. */ static bool preserve_dates; @@ -141,13 +161,14 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); /* Make sure the message catalog can be found. */ - bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); /* Initialize the message catalog. */ - textdomain (PACKAGE); + textdomain (PACKAGE_TARNAME); /* Parse and process arguments. */ - argp_parse (&argp, argc, argv, 0, &remaining, NULL); + if (argp_parse (&argp, argc, argv, 0, &remaining, NULL) != 0) + return EXIT_FAILURE; /* Tell the library which version we are expecting. */ elf_version (EV_CURRENT); @@ -157,7 +178,7 @@ main (int argc, char *argv[]) result = process_file ("a.out"); else { - /* If we have seen the `-o' or '-f' option there must be exactly one + /* If we have seen the '-o' or '-f' option there must be exactly one input file. */ if ((output_fname != NULL || debug_fname != NULL) && remaining + 1 < argc) @@ -176,14 +197,14 @@ Only one input file allowed together with '-o' and '-f'")); /* Print the version information. */ static void -print_version (FILE *stream, struct argp_state *state) +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) { - fprintf (stream, "strip (%s) %s\n", PACKAGE_NAME, VERSION); + fprintf (stream, "strip (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, gettext ("\ Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2004"); +"), "2008"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -195,10 +216,29 @@ parse_opt (int key, char *arg, struct argp_state *state) switch (key) { case 'f': + if (debug_fname != NULL) + { + error (0, 0, gettext ("-f option specified twice")); + return EINVAL; + } debug_fname = arg; break; + case 'F': + if (debug_fname_embed != NULL) + { + error (0, 0, gettext ("-F option specified twice")); + return EINVAL; + } + debug_fname_embed = arg; + break; + case 'o': + if (output_fname != NULL) + { + error (0, 0, gettext ("-o option specified twice")); + return EINVAL; + } output_fname = arg; break; @@ -210,7 +250,20 @@ parse_opt (int key, char *arg, struct argp_state *state) remove_comment = true; break; + case 'R': + if (!strcmp (arg, ".comment")) + remove_comment = true; + else + { + argp_error (state, + gettext ("-R option supports only .comment section")); + return EINVAL; + } + break; + case 'g': + case 'd': + case 'S': remove_debug = true; break; @@ -218,6 +271,9 @@ parse_opt (int key, char *arg, struct argp_state *state) permissive = true; break; + case 's': /* Ignored for compatibility. */ + break; + default: return ARGP_ERR_UNKNOWN; } @@ -225,27 +281,6 @@ parse_opt (int key, char *arg, struct argp_state *state) } -static char * -more_help (int key, const char *text, void *input) -{ - char *buf; - - switch (key) - { - case ARGP_KEY_HELP_EXTRA: - /* We print some extra information. */ - if (asprintf (&buf, gettext ("Please report bugs to %s.\n"), - PACKAGE_BUGREPORT) < 0) - buf = NULL; - return buf; - - default: - break; - } - return (char *) text; -} - - static int process_file (const char *fname) { @@ -259,7 +294,7 @@ process_file (const char *fname) { if (stat64 (fname, &pre_st) != 0) { - error (0, errno, gettext ("cannot stat input file \"%s\""), fname); + error (0, errno, gettext ("cannot stat input file '%s'"), fname); return 1; } @@ -270,10 +305,10 @@ process_file (const char *fname) } /* Open the file. */ - int fd = open (fname, O_RDWR); + int fd = open (fname, output_fname == NULL ? O_RDWR : O_RDONLY); if (fd == -1) { - error (0, errno, gettext ("while opening \"%s\""), fname); + error (0, errno, gettext ("while opening '%s'"), fname); return 1; } @@ -283,7 +318,7 @@ process_file (const char *fname) struct stat64 st; if (fstat64 (fd, &st) != 0) { - error (0, errno, gettext ("cannot stat input file \"%s\""), fname); + error (0, errno, gettext ("cannot stat input file '%s'"), fname); return 1; } /* Paranoid mode on. */ @@ -296,7 +331,8 @@ process_file (const char *fname) } /* Now get the ELF descriptor. */ - Elf *elf = elf_begin (fd, ELF_C_RDWR, NULL); + Elf *elf = elf_begin (fd, output_fname == NULL ? ELF_C_RDWR : ELF_C_READ, + NULL); int result; switch (elf_kind (elf)) { @@ -308,9 +344,9 @@ process_file (const char *fname) case ELF_K_AR: /* It is not possible to strip the content of an archive direct the output to a specific file. */ - if (unlikely (output_fname != NULL)) + if (unlikely (output_fname != NULL || debug_fname != NULL)) { - error (0, 0, gettext ("%s: cannot use -o when stripping archive"), + error (0, 0, gettext ("%s: cannot use -o or -f when stripping archive"), fname); result = 1; } @@ -336,27 +372,6 @@ process_file (const char *fname) /* Maximum size of array allocated on stack. */ #define MAX_STACK_ALLOC (400 * 1024) - -static uint32_t -crc32_file (int fd, uint32_t *resp) -{ - unsigned char buffer[1024 * 8]; - uint32_t crc = 0; - ssize_t count; - - /* We have to rewind. */ - if (lseek (fd, 0, SEEK_SET) < 0) - return 1; - - while ((count = TEMP_FAILURE_RETRY (read (fd, buffer, sizeof (buffer)))) > 0) - crc = crc32 (crc, buffer, count); - - *resp = crc; - - return count != 0; -} - - static int handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, mode_t mode, struct timeval tvp[2]) @@ -365,19 +380,17 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, size_t fname_len = strlen (fname) + 1; char *fullname = alloca (prefix_len + 1 + fname_len); char *cp = fullname; - Elf *newelf; Elf *debugelf = NULL; char *tmp_debug_fname = NULL; int result = 0; - GElf_Ehdr ehdr_mem; - GElf_Ehdr *ehdr; + size_t shdridx = 0; size_t shstrndx; - size_t shnum; struct shdr_info { Elf_Scn *scn; GElf_Shdr shdr; Elf_Data *data; + Elf_Data *debug_data; const char *name; Elf32_Word idx; /* Index in new file. */ Elf32_Word old_sh_link; /* Original value of shdr.sh_link. */ @@ -398,7 +411,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, GElf_Ehdr debugehdr_mem; GElf_Ehdr *debugehdr; struct Ebl_Strtab *shst = NULL; - uint32_t debug_crc; + Elf_Data debuglink_crc_data; bool any_symtab_changes = false; Elf_Data *shstrtab_data = NULL; @@ -416,7 +429,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, fd = open (output_fname, O_RDWR | O_CREAT, mode); if (unlikely (fd == -1)) { - error (0, errno, gettext ("cannot open `%s'"), output_fname); + error (0, errno, gettext ("cannot open '%s'"), output_fname); return 1; } } @@ -451,14 +464,15 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, debug_fd = mkstemp (tmp_debug_fname); if (unlikely (debug_fd == -1)) { - error (0, errno, gettext ("cannot open `%s'"), debug_fname); + error (0, errno, gettext ("cannot open '%s'"), debug_fname); result = 1; goto fail; } } /* Get the information from the old file. */ - ehdr = gelf_getehdr (elf, &ehdr_mem); + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); if (ehdr == NULL) INTERNAL_ERROR (fname); @@ -470,6 +484,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* We now create a new ELF descriptor for the same file. We construct it almost exactly in the same way with some information dropped. */ + Elf *newelf; if (output_fname != NULL) newelf = elf_begin (fd, ELF_C_WRITE_MMAP, NULL); else @@ -479,7 +494,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, || (ehdr->e_type != ET_REL && unlikely (gelf_newphdr (newelf, ehdr->e_phnum) == 0))) { - error (0, 0, gettext ("cannot create new file `%s': %s"), + error (0, 0, gettext ("cannot create new file '%s': %s"), output_fname, elf_errmsg (-1)); goto fail; } @@ -489,9 +504,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) { GElf_Phdr phdr_mem; - GElf_Phdr *phdr; - - phdr = gelf_getphdr (elf, cnt, &phdr_mem); + GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &phdr_mem); if (phdr == NULL || unlikely (gelf_update_phdr (newelf, cnt, phdr) == 0)) INTERNAL_ERROR (fname); @@ -505,7 +518,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, || (ehdr->e_type != ET_REL && unlikely (gelf_newphdr (debugelf, ehdr->e_phnum) == 0))) { - error (0, 0, gettext ("cannot create new file `%s': %s"), + error (0, 0, gettext ("cannot create new file '%s': %s"), debug_fname, elf_errmsg (-1)); goto fail_close; } @@ -515,9 +528,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) { GElf_Phdr phdr_mem; - GElf_Phdr *phdr; - - phdr = gelf_getphdr (elf, cnt, &phdr_mem); + GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &phdr_mem); if (phdr == NULL || unlikely (gelf_update_phdr (debugelf, cnt, phdr) == 0)) INTERNAL_ERROR (fname); @@ -525,6 +536,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, } /* Number of sections. */ + size_t shnum; if (unlikely (elf_getshnum (elf, &shnum) < 0)) { error (0, 0, gettext ("cannot determine number of sections: %s"), @@ -566,7 +578,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, shdr_info[cnt].shdr.sh_name); if (shdr_info[cnt].name == NULL) { - error (0, 0, gettext ("illformed file `%s'"), fname); + error (0, 0, gettext ("illformed file '%s'"), fname); goto fail_close; } @@ -592,9 +604,6 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, } else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP)) { - Elf32_Word *grpref; - size_t inner; - /* Cross-reference the sections contained in the section group. */ shdr_info[cnt].data = elf_getdata (shdr_info[cnt].scn, NULL); @@ -602,7 +611,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, INTERNAL_ERROR (fname); /* XXX Fix for unaligned access. */ - grpref = (Elf32_Word *) shdr_info[cnt].data->d_buf; + Elf32_Word *grpref = (Elf32_Word *) shdr_info[cnt].data->d_buf; + size_t inner; for (inner = 1; inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word); ++inner) @@ -651,8 +661,9 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, */ for (cnt = 1; cnt < shnum; ++cnt) /* Check whether the section can be removed. */ - if (SECTION_STRIP_P (ebl, elf, ehdr, &shdr_info[cnt].shdr, - shdr_info[cnt].name, remove_comment, remove_debug)) + if (ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr, + shdr_info[cnt].name, remove_comment, + remove_debug)) { /* For now assume this section will be removed. */ shdr_info[cnt].idx = 0; @@ -660,16 +671,14 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, idx = shdr_info[cnt].group_idx; while (idx != 0) { - /* If the references section group is a normal section - group and has one element remaining, or if it is an - empty COMDAT section group it is removed. */ - bool is_comdat; - /* The section group data is already loaded. */ assert (shdr_info[idx].data != NULL); - is_comdat = (((Elf32_Word *) shdr_info[idx].data->d_buf)[0] - & GRP_COMDAT) != 0; + /* If the references section group is a normal section + group and has one element remaining, or if it is an + empty COMDAT section group it is removed. */ + bool is_comdat = (((Elf32_Word *) shdr_info[idx].data->d_buf)[0] + & GRP_COMDAT) != 0; --shdr_info[idx].group_cnt; if ((!is_comdat && shdr_info[idx].group_cnt == 1) @@ -712,13 +721,11 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* The content of symbol tables we don't remove must not reference any section which we do remove. Otherwise we cannot remove the section. */ - if (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM - || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB) + if (debug_fname != NULL + && shdr_info[cnt].debug_data == NULL + && (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM + || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB)) { - Elf_Data *symdata; - Elf_Data *xndxdata; - size_t elsize; - /* Make sure the data is loaded. */ if (shdr_info[cnt].data == NULL) { @@ -727,7 +734,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, if (shdr_info[cnt].data == NULL) INTERNAL_ERROR (fname); } - symdata = shdr_info[cnt].data; + Elf_Data *symdata = shdr_info[cnt].data; /* If there is an extended section index table load it as well. */ @@ -742,11 +749,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, if (shdr_info[shdr_info[cnt].symtab_idx].data == NULL) INTERNAL_ERROR (fname); } - xndxdata = shdr_info[shdr_info[cnt].symtab_idx].data; + Elf_Data *xndxdata + = shdr_info[shdr_info[cnt].symtab_idx].data; /* Go through all symbols and make sure the section they reference is not removed. */ - elsize = gelf_fsize (elf, ELF_T_SYM, 1, ehdr->e_version); + size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, + ehdr->e_version); for (size_t inner = 0; inner < shdr_info[cnt].data->d_size / elsize; @@ -754,15 +763,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, { GElf_Sym sym_mem; Elf32_Word xndx; - GElf_Sym *sym; - size_t scnidx; - - sym = gelf_getsymshndx (symdata, xndxdata, inner, - &sym_mem, &xndx); + GElf_Sym *sym = gelf_getsymshndx (symdata, xndxdata, + inner, &sym_mem, + &xndx); if (sym == NULL) INTERNAL_ERROR (fname); - scnidx = sym->st_shndx; + size_t scnidx = sym->st_shndx; if (scnidx == SHN_UNDEF || scnidx >= shnum || (scnidx >= SHN_LORESERVE && scnidx <= SHN_HIRESERVE @@ -775,24 +782,23 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, scnidx = xndx; if (shdr_info[scnidx].idx == 0) - { - /* Mark this section as used. */ - shdr_info[scnidx].idx = 1; - changes |= scnidx < cnt; - } + /* This symbol table has a real symbol in + a discarded section. So preserve the + original table in the debug file. */ + shdr_info[cnt].debug_data = symdata; } } /* Cross referencing happens: - for the cases the ELF specification says. That are - + SHT_DYNAMIC in sh_link to string table - + SHT_HASH in sh_link to symbol table - + SHT_REL and SHT_RELA in sh_link to symbol table - + SHT_SYMTAB and SHT_DYNSYM in sh_link to string table - + SHT_GROUP in sh_link to symbol table - + SHT_SYMTAB_SHNDX in sh_link to symbol table - Other (OS or architecture-specific) sections might as - well use this field so we process it unconditionally. + + SHT_DYNAMIC in sh_link to string table + + SHT_HASH in sh_link to symbol table + + SHT_REL and SHT_RELA in sh_link to symbol table + + SHT_SYMTAB and SHT_DYNSYM in sh_link to string table + + SHT_GROUP in sh_link to symbol table + + SHT_SYMTAB_SHNDX in sh_link to symbol table + Other (OS or architecture-specific) sections might as + well use this field so we process it unconditionally. - references inside section groups - specially marked references in sh_info if the SHF_INFO_LINK flag is set @@ -815,34 +821,63 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* Mark the section as investigated. */ shdr_info[cnt].idx = 2; } + + if (debug_fname != NULL + && (shdr_info[cnt].idx == 0 || shdr_info[cnt].debug_data != NULL)) + { + /* This section is being preserved in the debug file. + Sections it refers to must be preserved there too. + + In this pass we mark sections to be preserved in both + files by setting the .debug_data pointer to the original + file's .data pointer. Below, we'll copy the section + contents. */ + + inline void check_preserved (size_t i) + { + if (i != 0 && shdr_info[i].idx != 0) + { + if (shdr_info[i].data == NULL) + shdr_info[i].data = elf_getdata (shdr_info[i].scn, NULL); + if (shdr_info[i].data == NULL) + INTERNAL_ERROR (fname); + + shdr_info[i].debug_data = shdr_info[i].data; + changes |= i < cnt; + } + } + + check_preserved (shdr_info[cnt].shdr.sh_link); + if (SH_INFO_LINK_P (&shdr_info[cnt].shdr)) + check_preserved (shdr_info[cnt].shdr.sh_info); + } } } while (changes); - /* Write out a copy of all the sections to the debug output file. - The ones that are not removed in the stripped file are SHT_NOBITS */ + /* Copy the removed sections to the debug output file. + The ones that are not removed in the stripped file are SHT_NOBITS. */ if (debug_fname != NULL) { for (cnt = 1; cnt < shnum; ++cnt) { - Elf_Data *debugdata; - GElf_Shdr debugshdr; - int discard_section; - scn = elf_newscn (debugelf); if (scn == NULL) error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"), elf_errmsg (-1)); - discard_section = shdr_info[cnt].idx > 0 && cnt != ehdr->e_shstrndx; + bool discard_section = (shdr_info[cnt].idx > 0 + && shdr_info[cnt].debug_data == NULL + && shdr_info[cnt].shdr.sh_type != SHT_NOTE + && cnt != ehdr->e_shstrndx); /* Set the section header in the new file. */ - debugshdr = shdr_info[cnt].shdr; + GElf_Shdr debugshdr = shdr_info[cnt].shdr; if (discard_section) debugshdr.sh_type = SHT_NOBITS; - if (unlikely (gelf_update_shdr (scn, &debugshdr)) == 0) + if (unlikely (gelf_update_shdr (scn, &debugshdr) == 0)) /* There cannot be any overflows. */ INTERNAL_ERROR (fname); @@ -855,14 +890,22 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, } /* Set the data. This is done by copying from the old file. */ - debugdata = elf_newdata (scn); + Elf_Data *debugdata = elf_newdata (scn); if (debugdata == NULL) INTERNAL_ERROR (fname); - /* Copy the structure. */ + /* Copy the structure. This data may be modified in place + before we write out the file. */ *debugdata = *shdr_info[cnt].data; if (discard_section) debugdata->d_buf = NULL; + else if (shdr_info[cnt].debug_data != NULL) + { + /* Copy the original data before it gets modified. */ + shdr_info[cnt].debug_data = debugdata; + debugdata->d_buf = memcpy (xmalloc (debugdata->d_size), + debugdata->d_buf, debugdata->d_size); + } } /* Finish the ELF header. Fill in the fields not handled by @@ -879,46 +922,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, debugehdr->e_flags = ehdr->e_flags; debugehdr->e_shstrndx = ehdr->e_shstrndx; - if (unlikely (gelf_update_ehdr (debugelf, debugehdr)) == 0) + if (unlikely (gelf_update_ehdr (debugelf, debugehdr) == 0)) { error (0, 0, gettext ("%s: error while creating ELF header: %s"), debug_fname, elf_errmsg (-1)); result = 1; goto fail_close; } - - /* Finally write the file. */ - if (unlikely (elf_update (debugelf, ELF_C_WRITE)) == -1) - { - error (0, 0, gettext ("while writing `%s': %s"), - debug_fname, elf_errmsg (-1)); - result = 1; - goto fail_close; - } - - /* Create the real output file. First rename, then change the - mode. */ - if (rename (tmp_debug_fname, debug_fname) != 0 - || fchmod (debug_fd, mode) != 0) - { - error (0, errno, gettext ("while creating '%s'"), debug_fname); - result = 1; - goto fail_close; - } - - /* The temporary file does not exist anymore. */ - tmp_debug_fname = NULL; - - /* Compute the checksum which we will add to the executable. */ - if (crc32_file (debug_fd, &debug_crc) != 0) - { - error (0, errno, - gettext ("while computing checksum for debug information")); - unlink (debug_fname); - result = 1; - goto fail_close; - } - } /* Mark the section header string table as unused, we will create @@ -928,7 +938,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* We need a string table for the section headers. */ shst = ebl_strtabinit (true); if (shst == NULL) - error (EXIT_FAILURE, errno, gettext ("while preparing output for `%s'"), + error (EXIT_FAILURE, errno, gettext ("while preparing output for '%s'"), output_fname ?: fname); /* Assign new section numbers. */ @@ -958,9 +968,6 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* Create the reference to the file with the debug info. */ if (debug_fname != NULL) { - char *debug_basename; - off_t crc_offset; - /* Add the section header string table section name. */ shdr_info[cnt].se = ebl_strtabadd (shst, ".gnu_debuglink", 15); shdr_info[cnt].idx = idx++; @@ -991,8 +998,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, error (EXIT_FAILURE, 0, gettext ("cannot allocate section data: %s"), elf_errmsg (-1)); - debug_basename = basename (debug_fname); - crc_offset = strlen (debug_basename) + 1; + char *debug_basename = basename (debug_fname_embed ?: debug_fname); + off_t crc_offset = strlen (debug_basename) + 1; /* Align to 4 byte boundary */ crc_offset = ((crc_offset - 1) & ~3) + 4; @@ -1002,21 +1009,20 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, shdr_info[cnt].data->d_buf = xcalloc (1, shdr_info[cnt].data->d_size); strcpy (shdr_info[cnt].data->d_buf, debug_basename); - /* Store the crc value in the correct byteorder */ - if ((__BYTE_ORDER == __LITTLE_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2MSB) - || (__BYTE_ORDER == __BIG_ENDIAN - && ehdr->e_ident[EI_DATA] == ELFDATA2LSB)) - debug_crc = bswap_32 (debug_crc); - memcpy ((char *)shdr_info[cnt].data->d_buf + crc_offset, - (char *) &debug_crc, 4); + + /* Cache this Elf_Data describing the CRC32 word in the section. + We'll fill this in when we have written the debug file. */ + debuglink_crc_data = *shdr_info[cnt].data; + debuglink_crc_data.d_buf = ((char *) debuglink_crc_data.d_buf + + crc_offset); + debuglink_crc_data.d_size = 4; /* One more section done. */ ++cnt; } /* Index of the section header table in the shdr_info array. */ - size_t shdridx = cnt; + shdridx = cnt; /* Add the section header string table section name. */ shdr_info[cnt].se = ebl_strtabadd (shst, ".shstrtab", 10); @@ -1112,7 +1118,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* We know the size. */ shdr_info[cnt].shdr.sh_size = shdr_info[cnt].data->d_size; - /* We have to adjust symtol tables. The st_shndx member might + /* We have to adjust symbol tables. The st_shndx member might have to be updated. */ if (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM || shdr_info[cnt].shdr.sh_type == SHT_SYMTAB) @@ -1240,7 +1246,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, shdr_info[cnt].shdr.sh_info = destidx - 1; } } - else + else if (debug_fname == NULL + || shdr_info[cnt].debug_data == NULL) /* This is a section symbol for a section which has been removed. */ assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION); @@ -1282,302 +1289,339 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* Adjust symbol references if symbol tables changed. */ if (any_symtab_changes) - { - /* Find all relocation sections which use this - symbol table. */ - for (cnt = 1; cnt <= shdridx; ++cnt) + /* Find all relocation sections which use this symbol table. */ + for (cnt = 1; cnt <= shdridx; ++cnt) + { + /* Update section headers when the data size has changed. + We also update the SHT_NOBITS section in the debug + file so that the section headers match in sh_size. */ + inline void update_section_size (const Elf_Data *newdata) { - if (shdr_info[cnt].idx == 0) - /* Ignore sections which are discarded. */ - continue; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + shdr->sh_size = newdata->d_size; + (void) gelf_update_shdr (scn, shdr); + if (debugelf != NULL) + { + /* libelf will use d_size to set sh_size. */ + Elf_Data *debugdata = elf_getdata (elf_getscn (debugelf, + cnt), NULL); + debugdata->d_size = newdata->d_size; + } + } - if (shdr_info[cnt].shdr.sh_type == SHT_REL - || shdr_info[cnt].shdr.sh_type == SHT_RELA) + if (shdr_info[cnt].idx == 0 && debug_fname == NULL) + /* Ignore sections which are discarded. When we are saving a + relocation section in a separate debug file, we must fix up + the symbol table references. */ + continue; + + const Elf32_Word symtabidx = shdr_info[cnt].old_sh_link; + const Elf32_Word *const newsymidx = shdr_info[symtabidx].newsymidx; + switch (shdr_info[cnt].shdr.sh_type) + { + inline bool no_symtab_updates (void) { /* If the symbol table hasn't changed, do not do anything. */ - if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx == NULL) - continue; + if (shdr_info[symtabidx].newsymidx == NULL) + return true; - Elf32_Word *newsymidx - = shdr_info[shdr_info[cnt].old_sh_link].newsymidx; - Elf_Data *d = elf_getdata (elf_getscn (newelf, + /* If the symbol table is not discarded, but additionally + duplicated in the separate debug file and this section + is discarded, don't adjust anything. */ + return (shdr_info[cnt].idx == 0 + && shdr_info[symtabidx].debug_data != NULL); + } + + case SHT_REL: + case SHT_RELA: + if (no_symtab_updates ()) + break; + + Elf_Data *d = elf_getdata (shdr_info[cnt].idx == 0 + ? elf_getscn (debugelf, cnt) + : elf_getscn (newelf, shdr_info[cnt].idx), - NULL); - assert (d != NULL); - size_t nrels = (shdr_info[cnt].shdr.sh_size - / shdr_info[cnt].shdr.sh_entsize); + NULL); + assert (d != NULL); + size_t nrels = (shdr_info[cnt].shdr.sh_size + / shdr_info[cnt].shdr.sh_entsize); - if (shdr_info[cnt].shdr.sh_type == SHT_REL) - for (size_t relidx = 0; relidx < nrels; ++relidx) - { - GElf_Rel rel_mem; - if (gelf_getrel (d, relidx, &rel_mem) == NULL) - INTERNAL_ERROR (fname); + if (shdr_info[cnt].shdr.sh_type == SHT_REL) + for (size_t relidx = 0; relidx < nrels; ++relidx) + { + GElf_Rel rel_mem; + if (gelf_getrel (d, relidx, &rel_mem) == NULL) + INTERNAL_ERROR (fname); - size_t symidx = GELF_R_SYM (rel_mem.r_info); - if (newsymidx[symidx] != symidx) - { - rel_mem.r_info - = GELF_R_INFO (newsymidx[symidx], - GELF_R_TYPE (rel_mem.r_info)); + size_t symidx = GELF_R_SYM (rel_mem.r_info); + if (newsymidx[symidx] != symidx) + { + rel_mem.r_info + = GELF_R_INFO (newsymidx[symidx], + GELF_R_TYPE (rel_mem.r_info)); - if (gelf_update_rel (d, relidx, &rel_mem) == 0) - INTERNAL_ERROR (fname); - } - } - else - for (size_t relidx = 0; relidx < nrels; ++relidx) - { - GElf_Rela rel_mem; - if (gelf_getrela (d, relidx, &rel_mem) == NULL) - INTERNAL_ERROR (fname); + if (gelf_update_rel (d, relidx, &rel_mem) == 0) + INTERNAL_ERROR (fname); + } + } + else + for (size_t relidx = 0; relidx < nrels; ++relidx) + { + GElf_Rela rel_mem; + if (gelf_getrela (d, relidx, &rel_mem) == NULL) + INTERNAL_ERROR (fname); - size_t symidx = GELF_R_SYM (rel_mem.r_info); - if (newsymidx[symidx] != symidx) - { - rel_mem.r_info - = GELF_R_INFO (newsymidx[symidx], - GELF_R_TYPE (rel_mem.r_info)); + size_t symidx = GELF_R_SYM (rel_mem.r_info); + if (newsymidx[symidx] != symidx) + { + rel_mem.r_info + = GELF_R_INFO (newsymidx[symidx], + GELF_R_TYPE (rel_mem.r_info)); - if (gelf_update_rela (d, relidx, &rel_mem) == 0) - INTERNAL_ERROR (fname); - } - } - } - else if (shdr_info[cnt].shdr.sh_type == SHT_HASH) - { - /* We have to recompute the hash table. */ - Elf32_Word symtabidx = shdr_info[cnt].old_sh_link; + if (gelf_update_rela (d, relidx, &rel_mem) == 0) + INTERNAL_ERROR (fname); + } + } + break; - /* We do not have to do anything if the symbol table was - not changed. */ - if (shdr_info[symtabidx].newsymidx == NULL) - continue; + case SHT_HASH: + if (no_symtab_updates ()) + break; - /* The symbol version section in the new file. */ - scn = elf_getscn (newelf, shdr_info[cnt].idx); + /* We have to recompute the hash table. */ - /* The symbol table data. */ - Elf_Data *symd = elf_getdata (elf_getscn (newelf, - shdr_info[symtabidx].idx), - NULL); - assert (symd != NULL); + assert (shdr_info[cnt].idx > 0); - /* The hash table data. */ - Elf_Data *hashd = elf_getdata (scn, NULL); - assert (hashd != NULL); + /* The hash section in the new file. */ + scn = elf_getscn (newelf, shdr_info[cnt].idx); - if (shdr_info[cnt].shdr.sh_entsize == sizeof (Elf32_Word)) - { - /* Sane arches first. */ - Elf32_Word *bucket = (Elf32_Word *) hashd->d_buf; + /* The symbol table data. */ + Elf_Data *symd = elf_getdata (elf_getscn (newelf, + shdr_info[symtabidx].idx), + NULL); + assert (symd != NULL); - size_t strshndx = shdr_info[symtabidx].old_sh_link; - size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, - ehdr->e_version); + /* The hash table data. */ + Elf_Data *hashd = elf_getdata (scn, NULL); + assert (hashd != NULL); - /* Convert to the correct byte order. */ - if (gelf_xlatetom (newelf, hashd, hashd, - BYTE_ORDER == LITTLE_ENDIAN - ? ELFDATA2LSB : ELFDATA2MSB) == NULL) - INTERNAL_ERROR (fname); + if (shdr_info[cnt].shdr.sh_entsize == sizeof (Elf32_Word)) + { + /* Sane arches first. */ + Elf32_Word *bucket = (Elf32_Word *) hashd->d_buf; - /* Adjust the nchain value. The symbol table size - changed. We keep the same size for the bucket array. */ - bucket[1] = symd->d_size / elsize; - Elf32_Word nbucket = bucket[0]; - bucket += 2; - Elf32_Word *chain = bucket + nbucket; - - /* New size of the section. */ - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - shdr->sh_size = hashd->d_size - = (2 + symd->d_size / elsize + nbucket) - * sizeof (Elf32_Word); - (void) gelf_update_shdr (scn, shdr); - - /* Clear the arrays. */ - memset (bucket, '\0', - (symd->d_size / elsize + nbucket) - * sizeof (Elf32_Word)); - - for (size_t inner = shdr_info[symtabidx].shdr.sh_info; - inner < symd->d_size / elsize; ++inner) - { - GElf_Sym sym_mem; - GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); - assert (sym != NULL); + size_t strshndx = shdr_info[symtabidx].old_sh_link; + size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, + ehdr->e_version); - const char *name = elf_strptr (elf, strshndx, - sym->st_name); - assert (name != NULL); - size_t hidx = elf_hash (name) % nbucket; + /* Adjust the nchain value. The symbol table size + changed. We keep the same size for the bucket array. */ + bucket[1] = symd->d_size / elsize; + Elf32_Word nbucket = bucket[0]; + bucket += 2; + Elf32_Word *chain = bucket + nbucket; + + /* New size of the section. */ + hashd->d_size = ((2 + symd->d_size / elsize + nbucket) + * sizeof (Elf32_Word)); + update_section_size (hashd); + + /* Clear the arrays. */ + memset (bucket, '\0', + (symd->d_size / elsize + nbucket) + * sizeof (Elf32_Word)); + + for (size_t inner = shdr_info[symtabidx].shdr.sh_info; + inner < symd->d_size / elsize; ++inner) + { + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); + assert (sym != NULL); - if (bucket[hidx] == 0) - bucket[hidx] = inner; - else - { - hidx = bucket[hidx]; + const char *name = elf_strptr (elf, strshndx, + sym->st_name); + assert (name != NULL); + size_t hidx = elf_hash (name) % nbucket; - while (chain[hidx] != 0) - hidx = chain[hidx]; + if (bucket[hidx] == 0) + bucket[hidx] = inner; + else + { + hidx = bucket[hidx]; - chain[hidx] = inner; - } - } - } - else - { - /* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */ - assert (shdr_info[cnt].shdr.sh_entsize - == sizeof (Elf64_Xword)); + while (chain[hidx] != 0) + hidx = chain[hidx]; - Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf; + chain[hidx] = inner; + } + } + } + else + { + /* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */ + assert (shdr_info[cnt].shdr.sh_entsize + == sizeof (Elf64_Xword)); - size_t strshndx = shdr_info[symtabidx].old_sh_link; - size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, - ehdr->e_version); + Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf; - /* Convert to the correct byte order. */ - if (gelf_xlatetom (newelf, hashd, hashd, - BYTE_ORDER == LITTLE_ENDIAN - ? ELFDATA2LSB : ELFDATA2MSB) == NULL) - INTERNAL_ERROR (fname); + size_t strshndx = shdr_info[symtabidx].old_sh_link; + size_t elsize = gelf_fsize (elf, ELF_T_SYM, 1, + ehdr->e_version); - /* Adjust the nchain value. The symbol table size - changed. We keep the same size for the bucket array. */ - bucket[1] = symd->d_size / elsize; - Elf64_Xword nbucket = bucket[0]; - bucket += 2; - Elf64_Xword *chain = bucket + nbucket; - - /* New size of the section. */ - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - shdr->sh_size = hashd->d_size - = (2 + symd->d_size / elsize + nbucket) - * sizeof (Elf64_Xword); - (void) gelf_update_shdr (scn, shdr); - - /* Clear the arrays. */ - memset (bucket, '\0', - (symd->d_size / elsize + nbucket) - * sizeof (Elf64_Xword)); - - for (size_t inner = shdr_info[symtabidx].shdr.sh_info; - inner < symd->d_size / elsize; ++inner) - { - GElf_Sym sym_mem; - GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); - assert (sym != NULL); + /* Adjust the nchain value. The symbol table size + changed. We keep the same size for the bucket array. */ + bucket[1] = symd->d_size / elsize; + Elf64_Xword nbucket = bucket[0]; + bucket += 2; + Elf64_Xword *chain = bucket + nbucket; + + /* New size of the section. */ + hashd->d_size = ((2 + symd->d_size / elsize + nbucket) + * sizeof (Elf64_Xword)); + update_section_size (hashd); + + /* Clear the arrays. */ + memset (bucket, '\0', + (symd->d_size / elsize + nbucket) + * sizeof (Elf64_Xword)); + + for (size_t inner = shdr_info[symtabidx].shdr.sh_info; + inner < symd->d_size / elsize; ++inner) + { + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); + assert (sym != NULL); - const char *name = elf_strptr (elf, strshndx, - sym->st_name); - assert (name != NULL); - size_t hidx = elf_hash (name) % nbucket; + const char *name = elf_strptr (elf, strshndx, + sym->st_name); + assert (name != NULL); + size_t hidx = elf_hash (name) % nbucket; - if (bucket[hidx] == 0) - bucket[hidx] = inner; - else - { - hidx = bucket[hidx]; + if (bucket[hidx] == 0) + bucket[hidx] = inner; + else + { + hidx = bucket[hidx]; - while (chain[hidx] != 0) - hidx = chain[hidx]; + while (chain[hidx] != 0) + hidx = chain[hidx]; - chain[hidx] = inner; - } - } - } + chain[hidx] = inner; + } + } + } + break; - /* Convert back to the file byte order. */ - if (gelf_xlatetof (newelf, hashd, hashd, - BYTE_ORDER == LITTLE_ENDIAN - ? ELFDATA2LSB : ELFDATA2MSB) == NULL) - INTERNAL_ERROR (fname); - } - else if (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym) - { - /* If the symbol table changed we have to adjust the - entries. */ - Elf32_Word symtabidx = shdr_info[cnt].old_sh_link; + case SHT_GNU_versym: + /* If the symbol table changed we have to adjust the entries. */ + if (no_symtab_updates ()) + break; - /* We do not have to do anything if the symbol table was - not changed. */ - if (shdr_info[symtabidx].newsymidx == NULL) - continue; + assert (shdr_info[cnt].idx > 0); + + /* The symbol version section in the new file. */ + scn = elf_getscn (newelf, shdr_info[cnt].idx); + + /* The symbol table data. */ + symd = elf_getdata (elf_getscn (newelf, shdr_info[symtabidx].idx), + NULL); + assert (symd != NULL); + + /* The version symbol data. */ + Elf_Data *verd = elf_getdata (scn, NULL); + assert (verd != NULL); + + /* The symbol version array. */ + GElf_Half *verstab = (GElf_Half *) verd->d_buf; + + /* Walk through the list and */ + size_t elsize = gelf_fsize (elf, verd->d_type, 1, + ehdr->e_version); + for (size_t inner = 1; inner < verd->d_size / elsize; ++inner) + if (newsymidx[inner] != 0) + /* Overwriting the same array works since the + reordering can only move entries to lower indices + in the array. */ + verstab[newsymidx[inner]] = verstab[inner]; + + /* New size of the section. */ + verd->d_size = gelf_fsize (newelf, verd->d_type, + symd->d_size + / gelf_fsize (elf, symd->d_type, 1, + ehdr->e_version), + ehdr->e_version); + update_section_size (verd); + break; + + case SHT_GROUP: + if (no_symtab_updates ()) + break; - /* The symbol version section in the new file. */ - scn = elf_getscn (newelf, shdr_info[cnt].idx); + /* Yes, the symbol table changed. + Update the section header of the section group. */ + scn = elf_getscn (newelf, shdr_info[cnt].idx); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + assert (shdr != NULL); - /* The symbol table data. */ - Elf_Data *symd = elf_getdata (elf_getscn (newelf, - shdr_info[symtabidx].idx), - NULL); - assert (symd != NULL); + shdr->sh_info = newsymidx[shdr->sh_info]; - /* The version symbol data. */ - Elf_Data *verd = elf_getdata (scn, NULL); - assert (verd != NULL); + (void) gelf_update_shdr (scn, shdr); + break; + } + } - /* Convert to the correct byte order. */ - if (gelf_xlatetom (newelf, verd, verd, - BYTE_ORDER == LITTLE_ENDIAN - ? ELFDATA2LSB : ELFDATA2MSB) == NULL) - INTERNAL_ERROR (fname); + /* Now that we have done all adjustments to the data, + we can actually write out the debug file. */ + if (debug_fname != NULL) + { + uint32_t debug_crc; + Elf_Data debug_crc_data = + { + .d_type = ELF_T_WORD, + .d_buf = &debug_crc, + .d_size = sizeof (debug_crc), + .d_version = EV_CURRENT + }; - /* The symbol version array. */ - GElf_Half *verstab = (GElf_Half *) verd->d_buf; - - /* New indices of the symbols. */ - Elf32_Word *newsymidx = shdr_info[symtabidx].newsymidx; - - /* Walk through the list and */ - size_t elsize = gelf_fsize (elf, verd->d_type, 1, - ehdr->e_version); - for (size_t inner = 1; inner < verd->d_size / elsize; ++inner) - if (newsymidx[inner] != 0) - /* Overwriting the same array works since the - reordering can only move entries to lower indices - in the array. */ - verstab[newsymidx[inner]] = verstab[inner]; - - /* New size of the section. */ - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - shdr->sh_size = verd->d_size - = gelf_fsize (newelf, verd->d_type, - symd->d_size / gelf_fsize (elf, symd->d_type, 1, - ehdr->e_version), - ehdr->e_version); - (void) gelf_update_shdr (scn, shdr); - - /* Convert back to the file byte order. */ - if (gelf_xlatetof (newelf, verd, verd, - BYTE_ORDER == LITTLE_ENDIAN - ? ELFDATA2LSB : ELFDATA2MSB) == NULL) - INTERNAL_ERROR (fname); - } - else if (shdr_info[cnt].shdr.sh_type == SHT_GROUP) - { - /* Check whether the associated symbol table changed. */ - if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx != NULL) - { - /* Yes the symbol table changed. Update the section - header of the section group. */ - scn = elf_getscn (newelf, shdr_info[cnt].idx); - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - assert (shdr != NULL); + /* Finally write the file. */ + if (unlikely (elf_update (debugelf, ELF_C_WRITE) == -1)) + { + error (0, 0, gettext ("while writing '%s': %s"), + debug_fname, elf_errmsg (-1)); + result = 1; + goto fail_close; + } - size_t stabidx = shdr_info[cnt].old_sh_link; - shdr->sh_info = shdr_info[stabidx].newsymidx[shdr->sh_info]; + /* Create the real output file. First rename, then change the + mode. */ + if (rename (tmp_debug_fname, debug_fname) != 0 + || fchmod (debug_fd, mode) != 0) + { + error (0, errno, gettext ("while creating '%s'"), debug_fname); + result = 1; + goto fail_close; + } - (void) gelf_update_shdr (scn, shdr); - } - } + /* The temporary file does not exist anymore. */ + tmp_debug_fname = NULL; + + /* Compute the checksum which we will add to the executable. */ + if (crc32_file (debug_fd, &debug_crc) != 0) + { + error (0, errno, + gettext ("while computing checksum for debug information")); + unlink (debug_fname); + result = 1; + goto fail_close; } + + /* Store it in the debuglink section data. */ + if (unlikely (gelf_xlatetof (newelf, &debuglink_crc_data, + &debug_crc_data, ehdr->e_ident[EI_DATA]) + != &debuglink_crc_data)) + INTERNAL_ERROR (fname); } /* Finally finish the ELF header. Fill in the fields not handled by @@ -1641,7 +1685,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* Finally write the file. */ if (elf_update (newelf, ELF_C_WRITE) == -1) { - error (0, 0, gettext ("while writing `%s': %s"), + error (0, 0, gettext ("while writing '%s': %s"), fname, elf_errmsg (-1)); result = 1; } @@ -1653,7 +1697,11 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, table indices. */ if (any_symtab_changes) for (cnt = 1; cnt <= shdridx; ++cnt) - free (shdr_info[cnt].newsymidx); + { + free (shdr_info[cnt].newsymidx); + if (shdr_info[cnt].debug_data != NULL) + free (shdr_info[cnt].debug_data->d_buf); + } /* Free the memory. */ if ((shnum + 2) * sizeof (struct shdr_info) > MAX_STACK_ALLOC) @@ -1669,14 +1717,14 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* That was it. Close the descriptors. */ if (elf_end (newelf) != 0) { - error (0, 0, gettext ("error while finishing `%s': %s"), fname, + error (0, 0, gettext ("error while finishing '%s': %s"), fname, elf_errmsg (-1)); result = 1; } if (debugelf != NULL && elf_end (debugelf) != 0) { - error (0, 0, gettext ("error while finishing `%s': %s"), debug_fname, + error (0, 0, gettext ("error while finishing '%s': %s"), debug_fname, elf_errmsg (-1)); result = 1; } @@ -1700,7 +1748,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, if (futimes (fd, tvp) != 0) { error (0, errno, gettext ("\ -cannot set access and modification date of \"%s\""), +cannot set access and modification date of '%s'"), output_fname ?: fname); result = 1; } @@ -1757,13 +1805,16 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, if (unlikely (futimes (fd, tvp) != 0)) { error (0, errno, gettext ("\ -cannot set access and modification date of \"%s\""), fname); +cannot set access and modification date of '%s'"), fname); result = 1; } } if (unlikely (close (fd) != 0)) - error (EXIT_FAILURE, errno, gettext ("while closing `%s'"), fname); + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); return result; } + + +#include "debugpred.h" diff --git a/src/symbolhash.c b/src/symbolhash.c index da2ae6f6..670cf056 100644 --- a/src/symbolhash.c +++ b/src/symbolhash.c @@ -1,16 +1,28 @@ /* Symbol hash table implementation. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/symbolhash.h b/src/symbolhash.h index a8798c2a..54b95397 100644 --- a/src/symbolhash.h +++ b/src/symbolhash.h @@ -1,15 +1,27 @@ /* Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef SYMBOLHASH_H #define SYMBOLHASH_H 1 diff --git a/src/unaligned.h b/src/unaligned.h index 524b35c8..ad7c55a5 100644 --- a/src/unaligned.h +++ b/src/unaligned.h @@ -1,16 +1,28 @@ /* Unaligned memory access functionality. - Copyright (C) 2000, 2001, 2002, 2003 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef _UNALIGNED_H #define _UNALIGNED_H 1 @@ -77,19 +89,19 @@ union u_8ubyte_unaligned #else # define add_2ubyte_unaligned(ptr, value) \ do { \ - union u_2ubyte_unaligned *_ptr = (ptr); \ + union u_2ubyte_unaligned *_ptr = (void *) (ptr); \ uint16_t _val = bswap_16 (_ptr->u) + (value); \ _ptr->u = bswap_16 (_val); \ } while (0) # define add_4ubyte_unaligned(ptr, value) \ do { \ - union u_4ubyte_unaligned *_ptr = (ptr); \ + union u_4ubyte_unaligned *_ptr = (void *) (ptr); \ uint32_t _val = bswap_32 (_ptr->u) + (value); \ _ptr->u = bswap_32 (_val); \ } while (0) # define add_8ubyte_unaligned(ptr, value) \ do { \ - union u_8ubyte_unaligned *_ptr = (ptr); \ + union u_8ubyte_unaligned *_ptr = (void *) (ptr); \ uint64_t _val = bswap_64 (_ptr->u) + (value); \ _ptr->u = bswap_64 (_val); \ } while (0) diff --git a/src/unstrip.c b/src/unstrip.c new file mode 100644 index 00000000..676a0c7f --- /dev/null +++ b/src/unstrip.c @@ -0,0 +1,2317 @@ +/* Combine stripped files with separate symbols and debug information. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Roland McGrath <roland@redhat.com>, 2007. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +/* TODO: + + * SHX_XINDEX + + * prelink vs .debug_* linked addresses + + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <argp.h> +#include <assert.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <fnmatch.h> +#include <libintl.h> +#include <locale.h> +#include <mcheck.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <inttypes.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <gelf.h> +#include <libebl.h> +#include <libdwfl.h> +#include "system.h" + +#ifndef _ +# define _(str) gettext (str) +#endif + +/* Name and version of program. */ +static void print_version (FILE *stream, struct argp_state *state); +void (*argp_program_version_hook) (FILE *, struct argp_state *) + = print_version; + +/* Bug report address. */ +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +/* Definitions of arguments for argp functions. */ +static const struct argp_option options[] = +{ + /* Group 2 will follow group 1 from dwfl_standard_argp. */ + { "match-file-names", 'f', NULL, 0, + N_("Match MODULE against file names, not module names"), 2 }, + { "ignore-missing", 'i', NULL, 0, N_("Silently skip unfindable files"), 0 }, + + { NULL, 0, NULL, 0, N_("Output options:"), 0 }, + { "output", 'o', "FILE", 0, N_("Place output into FILE"), 0 }, + { "output-directory", 'd', "DIRECTORY", + 0, N_("Create multiple output files under DIRECTORY"), 0 }, + { "module-names", 'm', NULL, 0, N_("Use module rather than file names"), 0 }, + { "all", 'a', NULL, 0, + N_("Create output for modules that have no separate debug information"), + 0 }, + { "relocate", 'R', NULL, 0, + N_("Apply relocations to section contents in ET_REL files"), 0 }, + { "list-only", 'n', NULL, 0, + N_("Only list module and file names, build IDs"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } +}; + +struct arg_info +{ + const char *output_file; + const char *output_dir; + Dwfl *dwfl; + char **args; + bool list; + bool all; + bool ignore; + bool modnames; + bool match_files; + bool relocate; +}; + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + struct arg_info *info = state->input; + + switch (key) + { + case ARGP_KEY_INIT: + state->child_inputs[0] = &info->dwfl; + break; + + case 'o': + if (info->output_file != NULL) + { + argp_error (state, _("-o option specified twice")); + return EINVAL; + } + info->output_file = arg; + break; + + case 'd': + if (info->output_dir != NULL) + { + argp_error (state, _("-d option specified twice")); + return EINVAL; + } + info->output_dir = arg; + break; + + case 'm': + info->modnames = true; + break; + case 'f': + info->match_files = true; + break; + case 'a': + info->all = true; + break; + case 'i': + info->ignore = true; + break; + case 'n': + info->list = true; + break; + case 'R': + info->relocate = true; + break; + + case ARGP_KEY_ARGS: + case ARGP_KEY_NO_ARGS: + /* We "consume" all the arguments here. */ + info->args = &state->argv[state->next]; + + if (info->output_file != NULL && info->output_dir != NULL) + { + argp_error (state, _("only one of -o or -d allowed")); + return EINVAL; + } + + if (info->list && (info->dwfl == NULL + || info->output_dir != NULL + || info->output_file != NULL)) + { + argp_error (state, + _("-n cannot be used with explicit files or -o or -d")); + return EINVAL; + } + + if (info->output_dir != NULL) + { + struct stat64 st; + error_t fail = 0; + if (stat64 (info->output_dir, &st) < 0) + fail = errno; + else if (!S_ISDIR (st.st_mode)) + fail = ENOTDIR; + if (fail) + { + argp_failure (state, EXIT_FAILURE, fail, + _("output directory '%s'"), info->output_dir); + return fail; + } + } + + if (info->dwfl == NULL) + { + if (state->next + 2 != state->argc) + { + argp_error (state, _("exactly two file arguments are required")); + return EINVAL; + } + + if (info->ignore || info->all || info->modnames || info->relocate) + { + argp_error (state, _("\ +-m, -a, -R, and -i options not allowed with explicit files")); + return EINVAL; + } + + /* Bail out immediately to prevent dwfl_standard_argp's parser + from defaulting to "-e a.out". */ + return ENOSYS; + } + else if (info->output_file == NULL && info->output_dir == NULL + && !info->list) + { + argp_error (state, + _("-o or -d is required when using implicit files")); + return EINVAL; + } + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +/* Print the version information. */ +static void +print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) +{ + fprintf (stream, "unstrip (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf (stream, _("\ +Copyright (C) %s Red Hat, Inc.\n\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ +"), "2008"); + fprintf (stream, gettext ("Written by %s.\n"), "Roland McGrath"); +} + +#define ELF_CHECK(call, msg) \ + do \ + { \ + if (!(call)) \ + error (EXIT_FAILURE, 0, msg, elf_errmsg (-1)); \ + } while (0) + +/* Copy INELF to newly-created OUTELF, exit via error for any problems. */ +static void +copy_elf (Elf *outelf, Elf *inelf) +{ + ELF_CHECK (gelf_newehdr (outelf, gelf_getclass (inelf)), + _("cannot create ELF header: %s")); + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (inelf, &ehdr_mem); + ELF_CHECK (gelf_update_ehdr (outelf, ehdr), + _("cannot copy ELF header: %s")); + + if (ehdr->e_phnum > 0) + { + ELF_CHECK (gelf_newphdr (outelf, ehdr->e_phnum), + _("cannot create program headers: %s")); + + GElf_Phdr phdr_mem; + for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + ELF_CHECK (gelf_update_phdr (outelf, i, + gelf_getphdr (inelf, i, &phdr_mem)), + _("cannot copy program header: %s")); + } + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (inelf, scn)) != NULL) + { + Elf_Scn *newscn = elf_newscn (outelf); + + GElf_Shdr shdr_mem; + ELF_CHECK (gelf_update_shdr (newscn, gelf_getshdr (scn, &shdr_mem)), + _("cannot copy section header: %s")); + + Elf_Data *data = elf_getdata (scn, NULL); + ELF_CHECK (data != NULL, _("cannot get section data: %s")); + Elf_Data *newdata = elf_newdata (newscn); + ELF_CHECK (newdata != NULL, _("cannot copy section data: %s")); + *newdata = *data; + elf_flagdata (newdata, ELF_C_SET, ELF_F_DIRTY); + } +} + +/* Create directories containing PATH. */ +static void +make_directories (const char *path) +{ + const char *lastslash = strrchr (path, '/'); + if (lastslash == NULL) + return; + + while (lastslash > path && lastslash[-1] == '/') + --lastslash; + if (lastslash == path) + return; + + char *dir = strndupa (path, lastslash - path); + while (mkdir (dir, 0777) < 0 && errno != EEXIST) + if (errno == ENOENT) + make_directories (dir); + else + error (EXIT_FAILURE, errno, _("cannot create directory '%s'"), dir); +} + + +/* The binutils linker leaves gratuitous section symbols in .symtab + that strip has to remove. Older linkers likewise include a + symbol for every section, even unallocated ones, in .dynsym. + Because of this, the related sections can shrink in the stripped + file from their original size. Older versions of strip do not + adjust the sh_size field in the debuginfo file's SHT_NOBITS + version of the section header, so it can appear larger. */ +static bool +section_can_shrink (const GElf_Shdr *shdr) +{ + switch (shdr->sh_type) + { + case SHT_SYMTAB: + case SHT_DYNSYM: + case SHT_HASH: + case SHT_GNU_versym: + return true; + } + return false; +} + +/* See if this symbol table has a leading section symbol for every single + section, in order. The binutils linker produces this. While we're here, + update each section symbol's st_value. */ +static size_t +symtab_count_leading_section_symbols (Elf *elf, Elf_Scn *scn, size_t shnum, + Elf_Data *newsymdata) +{ + Elf_Data *data = elf_getdata (scn, NULL); + Elf_Data *shndxdata = NULL; /* XXX */ + + for (size_t i = 1; i < shnum; ++i) + { + GElf_Sym sym_mem; + GElf_Word shndx = SHN_UNDEF; + GElf_Sym *sym = gelf_getsymshndx (data, shndxdata, i, &sym_mem, &shndx); + ELF_CHECK (sym != NULL, _("cannot get symbol table entry: %s")); + + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (elf, i), &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + if (sym->st_shndx != SHN_XINDEX) + shndx = sym->st_shndx; + + if (shndx != i || GELF_ST_TYPE (sym->st_info) != STT_SECTION) + return i; + + sym->st_value = shdr->sh_addr; + if (sym->st_shndx != SHN_XINDEX) + shndx = SHN_UNDEF; + ELF_CHECK (gelf_update_symshndx (newsymdata, shndxdata, i, sym, shndx), + _("cannot update symbol table: %s")); + } + + return shnum; +} + +/* We expanded the output section, so update its header. */ +static void +update_sh_size (Elf_Scn *outscn, const Elf_Data *data) +{ + GElf_Shdr shdr_mem; + GElf_Shdr *newshdr = gelf_getshdr (outscn, &shdr_mem); + ELF_CHECK (newshdr != NULL, _("cannot get section header: %s")); + + newshdr->sh_size = data->d_size; + + ELF_CHECK (gelf_update_shdr (outscn, newshdr), + _("cannot update section header: %s")); +} + +/* Update relocation sections using the symbol table. */ +static void +adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr, + size_t map[], const GElf_Shdr *symshdr) +{ + Elf_Data *data = elf_getdata (outscn, NULL); + + inline void adjust_reloc (GElf_Xword *info) + { + size_t ndx = GELF_R_SYM (*info); + if (ndx != STN_UNDEF) + *info = GELF_R_INFO (map[ndx - 1], GELF_R_TYPE (*info)); + } + + switch (shdr->sh_type) + { + case SHT_REL: + for (size_t i = 0; i < shdr->sh_size / shdr->sh_entsize; ++i) + { + GElf_Rel rel_mem; + GElf_Rel *rel = gelf_getrel (data, i, &rel_mem); + adjust_reloc (&rel->r_info); + ELF_CHECK (gelf_update_rel (data, i, rel), + _("cannot update relocation: %s")); + } + break; + + case SHT_RELA: + for (size_t i = 0; i < shdr->sh_size / shdr->sh_entsize; ++i) + { + GElf_Rela rela_mem; + GElf_Rela *rela = gelf_getrela (data, i, &rela_mem); + adjust_reloc (&rela->r_info); + ELF_CHECK (gelf_update_rela (data, i, rela), + _("cannot update relocation: %s")); + } + break; + + case SHT_GROUP: + { + GElf_Shdr shdr_mem; + GElf_Shdr *newshdr = gelf_getshdr (outscn, &shdr_mem); + ELF_CHECK (newshdr != NULL, _("cannot get section header: %s")); + if (newshdr->sh_info != STN_UNDEF) + { + newshdr->sh_info = map[newshdr->sh_info - 1]; + ELF_CHECK (gelf_update_shdr (outscn, newshdr), + _("cannot update section header: %s")); + } + break; + } + + case SHT_HASH: + /* We must expand the table and rejigger its contents. */ + { + const size_t nsym = symshdr->sh_size / symshdr->sh_entsize; + const size_t onent = shdr->sh_size / shdr->sh_entsize; + assert (data->d_size == shdr->sh_size); + +#define CONVERT_HASH(Hash_Word) \ + { \ + const Hash_Word *const old_hash = data->d_buf; \ + const size_t nbucket = old_hash[0]; \ + const size_t nchain = old_hash[1]; \ + const Hash_Word *const old_bucket = &old_hash[2]; \ + const Hash_Word *const old_chain = &old_bucket[nbucket]; \ + assert (onent == 2 + nbucket + nchain); \ + \ + const size_t nent = 2 + nbucket + nsym; \ + Hash_Word *const new_hash = xcalloc (nent, sizeof new_hash[0]); \ + Hash_Word *const new_bucket = &new_hash[2]; \ + Hash_Word *const new_chain = &new_bucket[nbucket]; \ + \ + new_hash[0] = nbucket; \ + new_hash[1] = nsym; \ + for (size_t i = 0; i < nbucket; ++i) \ + if (old_bucket[i] != STN_UNDEF) \ + new_bucket[i] = map[old_bucket[i] - 1]; \ + \ + for (size_t i = 1; i < nchain; ++i) \ + if (old_chain[i] != STN_UNDEF) \ + new_chain[map[i - 1]] = map[old_chain[i] - 1]; \ + \ + data->d_buf = new_hash; \ + data->d_size = nent * sizeof new_hash[0]; \ + } + + switch (shdr->sh_entsize) + { + case 4: + CONVERT_HASH (Elf32_Word); + break; + case 8: + CONVERT_HASH (Elf64_Xword); + break; + default: + abort (); + } + + elf_flagdata (data, ELF_C_SET, ELF_F_DIRTY); + update_sh_size (outscn, data); + +#undef CONVERT_HASH + } + break; + + case SHT_GNU_versym: + /* We must expand the table and move its elements around. */ + { + const size_t nent = symshdr->sh_size / symshdr->sh_entsize; + const size_t onent = shdr->sh_size / shdr->sh_entsize; + assert (nent >= onent); + + /* We don't bother using gelf_update_versym because there is + really no conversion to be done. */ + assert (sizeof (Elf32_Versym) == sizeof (GElf_Versym)); + assert (sizeof (Elf64_Versym) == sizeof (GElf_Versym)); + GElf_Versym *versym = xcalloc (nent, sizeof versym[0]); + + for (size_t i = 1; i < onent; ++i) + { + GElf_Versym *v = gelf_getversym (data, i, &versym[map[i - 1]]); + ELF_CHECK (v != NULL, _("cannot get symbol version: %s")); + } + + data->d_buf = versym; + data->d_size = nent * shdr->sh_entsize; + elf_flagdata (data, ELF_C_SET, ELF_F_DIRTY); + update_sh_size (outscn, data); + } + break; + + default: + error (EXIT_FAILURE, 0, + _("unexpected section type in [%Zu] with sh_link to symtab"), + elf_ndxscn (inscn)); + } +} + +/* Adjust all the relocation sections in the file. */ +static void +adjust_all_relocs (Elf *elf, Elf_Scn *symtab, const GElf_Shdr *symshdr, + size_t map[]) +{ + size_t new_sh_link = elf_ndxscn (symtab); + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + if (scn != symtab) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + if (shdr->sh_type != SHT_NOBITS && shdr->sh_link == new_sh_link) + adjust_relocs (scn, scn, shdr, map, symshdr); + } +} + +/* The original file probably had section symbols for all of its + sections, even the unallocated ones. To match it as closely as + possible, add in section symbols for the added sections. */ +static Elf_Data * +add_new_section_symbols (Elf_Scn *old_symscn, size_t old_shnum, + Elf *elf, bool rel, Elf_Scn *symscn, size_t shnum) +{ + const size_t added = shnum - old_shnum; + + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (symscn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + const size_t nsym = shdr->sh_size / shdr->sh_entsize; + size_t symndx_map[nsym - 1]; + + shdr->sh_info += added; + shdr->sh_size += added * shdr->sh_entsize; + + ELF_CHECK (gelf_update_shdr (symscn, shdr), + _("cannot update section header: %s")); + + Elf_Data *symdata = elf_getdata (symscn, NULL); + Elf_Data *shndxdata = NULL; /* XXX */ + + symdata->d_size = shdr->sh_size; + symdata->d_buf = xmalloc (symdata->d_size); + + /* Copy the existing section symbols. */ + Elf_Data *old_symdata = elf_getdata (old_symscn, NULL); + for (size_t i = 0; i < old_shnum; ++i) + { + GElf_Sym sym_mem; + GElf_Word shndx = SHN_UNDEF; + GElf_Sym *sym = gelf_getsymshndx (old_symdata, shndxdata, + i, &sym_mem, &shndx); + ELF_CHECK (gelf_update_symshndx (symdata, shndxdata, i, + sym, shndx), + _("cannot update symbol table: %s")); + + if (i > 0) + symndx_map[i - 1] = i; + } + + /* Add in the new section symbols. */ + for (size_t i = old_shnum; i < shnum; ++i) + { + GElf_Shdr i_shdr_mem; + GElf_Shdr *i_shdr = gelf_getshdr (elf_getscn (elf, i), &i_shdr_mem); + ELF_CHECK (i_shdr != NULL, _("cannot get section header: %s")); + GElf_Sym sym = + { + .st_value = rel ? 0 : i_shdr->sh_addr, + .st_info = GELF_ST_INFO (STB_LOCAL, STT_SECTION), + .st_shndx = i < SHN_LORESERVE ? i : SHN_XINDEX + }; + GElf_Word shndx = i < SHN_LORESERVE ? SHN_UNDEF : i; + ELF_CHECK (gelf_update_symshndx (symdata, shndxdata, i, + &sym, shndx), + _("cannot update symbol table: %s")); + } + + /* Now copy the rest of the existing symbols. */ + for (size_t i = old_shnum; i < nsym; ++i) + { + GElf_Sym sym_mem; + GElf_Word shndx = SHN_UNDEF; + GElf_Sym *sym = gelf_getsymshndx (old_symdata, shndxdata, + i, &sym_mem, &shndx); + ELF_CHECK (gelf_update_symshndx (symdata, shndxdata, + i + added, sym, shndx), + _("cannot update symbol table: %s")); + + symndx_map[i - 1] = i + added; + } + + /* Adjust any relocations referring to the old symbol table. */ + adjust_all_relocs (elf, symscn, shdr, symndx_map); + + return symdata; +} + +/* This has the side effect of updating STT_SECTION symbols' values, + in case of prelink adjustments. */ +static Elf_Data * +check_symtab_section_symbols (Elf *elf, bool rel, Elf_Scn *scn, + size_t shnum, size_t shstrndx, + Elf_Scn *oscn, size_t oshnum, size_t oshstrndx, + size_t debuglink) +{ + size_t n = symtab_count_leading_section_symbols (elf, oscn, oshnum, + elf_getdata (scn, NULL)); + + if (n == oshnum) + return add_new_section_symbols (oscn, n, elf, rel, scn, shnum); + + if (n == oshstrndx || (n == debuglink && n == oshstrndx - 1)) + return add_new_section_symbols (oscn, n, elf, rel, scn, shstrndx); + + return NULL; +} + +struct section +{ + Elf_Scn *scn; + const char *name; + Elf_Scn *outscn; + struct Ebl_Strent *strent; + GElf_Shdr shdr; +}; + +static int +compare_alloc_sections (const struct section *s1, const struct section *s2, + bool rel) +{ + if (!rel) + { + /* Sort by address. */ + if (s1->shdr.sh_addr < s2->shdr.sh_addr) + return -1; + if (s1->shdr.sh_addr > s2->shdr.sh_addr) + return 1; + } + + /* At the same address, preserve original section order. */ + return (ssize_t) elf_ndxscn (s1->scn) - (ssize_t) elf_ndxscn (s2->scn); +} + +static int +compare_unalloc_sections (const GElf_Shdr *shdr1, const GElf_Shdr *shdr2, + const char *name1, const char *name2) +{ + /* Sort by sh_flags as an arbitrary ordering. */ + if (shdr1->sh_flags < shdr2->sh_flags) + return -1; + if (shdr1->sh_flags > shdr2->sh_flags) + return 1; + + /* Sort by name as last resort. */ + return strcmp (name1, name2); +} + +static int +compare_sections (const void *a, const void *b, bool rel) +{ + const struct section *s1 = a; + const struct section *s2 = b; + + /* Sort all non-allocated sections last. */ + if ((s1->shdr.sh_flags ^ s2->shdr.sh_flags) & SHF_ALLOC) + return (s1->shdr.sh_flags & SHF_ALLOC) ? -1 : 1; + + return ((s1->shdr.sh_flags & SHF_ALLOC) + ? compare_alloc_sections (s1, s2, rel) + : compare_unalloc_sections (&s1->shdr, &s2->shdr, + s1->name, s2->name)); +} + +static int +compare_sections_rel (const void *a, const void *b) +{ + return compare_sections (a, b, true); +} + +int +compare_sections_nonrel (const void *a, const void *b) +{ + return compare_sections (a, b, false); +} + + +struct symbol +{ + size_t *map; + + union + { + const char *name; + struct Ebl_Strent *strent; + }; + union + { + struct + { + GElf_Addr value; + GElf_Xword size; + GElf_Word shndx; + union + { + struct + { + uint8_t info; + uint8_t other; + } info; + int16_t compare; + }; + }; + + /* For a symbol discarded after first sort, this matches its better's + map pointer. */ + size_t *duplicate; + }; +}; + +/* Collect input symbols into our internal form. */ +static void +collect_symbols (Elf *outelf, bool rel, Elf_Scn *symscn, Elf_Scn *strscn, + const size_t nent, const GElf_Addr bias, + const size_t scnmap[], struct symbol *table, size_t *map, + struct section *split_bss) +{ + Elf_Data *symdata = elf_getdata (symscn, NULL); + Elf_Data *strdata = elf_getdata (strscn, NULL); + Elf_Data *shndxdata = NULL; /* XXX */ + + for (size_t i = 1; i < nent; ++i) + { + GElf_Sym sym_mem; + GElf_Word shndx = SHN_UNDEF; + GElf_Sym *sym = gelf_getsymshndx (symdata, shndxdata, i, + &sym_mem, &shndx); + ELF_CHECK (sym != NULL, _("cannot get symbol table entry: %s")); + if (sym->st_shndx != SHN_XINDEX) + shndx = sym->st_shndx; + + if (sym->st_name >= strdata->d_size) + error (EXIT_FAILURE, 0, + _("invalid string offset in symbol [%Zu]"), i); + + struct symbol *s = &table[i - 1]; + s->map = &map[i - 1]; + s->name = strdata->d_buf + sym->st_name; + s->value = sym->st_value + bias; + s->size = sym->st_size; + s->shndx = shndx; + s->info.info = sym->st_info; + s->info.other = sym->st_other; + + if (scnmap != NULL && shndx != SHN_UNDEF && shndx < SHN_LORESERVE) + s->shndx = scnmap[shndx - 1]; + + if (GELF_ST_TYPE (s->info.info) == STT_SECTION && !rel) + { + /* Update the value to match the output section. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (outelf, s->shndx), + &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + s->value = shdr->sh_addr; + } + else if (split_bss != NULL + && s->value < split_bss->shdr.sh_addr + && s->value >= split_bss[-1].shdr.sh_addr + && shndx == elf_ndxscn (split_bss->outscn)) + /* This symbol was in .bss and was split into .dynbss. */ + s->shndx = elf_ndxscn (split_bss[-1].outscn); + } +} + + +#define CMP(value) \ + if (s1->value < s2->value) \ + return -1; \ + if (s1->value > s2->value) \ + return 1 + +/* Compare symbols with a consistent ordering, + but one only meaningful for equality. */ +static int +compare_symbols (const void *a, const void *b) +{ + const struct symbol *s1 = a; + const struct symbol *s2 = b; + + CMP (value); + CMP (size); + CMP (shndx); + + return (s1->compare - s2->compare) ?: strcmp (s1->name, s2->name); +} + +/* Compare symbols for output order after slots have been assigned. */ +static int +compare_symbols_output (const void *a, const void *b) +{ + const struct symbol *s1 = a; + const struct symbol *s2 = b; + int cmp; + + /* Sort discarded symbols last. */ + cmp = (s1->name == NULL) - (s2->name == NULL); + + if (cmp == 0) + /* Local symbols must come first. */ + cmp = ((GELF_ST_BIND (s2->info.info) == STB_LOCAL) + - (GELF_ST_BIND (s1->info.info) == STB_LOCAL)); + + if (cmp == 0) + /* binutils always puts section symbols first. */ + cmp = ((GELF_ST_TYPE (s2->info.info) == STT_SECTION) + - (GELF_ST_TYPE (s1->info.info) == STT_SECTION)); + + if (cmp == 0) + { + if (GELF_ST_TYPE (s1->info.info) == STT_SECTION) + { + /* binutils always puts section symbols in section index order. */ + CMP (shndx); + else + assert (s1 == s2); + } + + /* Nothing really matters, so preserve the original order. */ + CMP (map); + else + assert (s1 == s2); + } + + return cmp; +} + +#undef CMP + +/* Return true iff the flags, size, and name match. */ +static bool +sections_match (const struct section *sections, size_t i, + const GElf_Shdr *shdr, const char *name) +{ + return (sections[i].shdr.sh_flags == shdr->sh_flags + && (sections[i].shdr.sh_size == shdr->sh_size + || (sections[i].shdr.sh_size < shdr->sh_size + && section_can_shrink (§ions[i].shdr))) + && !strcmp (sections[i].name, name)); +} + +/* Locate a matching allocated section in SECTIONS. */ +static struct section * +find_alloc_section (const GElf_Shdr *shdr, GElf_Addr bias, const char *name, + struct section sections[], size_t nalloc) +{ + const GElf_Addr addr = shdr->sh_addr + bias; + size_t l = 0, u = nalloc; + while (l < u) + { + size_t i = (l + u) / 2; + if (addr < sections[i].shdr.sh_addr) + u = i; + else if (addr > sections[i].shdr.sh_addr) + l = i + 1; + else + { + /* We've found allocated sections with this address. + Find one with matching size, flags, and name. */ + while (i > 0 && sections[i - 1].shdr.sh_addr == addr) + --i; + for (; i < nalloc && sections[i].shdr.sh_addr == addr; + ++i) + if (sections_match (sections, i, shdr, name)) + return §ions[i]; + break; + } + } + return NULL; +} + +static inline const char * +get_section_name (size_t ndx, const GElf_Shdr *shdr, const Elf_Data *shstrtab) +{ + if (shdr->sh_name >= shstrtab->d_size) + error (EXIT_FAILURE, 0, _("cannot read section [%Zu] name: %s"), + ndx, elf_errmsg (-1)); + return shstrtab->d_buf + shdr->sh_name; +} + +/* Fix things up when prelink has moved some allocated sections around + and the debuginfo file's section headers no longer match up. + This fills in SECTIONS[0..NALLOC-1].outscn or exits. + If there was a .bss section that was split into two sections + with the new one preceding it in sh_addr, we return that pointer. */ +static struct section * +find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, + Elf *main, const GElf_Ehdr *main_ehdr, + Elf_Data *main_shstrtab, GElf_Addr bias, + struct section *sections, + size_t nalloc, size_t nsections) +{ + /* Clear assignments that might have been bogus. */ + for (size_t i = 0; i < nalloc; ++i) + sections[i].outscn = NULL; + + Elf_Scn *undo = NULL; + for (size_t i = nalloc; i < nsections; ++i) + { + const struct section *sec = §ions[i]; + if (sec->shdr.sh_type == SHT_PROGBITS + && !(sec->shdr.sh_flags & SHF_ALLOC) + && !strcmp (sec->name, ".gnu.prelink_undo")) + { + undo = sec->scn; + break; + } + } + + /* Find the original allocated sections before prelinking. */ + struct section *undo_sections = NULL; + size_t undo_nalloc = 0; + if (undo != NULL) + { + Elf_Data *undodata = elf_rawdata (undo, NULL); + ELF_CHECK (undodata != NULL, + _("cannot read '.gnu.prelink_undo' section: %s")); + + union + { + Elf32_Ehdr e32; + Elf64_Ehdr e64; + } ehdr; + Elf_Data dst = + { + .d_buf = &ehdr, + .d_size = sizeof ehdr, + .d_type = ELF_T_EHDR, + .d_version = EV_CURRENT + }; + Elf_Data src = *undodata; + src.d_size = gelf_fsize (main, ELF_T_EHDR, 1, EV_CURRENT); + src.d_type = ELF_T_EHDR; + ELF_CHECK (gelf_xlatetom (main, &dst, &src, + main_ehdr->e_ident[EI_DATA]) != NULL, + _("cannot read '.gnu.prelink_undo' section: %s")); + + uint_fast16_t phnum; + uint_fast16_t shnum; + if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32) + { + phnum = ehdr.e32.e_phnum; + shnum = ehdr.e32.e_shnum; + } + else + { + phnum = ehdr.e64.e_phnum; + shnum = ehdr.e64.e_shnum; + } + + size_t phsize = gelf_fsize (main, ELF_T_PHDR, phnum, EV_CURRENT); + src.d_buf += src.d_size + phsize; + src.d_size = gelf_fsize (main, ELF_T_SHDR, shnum - 1, EV_CURRENT); + src.d_type = ELF_T_SHDR; + if ((size_t) (src.d_buf - undodata->d_buf) > undodata->d_size + || undodata->d_size - (src.d_buf - undodata->d_buf) != src.d_size) + error (EXIT_FAILURE, 0, _("invalid contents in '%s' section"), + ".gnu.prelink_undo"); + + union + { + Elf32_Shdr s32[shnum - 1]; + Elf64_Shdr s64[shnum - 1]; + } shdr; + dst.d_buf = &shdr; + dst.d_size = sizeof shdr; + ELF_CHECK (gelf_xlatetom (main, &dst, &src, + main_ehdr->e_ident[EI_DATA]) != NULL, + _("cannot read '.gnu.prelink_undo' section: %s")); + + undo_sections = xmalloc ((shnum - 1) * sizeof undo_sections[0]); + for (size_t i = 0; i < shnum - 1; ++i) + { + struct section *sec = &undo_sections[undo_nalloc]; + if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32) + { +#define COPY(field) sec->shdr.field = shdr.s32[i].field + COPY (sh_name); + COPY (sh_type); + COPY (sh_flags); + COPY (sh_addr); + COPY (sh_offset); + COPY (sh_size); + COPY (sh_link); + COPY (sh_info); + COPY (sh_addralign); + COPY (sh_entsize); +#undef COPY + } + else + sec->shdr = shdr.s64[i]; + if (sec->shdr.sh_flags & SHF_ALLOC) + { + sec->shdr.sh_addr += bias; + sec->name = get_section_name (i + 1, &sec->shdr, main_shstrtab); + sec->scn = elf_getscn (main, i + 1); /* Really just for ndx. */ + sec->outscn = NULL; + sec->strent = NULL; + ++undo_nalloc; + } + } + qsort (undo_sections, undo_nalloc, + sizeof undo_sections[0], compare_sections_nonrel); + } + + bool fail = false; + inline void check_match (bool match, Elf_Scn *scn, const char *name) + { + if (!match) + { + fail = true; + error (0, 0, _("cannot find matching section for [%Zu] '%s'"), + elf_ndxscn (scn), name); + } + } + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (debug, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + if (!(shdr->sh_flags & SHF_ALLOC)) + continue; + + const char *name = get_section_name (elf_ndxscn (scn), shdr, + debug_shstrtab); + + if (undo_sections != NULL) + { + struct section *sec = find_alloc_section (shdr, 0, name, + undo_sections, + undo_nalloc); + if (sec != NULL) + { + sec->outscn = scn; + continue; + } + } + + /* If there is no prelink info, we are just here to find + the sections to give error messages about. */ + for (size_t i = 0; shdr != NULL && i < nalloc; ++i) + if (sections[i].outscn == scn) + shdr = NULL; + check_match (shdr == NULL, scn, name); + } + + if (fail) + exit (EXIT_FAILURE); + + /* Now we have lined up output sections for each of the original sections + before prelinking. Translate those to the prelinked sections. + This matches what prelink's undo_sections does. */ + struct section *split_bss = NULL; + for (size_t i = 0; i < undo_nalloc; ++i) + { + const struct section *undo_sec = &undo_sections[i]; + + const char *name = undo_sec->name; + scn = undo_sec->scn; /* This is just for elf_ndxscn. */ + + for (size_t j = 0; j < nalloc; ++j) + { + struct section *sec = §ions[j]; +#define RELA_SCALED(field) \ + (2 * sec->shdr.field == 3 * undo_sec->shdr.field) + if (sec->outscn == NULL + && sec->shdr.sh_name == undo_sec->shdr.sh_name + && sec->shdr.sh_flags == undo_sec->shdr.sh_flags + && sec->shdr.sh_addralign == undo_sec->shdr.sh_addralign + && (((sec->shdr.sh_type == undo_sec->shdr.sh_type + && sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize + && (sec->shdr.sh_size == undo_sec->shdr.sh_size + || (sec->shdr.sh_size > undo_sec->shdr.sh_size + && main_ehdr->e_type == ET_EXEC + && !strcmp (sec->name, ".dynstr")))) + || (sec->shdr.sh_size == undo_sec->shdr.sh_size + && ((sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize + && undo_sec->shdr.sh_type == SHT_NOBITS) + || undo_sec->shdr.sh_type == SHT_PROGBITS) + && !strcmp (sec->name, ".plt"))) + || (sec->shdr.sh_type == SHT_RELA + && undo_sec->shdr.sh_type == SHT_REL + && RELA_SCALED (sh_entsize) && RELA_SCALED (sh_size)) + || (sec->shdr.sh_entsize == undo_sec->shdr.sh_entsize + && (sec->shdr.sh_type == undo_sec->shdr.sh_type + || (sec->shdr.sh_type == SHT_PROGBITS + && undo_sec->shdr.sh_type == SHT_NOBITS)) + && sec->shdr.sh_size < undo_sec->shdr.sh_size + && (!strcmp (sec->name, ".bss") + || !strcmp (sec->name, ".sbss")) + && (split_bss = sec) > sections))) + { + sec->outscn = undo_sec->outscn; + undo_sec = NULL; + break; + } + } + + check_match (undo_sec == NULL, scn, name); + } + + free (undo_sections); + + if (fail) + exit (EXIT_FAILURE); + + return split_bss; +} + +/* Create new .shstrtab contents, subroutine of copy_elided_sections. + This can't be open coded there and still use variable-length auto arrays, + since the end of our block would free other VLAs too. */ +static Elf_Data * +new_shstrtab (Elf *unstripped, size_t unstripped_shnum, + Elf_Data *shstrtab, size_t unstripped_shstrndx, + struct section *sections, size_t stripped_shnum, + struct Ebl_Strtab *strtab) +{ + if (strtab == NULL) + return NULL; + + struct Ebl_Strent *unstripped_strent[unstripped_shnum - 1]; + memset (unstripped_strent, 0, sizeof unstripped_strent); + for (struct section *sec = sections; + sec < §ions[stripped_shnum - 1]; + ++sec) + if (sec->outscn != NULL) + { + if (sec->strent == NULL) + { + sec->strent = ebl_strtabadd (strtab, sec->name, 0); + ELF_CHECK (sec->strent != NULL, + _("cannot add section name to string table: %s")); + } + unstripped_strent[elf_ndxscn (sec->outscn) - 1] = sec->strent; + } + + /* Add names of sections we aren't touching. */ + for (size_t i = 0; i < unstripped_shnum - 1; ++i) + if (unstripped_strent[i] == NULL) + { + Elf_Scn *scn = elf_getscn (unstripped, i + 1); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + const char *name = get_section_name (i + 1, shdr, shstrtab); + unstripped_strent[i] = ebl_strtabadd (strtab, name, 0); + ELF_CHECK (unstripped_strent[i] != NULL, + _("cannot add section name to string table: %s")); + } + else + unstripped_strent[i] = NULL; + + /* Now finalize the string table so we can get offsets. */ + Elf_Data *strtab_data = elf_getdata (elf_getscn (unstripped, + unstripped_shstrndx), NULL); + ELF_CHECK (elf_flagdata (strtab_data, ELF_C_SET, ELF_F_DIRTY), + _("cannot update section header string table data: %s")); + ebl_strtabfinalize (strtab, strtab_data); + + /* Update the sh_name fields of sections we aren't modifying later. */ + for (size_t i = 0; i < unstripped_shnum - 1; ++i) + if (unstripped_strent[i] != NULL) + { + Elf_Scn *scn = elf_getscn (unstripped, i + 1); + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + shdr->sh_name = ebl_strtaboffset (unstripped_strent[i]); + if (i + 1 == unstripped_shstrndx) + shdr->sh_size = strtab_data->d_size; + ELF_CHECK (gelf_update_shdr (scn, shdr), + _("cannot update section header: %s")); + } + + return strtab_data; +} + +/* Fill in any SHT_NOBITS sections in UNSTRIPPED by + copying their contents and sh_type from STRIPPED. */ +static void +copy_elided_sections (Elf *unstripped, Elf *stripped, + const GElf_Ehdr *stripped_ehdr, GElf_Addr bias) +{ + size_t unstripped_shstrndx; + ELF_CHECK (elf_getshstrndx (unstripped, &unstripped_shstrndx) == 0, + _("cannot get section header string table section index: %s")); + + size_t stripped_shstrndx; + ELF_CHECK (elf_getshstrndx (stripped, &stripped_shstrndx) == 0, + _("cannot get section header string table section index: %s")); + + size_t unstripped_shnum; + ELF_CHECK (elf_getshnum (unstripped, &unstripped_shnum) == 0, + _("cannot get section count: %s")); + + size_t stripped_shnum; + ELF_CHECK (elf_getshnum (stripped, &stripped_shnum) == 0, + _("cannot get section count: %s")); + + /* Cache the stripped file's section details. */ + struct section sections[stripped_shnum - 1]; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (stripped, scn)) != NULL) + { + size_t i = elf_ndxscn (scn) - 1; + GElf_Shdr *shdr = gelf_getshdr (scn, §ions[i].shdr); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + sections[i].name = elf_strptr (stripped, stripped_shstrndx, + shdr->sh_name); + if (sections[i].name == NULL) + error (EXIT_FAILURE, 0, _("cannot read section [%Zu] name: %s"), + elf_ndxscn (scn), elf_errmsg (-1)); + sections[i].scn = scn; + sections[i].outscn = NULL; + sections[i].strent = NULL; + } + + const struct section *stripped_symtab = NULL; + + /* Sort the sections, allocated by address and others after. */ + qsort (sections, stripped_shnum - 1, sizeof sections[0], + stripped_ehdr->e_type == ET_REL + ? compare_sections_rel : compare_sections_nonrel); + size_t nalloc = stripped_shnum - 1; + while (nalloc > 0 && !(sections[nalloc - 1].shdr.sh_flags & SHF_ALLOC)) + { + --nalloc; + if (sections[nalloc].shdr.sh_type == SHT_SYMTAB) + stripped_symtab = §ions[nalloc]; + } + + /* Locate a matching unallocated section in SECTIONS. */ + inline struct section *find_unalloc_section (const GElf_Shdr *shdr, + const char *name) + { + size_t l = nalloc, u = stripped_shnum - 1; + while (l < u) + { + size_t i = (l + u) / 2; + struct section *sec = §ions[i]; + int cmp = compare_unalloc_sections (shdr, &sec->shdr, + name, sec->name); + if (cmp < 0) + u = i; + else if (cmp > 0) + l = i + 1; + else + return sec; + } + return NULL; + } + + Elf_Data *shstrtab = elf_getdata (elf_getscn (unstripped, + unstripped_shstrndx), NULL); + ELF_CHECK (shstrtab != NULL, + _("cannot read section header string table: %s")); + + /* Match each debuginfo section with its corresponding stripped section. */ + bool check_prelink = false; + Elf_Scn *unstripped_symtab = NULL; + size_t unstripped_strtab_ndx = SHN_UNDEF; + size_t alloc_avail = 0; + scn = NULL; + while ((scn = elf_nextscn (unstripped, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + if (shdr->sh_type == SHT_SYMTAB) + { + unstripped_symtab = scn; + unstripped_strtab_ndx = shdr->sh_link; + continue; + } + + const size_t ndx = elf_ndxscn (scn); + if (ndx == unstripped_shstrndx) + continue; + + const char *name = get_section_name (ndx, shdr, shstrtab); + + struct section *sec = NULL; + if (shdr->sh_flags & SHF_ALLOC) + { + if (stripped_ehdr->e_type != ET_REL) + { + /* Look for the section that matches. */ + sec = find_alloc_section (shdr, bias, name, sections, nalloc); + if (sec == NULL) + { + /* We couldn't figure it out. It may be a prelink issue. */ + check_prelink = true; + continue; + } + } + else + { + /* The sh_addr of allocated sections does not help us, + but the order usually matches. */ + if (likely (sections_match (sections, alloc_avail, shdr, name))) + sec = §ions[alloc_avail++]; + else + for (size_t i = alloc_avail + 1; i < nalloc; ++i) + if (sections_match (sections, i, shdr, name)) + { + sec = §ions[i]; + break; + } + } + } + else + { + /* Look for the section that matches. */ + sec = find_unalloc_section (shdr, name); + if (sec == NULL) + { + /* An additional unallocated section is fine if not SHT_NOBITS. + We looked it up anyway in case it's an unallocated section + copied in both files (e.g. SHT_NOTE), and don't keep both. */ + if (shdr->sh_type != SHT_NOBITS) + continue; + + /* Somehow some old .debug files wound up with SHT_NOBITS + .comment sections, so let those pass. */ + if (!strcmp (name, ".comment")) + continue; + } + } + + if (sec == NULL) + error (EXIT_FAILURE, 0, + _("cannot find matching section for [%Zu] '%s'"), + elf_ndxscn (scn), name); + + sec->outscn = scn; + } + + /* If that failed due to changes made by prelink, we take another tack. + We keep track of a .bss section that was partly split into .dynbss + so that collect_symbols can update symbols' st_shndx fields. */ + struct section *split_bss = NULL; + if (check_prelink) + { + Elf_Data *data = elf_getdata (elf_getscn (stripped, stripped_shstrndx), + NULL); + ELF_CHECK (data != NULL, + _("cannot read section header string table: %s")); + split_bss = find_alloc_sections_prelink (unstripped, shstrtab, + stripped, stripped_ehdr, + data, bias, sections, + nalloc, stripped_shnum - 1); + } + + /* Make sure each main file section has a place to go. */ + const struct section *stripped_dynsym = NULL; + size_t debuglink = SHN_UNDEF; + size_t ndx_section[stripped_shnum - 1]; + struct Ebl_Strtab *strtab = NULL; + for (struct section *sec = sections; + sec < §ions[stripped_shnum - 1]; + ++sec) + { + size_t secndx = elf_ndxscn (sec->scn); + + if (sec->outscn == NULL) + { + /* We didn't find any corresponding section for this. */ + + if (secndx == stripped_shstrndx) + { + /* We only need one .shstrtab. */ + ndx_section[secndx - 1] = unstripped_shstrndx; + continue; + } + + if (unstripped_symtab != NULL && sec == stripped_symtab) + { + /* We don't need a second symbol table. */ + ndx_section[secndx - 1] = elf_ndxscn (unstripped_symtab); + continue; + } + + if (unstripped_symtab != NULL && stripped_symtab != NULL + && secndx == stripped_symtab->shdr.sh_link) + { + /* ... nor its string table. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (unstripped_symtab, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + ndx_section[secndx - 1] = shdr->sh_link; + continue; + } + + if (!(sec->shdr.sh_flags & SHF_ALLOC) + && !strcmp (sec->name, ".gnu_debuglink")) + { + /* This was created by stripping. We don't want it. */ + debuglink = secndx; + ndx_section[secndx - 1] = SHN_UNDEF; + continue; + } + + sec->outscn = elf_newscn (unstripped); + Elf_Data *newdata = elf_newdata (sec->outscn); + ELF_CHECK (newdata != NULL && gelf_update_shdr (sec->outscn, + &sec->shdr), + _("cannot add new section: %s")); + + if (strtab == NULL) + strtab = ebl_strtabinit (true); + sec->strent = ebl_strtabadd (strtab, sec->name, 0); + ELF_CHECK (sec->strent != NULL, + _("cannot add section name to string table: %s")); + } + + /* Cache the mapping of original section indices to output sections. */ + ndx_section[secndx - 1] = elf_ndxscn (sec->outscn); + } + + /* We added some sections, so we need a new shstrtab. */ + Elf_Data *strtab_data = new_shstrtab (unstripped, unstripped_shnum, + shstrtab, unstripped_shstrndx, + sections, stripped_shnum, + strtab); + + /* Get the updated section count. */ + ELF_CHECK (elf_getshnum (unstripped, &unstripped_shnum) == 0, + _("cannot get section count: %s")); + + bool placed[unstripped_shnum - 1]; + memset (placed, 0, sizeof placed); + + /* Now update the output sections and copy in their data. */ + GElf_Off offset = 0; + for (const struct section *sec = sections; + sec < §ions[stripped_shnum - 1]; + ++sec) + if (sec->outscn != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (sec->outscn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + /* In an ET_REL file under --relocate, the sh_addr of SHF_ALLOC + sections will have been set nonzero by relocation. This + touched the shdrs of whichever file had the symtab. sh_addr + is still zero in the corresponding shdr. The relocated + address is what we want to use. */ + if (stripped_ehdr->e_type != ET_REL + || !(shdr_mem.sh_flags & SHF_ALLOC) + || shdr_mem.sh_addr == 0) + shdr_mem.sh_addr = sec->shdr.sh_addr; + + shdr_mem.sh_type = sec->shdr.sh_type; + shdr_mem.sh_size = sec->shdr.sh_size; + shdr_mem.sh_info = sec->shdr.sh_info; + shdr_mem.sh_link = sec->shdr.sh_link; + if (sec->shdr.sh_link != SHN_UNDEF) + shdr_mem.sh_link = ndx_section[sec->shdr.sh_link - 1]; + if (shdr_mem.sh_flags & SHF_INFO_LINK) + shdr_mem.sh_info = ndx_section[sec->shdr.sh_info - 1]; + + if (strtab != NULL) + shdr_mem.sh_name = ebl_strtaboffset (sec->strent); + + Elf_Data *indata = elf_getdata (sec->scn, NULL); + ELF_CHECK (indata != NULL, _("cannot get section data: %s")); + Elf_Data *outdata = elf_getdata (sec->outscn, NULL); + ELF_CHECK (outdata != NULL, _("cannot copy section data: %s")); + *outdata = *indata; + elf_flagdata (outdata, ELF_C_SET, ELF_F_DIRTY); + + /* Preserve the file layout of the allocated sections. */ + if (stripped_ehdr->e_type != ET_REL && (shdr_mem.sh_flags & SHF_ALLOC)) + { + shdr_mem.sh_offset = sec->shdr.sh_offset; + placed[elf_ndxscn (sec->outscn) - 1] = true; + + const GElf_Off end_offset = (shdr_mem.sh_offset + + (shdr_mem.sh_type == SHT_NOBITS + ? 0 : shdr_mem.sh_size)); + if (end_offset > offset) + offset = end_offset; + } + + ELF_CHECK (gelf_update_shdr (sec->outscn, &shdr_mem), + _("cannot update section header: %s")); + + if (shdr_mem.sh_type == SHT_SYMTAB || shdr_mem.sh_type == SHT_DYNSYM) + { + /* We must adjust all the section indices in the symbol table. */ + + Elf_Data *shndxdata = NULL; /* XXX */ + + for (size_t i = 1; i < shdr_mem.sh_size / shdr_mem.sh_entsize; ++i) + { + GElf_Sym sym_mem; + GElf_Word shndx = SHN_UNDEF; + GElf_Sym *sym = gelf_getsymshndx (outdata, shndxdata, + i, &sym_mem, &shndx); + ELF_CHECK (sym != NULL, + _("cannot get symbol table entry: %s")); + if (sym->st_shndx != SHN_XINDEX) + shndx = sym->st_shndx; + + if (shndx != SHN_UNDEF && shndx < SHN_LORESERVE) + { + if (shndx >= stripped_shnum) + error (EXIT_FAILURE, 0, + _("symbol [%Zu] has invalid section index"), i); + + shndx = ndx_section[shndx - 1]; + if (shndx < SHN_LORESERVE) + { + sym->st_shndx = shndx; + shndx = SHN_UNDEF; + } + else + sym->st_shndx = SHN_XINDEX; + + ELF_CHECK (gelf_update_symshndx (outdata, shndxdata, + i, sym, shndx), + _("cannot update symbol table: %s")); + } + } + + if (shdr_mem.sh_type == SHT_SYMTAB) + stripped_symtab = sec; + if (shdr_mem.sh_type == SHT_DYNSYM) + stripped_dynsym = sec; + } + } + + /* We may need to update the symbol table. */ + Elf_Data *symdata = NULL; + struct Ebl_Strtab *symstrtab = NULL; + Elf_Data *symstrdata = NULL; + if (unstripped_symtab != NULL && (stripped_symtab != NULL + || check_prelink /* Section adjustments. */ + || (stripped_ehdr->e_type != ET_REL + && bias != 0))) + { + /* Merge the stripped file's symbol table into the unstripped one. */ + const size_t stripped_nsym = (stripped_symtab == NULL ? 1 + : (stripped_symtab->shdr.sh_size + / stripped_symtab->shdr.sh_entsize)); + + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (unstripped_symtab, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + const size_t unstripped_nsym = shdr->sh_size / shdr->sh_entsize; + + /* First collect all the symbols from both tables. */ + + const size_t total_syms = stripped_nsym - 1 + unstripped_nsym - 1; + struct symbol symbols[total_syms]; + size_t symndx_map[total_syms]; + + if (stripped_symtab != NULL) + collect_symbols (unstripped, stripped_ehdr->e_type == ET_REL, + stripped_symtab->scn, + elf_getscn (stripped, stripped_symtab->shdr.sh_link), + stripped_nsym, 0, ndx_section, + symbols, symndx_map, NULL); + + Elf_Scn *unstripped_strtab = elf_getscn (unstripped, shdr->sh_link); + collect_symbols (unstripped, stripped_ehdr->e_type == ET_REL, + unstripped_symtab, unstripped_strtab, unstripped_nsym, + stripped_ehdr->e_type == ET_REL ? 0 : bias, NULL, + &symbols[stripped_nsym - 1], + &symndx_map[stripped_nsym - 1], split_bss); + + /* Next, sort our array of all symbols. */ + qsort (symbols, total_syms, sizeof symbols[0], compare_symbols); + + /* Now we can weed out the duplicates. Assign remaining symbols + new slots, collecting a map from old indices to new. */ + size_t nsym = 0; + for (struct symbol *s = symbols; s < &symbols[total_syms]; ++s) + { + /* Skip a section symbol for a removed section. */ + if (s->shndx == SHN_UNDEF + && GELF_ST_TYPE (s->info.info) == STT_SECTION) + { + s->name = NULL; /* Mark as discarded. */ + *s->map = STN_UNDEF; + s->duplicate = NULL; + continue; + } + + struct symbol *n = s; + while (n + 1 < &symbols[total_syms] && !compare_symbols (s, n + 1)) + ++n; + + while (s < n) + { + /* This is a duplicate. Its twin will get the next slot. */ + s->name = NULL; /* Mark as discarded. */ + s->duplicate = n->map; + ++s; + } + + /* Allocate the next slot. */ + *s->map = ++nsym; + } + + /* Now we sort again, to determine the order in the output. */ + qsort (symbols, total_syms, sizeof symbols[0], compare_symbols_output); + + if (nsym < total_syms) + /* The discarded symbols are now at the end of the table. */ + assert (symbols[nsym].name == NULL); + + /* Now a final pass updates the map with the final order, + and builds up the new string table. */ + symstrtab = ebl_strtabinit (true); + for (size_t i = 0; i < nsym; ++i) + { + assert (symbols[i].name != NULL); + assert (*symbols[i].map != 0); + *symbols[i].map = 1 + i; + symbols[i].strent = ebl_strtabadd (symstrtab, symbols[i].name, 0); + } + + /* Scan the discarded symbols too, just to update their slots + in SYMNDX_MAP to refer to their live duplicates. */ + for (size_t i = nsym; i < total_syms; ++i) + { + assert (symbols[i].name == NULL); + if (symbols[i].duplicate == NULL) + assert (*symbols[i].map == STN_UNDEF); + else + { + assert (*symbols[i].duplicate != STN_UNDEF); + *symbols[i].map = *symbols[i].duplicate; + } + } + + /* Now we are ready to write the new symbol table. */ + symdata = elf_getdata (unstripped_symtab, NULL); + symstrdata = elf_getdata (unstripped_strtab, NULL); + Elf_Data *shndxdata = NULL; /* XXX */ + + ebl_strtabfinalize (symstrtab, symstrdata); + elf_flagdata (symstrdata, ELF_C_SET, ELF_F_DIRTY); + + shdr->sh_size = symdata->d_size = (1 + nsym) * shdr->sh_entsize; + symdata->d_buf = xmalloc (symdata->d_size); + + GElf_Sym sym; + memset (&sym, 0, sizeof sym); + ELF_CHECK (gelf_update_symshndx (symdata, shndxdata, 0, &sym, SHN_UNDEF), + _("cannot update symbol table: %s")); + + shdr->sh_info = 1; + for (size_t i = 0; i < nsym; ++i) + { + struct symbol *s = &symbols[i]; + + /* Fill in the symbol details. */ + sym.st_name = ebl_strtaboffset (s->strent); + sym.st_value = s->value; /* Already biased to output address. */ + sym.st_size = s->size; + sym.st_shndx = s->shndx; /* Already mapped to output index. */ + sym.st_info = s->info.info; + sym.st_other = s->info.other; + + /* Keep track of the number of leading local symbols. */ + if (GELF_ST_BIND (sym.st_info) == STB_LOCAL) + { + assert (shdr->sh_info == 1 + i); + shdr->sh_info = 1 + i + 1; + } + + ELF_CHECK (gelf_update_symshndx (symdata, shndxdata, 1 + i, + &sym, SHN_UNDEF), + _("cannot update symbol table: %s")); + + } + elf_flagdata (symdata, ELF_C_SET, ELF_F_DIRTY); + ELF_CHECK (gelf_update_shdr (unstripped_symtab, shdr), + _("cannot update section header: %s")); + + if (stripped_symtab != NULL) + { + /* Adjust any relocations referring to the old symbol table. */ + const size_t old_sh_link = elf_ndxscn (stripped_symtab->scn); + for (const struct section *sec = sections; + sec < §ions[stripped_shnum - 1]; + ++sec) + if (sec->outscn != NULL && sec->shdr.sh_link == old_sh_link) + adjust_relocs (sec->outscn, sec->scn, &sec->shdr, + symndx_map, shdr); + } + + /* Also adjust references to the other old symbol table. */ + adjust_all_relocs (unstripped, unstripped_symtab, shdr, + &symndx_map[stripped_nsym - 1]); + } + else if (stripped_symtab != NULL && stripped_shnum != unstripped_shnum) + check_symtab_section_symbols (unstripped, + stripped_ehdr->e_type == ET_REL, + stripped_symtab->scn, + unstripped_shnum, unstripped_shstrndx, + stripped_symtab->outscn, + stripped_shnum, stripped_shstrndx, + debuglink); + + if (stripped_dynsym != NULL) + (void) check_symtab_section_symbols (unstripped, + stripped_ehdr->e_type == ET_REL, + stripped_dynsym->outscn, + unstripped_shnum, + unstripped_shstrndx, + stripped_dynsym->scn, stripped_shnum, + stripped_shstrndx, debuglink); + + /* We need to preserve the layout of the stripped file so the + phdrs will match up. This requires us to do our own layout of + the added sections. We do manual layout even for ET_REL just + so we can try to match what the original probably had. */ + + elf_flagelf (unstripped, ELF_C_SET, ELF_F_LAYOUT); + + if (offset == 0) + /* For ET_REL we are starting the layout from scratch. */ + offset = gelf_fsize (unstripped, ELF_T_EHDR, 1, EV_CURRENT); + + bool skip_reloc = false; + do + { + skip_reloc = !skip_reloc; + for (size_t i = 0; i < unstripped_shnum - 1; ++i) + if (!placed[i]) + { + scn = elf_getscn (unstripped, 1 + i); + + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + ELF_CHECK (shdr != NULL, _("cannot get section header: %s")); + + if (skip_reloc + && (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA)) + continue; + + GElf_Off align = shdr->sh_addralign ?: 1; + offset = (offset + align - 1) & -align; + shdr->sh_offset = offset; + if (shdr->sh_type != SHT_NOBITS) + offset += shdr->sh_size; + + ELF_CHECK (gelf_update_shdr (scn, shdr), + _("cannot update section header: %s")); + + if (unstripped_shstrndx == 1 + i) + { + /* Place the section headers immediately after + .shstrtab, and update the ELF header. */ + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr = gelf_getehdr (unstripped, &ehdr_mem); + ELF_CHECK (ehdr != NULL, _("cannot get ELF header: %s")); + + GElf_Off sh_align = gelf_getclass (unstripped) * 4; + offset = (offset + sh_align - 1) & -sh_align; + ehdr->e_shnum = unstripped_shnum; + ehdr->e_shoff = offset; + offset += unstripped_shnum * ehdr->e_shentsize; + ELF_CHECK (gelf_update_ehdr (unstripped, ehdr), + _("cannot update ELF header: %s")); + } + + placed[i] = true; + } + } while (skip_reloc); + + if (stripped_ehdr->e_phnum > 0) + ELF_CHECK (gelf_newphdr (unstripped, stripped_ehdr->e_phnum), + _("cannot create program headers: %s")); + + /* Copy each program header from the stripped file. */ + for (uint_fast16_t i = 0; i < stripped_ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (stripped, i, &phdr_mem); + ELF_CHECK (phdr != NULL, _("cannot get program header: %s")); + + ELF_CHECK (gelf_update_phdr (unstripped, i, phdr), + _("cannot update program header: %s")); + } + + /* Finally, write out the file. */ + ELF_CHECK (elf_update (unstripped, ELF_C_WRITE) > 0, + _("cannot write output file: %s")); + + if (strtab != NULL) + { + ebl_strtabfree (strtab); + free (strtab_data->d_buf); + } + + if (symdata != NULL) + free (symdata->d_buf); + if (symstrtab != NULL) + { + ebl_strtabfree (symstrtab); + free (symstrdata->d_buf); + } +} + +/* Process one pair of files, already opened. */ +static void +handle_file (const char *output_file, bool create_dirs, + Elf *stripped, const GElf_Ehdr *stripped_ehdr, + Elf *unstripped) +{ + /* Determine the address bias between the debuginfo file and the main + file, which may have been modified by prelinking. */ + GElf_Addr bias = 0; + if (unstripped != NULL) + for (uint_fast16_t i = 0; i < stripped_ehdr->e_phnum; ++i) + { + GElf_Phdr phdr_mem; + GElf_Phdr *phdr = gelf_getphdr (stripped, i, &phdr_mem); + ELF_CHECK (phdr != NULL, _("cannot get program header: %s")); + if (phdr->p_type == PT_LOAD) + { + GElf_Phdr unstripped_phdr_mem; + GElf_Phdr *unstripped_phdr = gelf_getphdr (unstripped, i, + &unstripped_phdr_mem); + ELF_CHECK (unstripped_phdr != NULL, + _("cannot get program header: %s")); + bias = phdr->p_vaddr - unstripped_phdr->p_vaddr; + break; + } + } + + /* One day we could adjust all the DWARF data (like prelink itself does). */ + if (bias != 0) + { + if (output_file == NULL) + error (0, 0, _("\ +DWARF data not adjusted for prelinking bias; consider prelink -u")); + else + error (0, 0, _("\ +DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"), + output_file); + } + + if (output_file == NULL) + /* Modify the unstripped file in place. */ + copy_elided_sections (unstripped, stripped, stripped_ehdr, bias); + else + { + if (create_dirs) + make_directories (output_file); + + /* Copy the unstripped file and then modify it. */ + int outfd = open64 (output_file, O_RDWR | O_CREAT, + stripped_ehdr->e_type == ET_REL ? 0666 : 0777); + if (outfd < 0) + error (EXIT_FAILURE, errno, _("cannot open '%s'"), output_file); + Elf *outelf = elf_begin (outfd, ELF_C_WRITE, NULL); + ELF_CHECK (outelf != NULL, _("cannot create ELF descriptor: %s")); + + if (unstripped == NULL) + { + /* Actually, we are just copying out the main file as it is. */ + copy_elf (outelf, stripped); + if (stripped_ehdr->e_type != ET_REL) + elf_flagelf (outelf, ELF_C_SET, ELF_F_LAYOUT); + ELF_CHECK (elf_update (outelf, ELF_C_WRITE) > 0, + _("cannot write output file: %s")); + } + else + { + copy_elf (outelf, unstripped); + copy_elided_sections (outelf, stripped, stripped_ehdr, bias); + } + + elf_end (outelf); + close (outfd); + } +} + +static int +open_file (const char *file, bool writable) +{ + int fd = open64 (file, writable ? O_RDWR : O_RDONLY); + if (fd < 0) + error (EXIT_FAILURE, errno, _("cannot open '%s'"), file); + return fd; +} + +/* Handle a pair of files we need to open by name. */ +static void +handle_explicit_files (const char *output_file, bool create_dirs, + const char *stripped_file, const char *unstripped_file) +{ + int stripped_fd = open_file (stripped_file, false); + Elf *stripped = elf_begin (stripped_fd, ELF_C_READ, NULL); + GElf_Ehdr stripped_ehdr; + ELF_CHECK (gelf_getehdr (stripped, &stripped_ehdr), + _("cannot create ELF descriptor: %s")); + + int unstripped_fd = -1; + Elf *unstripped = NULL; + if (unstripped_file != NULL) + { + unstripped_fd = open_file (unstripped_file, output_file == NULL); + unstripped = elf_begin (unstripped_fd, + (output_file == NULL ? ELF_C_RDWR : ELF_C_READ), + NULL); + GElf_Ehdr unstripped_ehdr; + ELF_CHECK (gelf_getehdr (unstripped, &unstripped_ehdr), + _("cannot create ELF descriptor: %s")); + + if (memcmp (stripped_ehdr.e_ident, unstripped_ehdr.e_ident, EI_NIDENT) + || stripped_ehdr.e_type != unstripped_ehdr.e_type + || stripped_ehdr.e_machine != unstripped_ehdr.e_machine + || stripped_ehdr.e_phnum != unstripped_ehdr.e_phnum) + error (EXIT_FAILURE, 0, _("'%s' and '%s' do not seem to match"), + stripped_file, unstripped_file); + } + + handle_file (output_file, create_dirs, stripped, &stripped_ehdr, unstripped); + + elf_end (stripped); + close (stripped_fd); + + elf_end (unstripped); + close (unstripped_fd); +} + + +/* Handle a pair of files opened implicitly by libdwfl for one module. */ +static void +handle_dwfl_module (const char *output_file, bool create_dirs, + Dwfl_Module *mod, bool all, bool ignore, bool relocate) +{ + GElf_Addr bias; + Elf *stripped = dwfl_module_getelf (mod, &bias); + if (stripped == NULL) + { + if (ignore) + return; + + const char *file; + const char *modname = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, &file, NULL); + if (file == NULL) + error (EXIT_FAILURE, 0, + _("cannot find stripped file for module '%s': %s"), + modname, dwfl_errmsg (-1)); + else + error (EXIT_FAILURE, 0, + _("cannot open stripped file '%s' for module '%s': %s"), + modname, file, dwfl_errmsg (-1)); + } + + Elf *debug = dwarf_getelf (dwfl_module_getdwarf (mod, &bias)); + if (debug == NULL && !all) + { + if (ignore) + return; + + const char *file; + const char *modname = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, NULL, &file); + if (file == NULL) + error (EXIT_FAILURE, 0, + _("cannot find debug file for module '%s': %s"), + modname, dwfl_errmsg (-1)); + else + error (EXIT_FAILURE, 0, + _("cannot open debug file '%s' for module '%s': %s"), + modname, file, dwfl_errmsg (-1)); + } + + if (debug == stripped) + { + if (all) + debug = NULL; + else + { + const char *file; + const char *modname = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, &file, NULL); + error (EXIT_FAILURE, 0, _("module '%s' file '%s' is not stripped"), + modname, file); + } + } + + GElf_Ehdr stripped_ehdr; + ELF_CHECK (gelf_getehdr (stripped, &stripped_ehdr), + _("cannot create ELF descriptor: %s")); + + if (stripped_ehdr.e_type == ET_REL) + { + if (!relocate) + { + /* We can't use the Elf handles already open, + because the DWARF sections have been relocated. */ + + const char *stripped_file = NULL; + const char *unstripped_file = NULL; + (void) dwfl_module_info (mod, NULL, NULL, NULL, NULL, NULL, + &stripped_file, &unstripped_file); + + handle_explicit_files (output_file, create_dirs, + stripped_file, unstripped_file); + return; + } + + /* Relocation is what we want! This ensures that all sections that can + get sh_addr values assigned have them, even ones not used in DWARF. + They might still be used in the symbol table. */ + if (dwfl_module_relocations (mod) < 0) + error (EXIT_FAILURE, 0, + _("cannot cache section addresses for module '%s': %s"), + dwfl_module_info (mod, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + dwfl_errmsg (-1)); + } + + handle_file (output_file, create_dirs, stripped, &stripped_ehdr, debug); +} + +/* Handle one module being written to the output directory. */ +static void +handle_output_dir_module (const char *output_dir, Dwfl_Module *mod, + bool all, bool ignore, bool modnames, bool relocate) +{ + if (! modnames) + { + /* Make sure we've searched for the ELF file. */ + GElf_Addr bias; + (void) dwfl_module_getelf (mod, &bias); + } + + const char *file; + const char *name = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, &file, NULL); + + if (file == NULL && ignore) + return; + + char *output_file; + if (asprintf (&output_file, "%s/%s", output_dir, modnames ? name : file) < 0) + error (EXIT_FAILURE, 0, _("memory exhausted")); + + handle_dwfl_module (output_file, true, mod, all, ignore, relocate); +} + + +static void +list_module (Dwfl_Module *mod) +{ + /* Make sure we have searched for the files. */ + GElf_Addr bias; + bool have_elf = dwfl_module_getelf (mod, &bias) != NULL; + bool have_dwarf = dwfl_module_getdwarf (mod, &bias) != NULL; + + const char *file; + const char *debug; + Dwarf_Addr start; + Dwarf_Addr end; + const char *name = dwfl_module_info (mod, NULL, &start, &end, + NULL, NULL, &file, &debug); + if (file != NULL && debug != NULL && (debug == file || !strcmp (debug, file))) + debug = "."; + + const unsigned char *id; + GElf_Addr id_vaddr; + int id_len = dwfl_module_build_id (mod, &id, &id_vaddr); + + printf ("%#" PRIx64 "+%#" PRIx64 " ", start, end - start); + + if (id_len > 0) + { + do + printf ("%02" PRIx8, *id++); + while (--id_len > 0); + if (id_vaddr != 0) + printf ("@%#" PRIx64, id_vaddr); + } + else + putchar ('-'); + + printf (" %s %s %s\n", + file ?: have_elf ? "." : "-", + debug ?: have_dwarf ? "." : "-", + name); +} + + +struct match_module_info +{ + char **patterns; + Dwfl_Module *found; + bool match_files; +}; + +static int +match_module (Dwfl_Module *mod, + void **userdata __attribute__ ((unused)), + const char *name, + Dwarf_Addr start __attribute__ ((unused)), + void *arg) +{ + struct match_module_info *info = arg; + + if (info->patterns[0] == NULL) /* Match all. */ + { + match: + info->found = mod; + return DWARF_CB_ABORT; + } + + if (info->match_files) + { + /* Make sure we've searched for the ELF file. */ + GElf_Addr bias; + (void) dwfl_module_getelf (mod, &bias); + + const char *file; + const char *check = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, &file, NULL); + assert (check == name); + if (file == NULL) + return DWARF_CB_OK; + + name = file; + } + + for (char **p = info->patterns; *p != NULL; ++p) + if (fnmatch (*p, name, 0) == 0) + goto match; + + return DWARF_CB_OK; +} + +/* Handle files opened implicitly via libdwfl. */ +static void +handle_implicit_modules (const struct arg_info *info) +{ + struct match_module_info mmi = { info->args, NULL, info->match_files }; + inline ptrdiff_t next (ptrdiff_t offset) + { + return dwfl_getmodules (info->dwfl, &match_module, &mmi, offset); + } + ptrdiff_t offset = next (0); + if (offset == 0) + error (EXIT_FAILURE, 0, _("no matching modules found")); + + if (info->list) + do + list_module (mmi.found); + while ((offset = next (offset)) > 0); + else if (info->output_dir == NULL) + { + if (next (offset) != 0) + error (EXIT_FAILURE, 0, _("matched more than one module")); + handle_dwfl_module (info->output_file, false, mmi.found, + info->all, info->ignore, info->relocate); + } + else + do + handle_output_dir_module (info->output_dir, mmi.found, + info->all, info->ignore, + info->modnames, info->relocate); + while ((offset = next (offset)) > 0); +} + +int +main (int argc, char **argv) +{ + /* Make memory leak detection possible. */ + mtrace (); + + /* We use no threads here which can interfere with handling a stream. */ + __fsetlocking (stdin, FSETLOCKING_BYCALLER); + __fsetlocking (stdout, FSETLOCKING_BYCALLER); + __fsetlocking (stderr, FSETLOCKING_BYCALLER); + + /* Set locale. */ + setlocale (LC_ALL, ""); + + /* Make sure the message catalog can be found. */ + bindtextdomain (PACKAGE_TARNAME, LOCALEDIR); + + /* Initialize the message catalog. */ + textdomain (PACKAGE_TARNAME); + + /* Parse and process arguments. */ + const struct argp_child argp_children[] = + { + { + .argp = dwfl_standard_argp (), + .header = N_("Input selection options:"), + .group = 1, + }, + { .argp = NULL }, + }; + const struct argp argp = + { + .options = options, + .parser = parse_opt, + .children = argp_children, + .args_doc = N_("STRIPPED-FILE DEBUG-FILE\n[MODULE...]"), + .doc = N_("\ +Combine stripped files with separate symbols and debug information.\v\ +The first form puts the result in DEBUG-FILE if -o was not given.\n\ +\n\ +MODULE arguments give file name patterns matching modules to process.\n\ +With -f these match the file name of the main (stripped) file \ +(slashes are never special), otherwise they match the simple module names. \ +With no arguments, process all modules found.\n\ +\n\ +Multiple modules are written to files under OUTPUT-DIRECTORY, \ +creating subdirectories as needed. \ +With -m these files have simple module names, otherwise they have the \ +name of the main file complete with directory underneath OUTPUT-DIRECTORY.\n\ +\n\ +With -n no files are written, but one line to standard output for each module:\ +\n\tSTART+SIZE BUILDID FILE DEBUGFILE MODULENAME\n\ +START and SIZE are hexadecimal giving the address bounds of the module. \ +BUILDID is hexadecimal for the build ID bits, or - if no ID is known; \ +the hexadecimal may be followed by @0xADDR giving the address where the \ +ID resides if that is known. \ +FILE is the file name found for the module, or - if none was found, \ +or . if an ELF image is available but not from any named file. \ +DEBUGFILE is the separate debuginfo file name, \ +or - if no debuginfo was found, or . if FILE contains the debug information.\ +") + }; + + int remaining; + struct arg_info info = { .args = NULL }; + error_t result = argp_parse (&argp, argc, argv, 0, &remaining, &info); + if (result == ENOSYS) + assert (info.dwfl == NULL); + else if (result) + return EXIT_FAILURE; + assert (info.args != NULL); + + /* Tell the library which version we are expecting. */ + elf_version (EV_CURRENT); + + if (info.dwfl == NULL) + { + assert (result == ENOSYS); + + if (info.output_dir != NULL) + { + char *file; + if (asprintf (&file, "%s/%s", info.output_dir, info.args[0]) < 0) + error (EXIT_FAILURE, 0, _("memory exhausted")); + handle_explicit_files (file, true, info.args[0], info.args[1]); + free (file); + } + else + handle_explicit_files (info.output_file, false, + info.args[0], info.args[1]); + } + else + { + /* parse_opt checked this. */ + assert (info.output_file != NULL || info.output_dir != NULL || info.list); + + handle_implicit_modules (&info); + + dwfl_end (info.dwfl); + } + + return 0; +} + + +#include "debugpred.h" diff --git a/src/versionhash.c b/src/versionhash.c index 79b2e105..6126eb95 100644 --- a/src/versionhash.c +++ b/src/versionhash.c @@ -1,16 +1,28 @@ /* Version symbol hash table implementation. Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/versionhash.h b/src/versionhash.h index 243aeeb5..63ca1145 100644 --- a/src/versionhash.h +++ b/src/versionhash.h @@ -1,15 +1,27 @@ /* Copyright (C) 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifndef VERSIONHASH_H #define VERSIONHASH_H 1 @@ -1,16 +1,28 @@ /* Macros to enable writing native and generic ELF access code. Copyright (C) 2003 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/stamp-h1 b/stamp-h1 deleted file mode 100644 index 4547fe1b..00000000 --- a/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for config.h diff --git a/tests/ChangeLog b/tests/ChangeLog index 05e36331..958255a8 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,875 @@ +2008-12-31 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for blendvpd and blendvps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-30 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for blendpd and blendps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-19 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for AMD 3DNOW. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-11-26 Roland McGrath <roland@redhat.com> + + * dwfl-bug-getmodules.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwfl_bug_getmodules_LDADD): New variable. + +2008-09-10 Roland McGrath <roland@redhat.com> + + * test-subr.sh (LC_ALL): Export it set to "C". + * run-dwfl-addr-sect.sh: Don't do it here. + * run-strings-test.sh: Likewise. + +2008-08-21 Denys Vlasenko <dvlasenk@redhat.com> + + * run-addrname-test.sh: Add a new case. + * testfile49.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2008-04-10 Roland McGrath <roland@redhat.com> + + * testfile48.bz2, testfile48.bz2.debug: New data files. + * Makefile.am (EXTRA_DIST): Add them. + * run-strip-test8.sh: Use them. + + * testfile16.bz2, testfile16.debug.bz2: Replace data files. + + * run-strip-test.sh: Fail if stripped output has ".debug_*" sections. + * run-strip-test8.sh: New file. + * testfile47.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * run-early-offscn.sh: New file. + * early-offscn.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS, EXTRA_DIST): Add them. + (early_offscn_LDADD): New variable. + +2008-03-19 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case. + +2008-02-22 Roland McGrath <roland@redhat.com> + + * run-elflint-test.sh: Typo fix. + +2008-02-21 Roland McGrath <roland@redhat.com> + + * run-disasm-x86.sh: Use uname instead of arch, keep tools required + for the build down to minimum. + * run-disasm-x86-64.sh: Likewise. + +2008-02-20 Roland McGrath <roland@redhat.com> + + * testfile46.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it. + +2008-02-01 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Hook up sha1-tst.c. + * sha1-tst.c: New file. + +2008-01-21 Roland McGrath <roland@redhat.com> + + * testfile45.S.bz2: Add tests for cltq, cqto. + * testfile45.expect.bz2: Adjust. + +2008-01-14 Ulrich Drepper <drepper@redhat.com> + + * testfile45.S.bz2: Add more tests. + * testfile45.expect.bz2: Adjust. + +2008-01-11 Ulrich Drepper <drepper@redhat.com> + + * testfile45.expect.bz2: Adjust for adding of address for %rip based + address mode. + +2008-01-10 Ulrich Drepper <drepper@redhat.com> + + * testfile45.S.bz2: Add more tests. + * testfile45.expect.bz2: Adjust. + +2008-01-08 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (TESTS): Add run-disasm-x86-64.sh. + (EXTRA): Add testfile45.S.bz2, testfile45.expect.bz2, + run-disasm-x86-64.sh. + * run-disasm-x86-64.sh: New file. + * testfile45.S.bz2: New file. + * testfile45.expect.bz2: New file. + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-04 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-04 Roland McGrath <roland@redhat.com> + + * dwfl-bug-fd-leak.c (main): Add a cast. + +2008-01-03 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-01 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c: Use %m modifier instead of %a to appease gcc. + +2008-01-01 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-31 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-30 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-29 Ulrich Drepper <drepper@redhat.com> + + * testfile44.s.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-28 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-27 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-26 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust + +2007-12-21 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: More tests. + * testfile44.expect.bz2: Adjust appropriately. + +2007-12-19 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (TESTS): Add run-disasm.sh. + (EXTRA_DIST): Add run-disasm.sh, testfile44.S.bz2, and + testfile44.expect.bz2. + * run-disasm.sh: New file. + * testfile44.S.bz2: New file. + * testfile44.expect.bz2: New file. + +2007-12-15 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Change expected output for powerpc spefscr. + +2007-10-20 Roland McGrath <roland@redhat.com> + + * run-dwfl-addr-sect.sh: Change expected output, no errors. + +2007-10-19 Roland McGrath <roland@redhat.com> + + * dwfl-addr-sect.c (handle_address): Return int. + Don't exit on error, just return nonzero. + (main): Collect results. + * run-dwfl-addr-sect.sh: New file. + * testfile43.bz2: New data file. + * Makefile.am (EXTRA_DIST, TESTS): Add them. + +2007-10-18 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected ppc output for vrsave/vscr. + +2007-10-16 Roland McGrath <roland@redhat.com> + + * test-subr.sh (remove_files): Don't pass -Bb to diff. + +2007-10-09 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c (print_module): Don't use %p in output. + * run-dwfl-bug-offline-rel.sh: Updated expected output. + +2007-10-08 Roland McGrath <roland@redhat.com> + + * testfile42.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: New test on that file. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * run-readelf-test4.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * run-readelf-test3.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-10-01 Roland McGrath <roland@redhat.com> + + * run-readelf-test2.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-09-11 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case. + * testfile41.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-08-23 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected x86-64 output for %rflags. + +2007-08-12 Roland McGrath <roland@redhat.com> + + * run-strip-test7.sh: New file. + * testfile39.bz2: New data file. + * testfile40.bz2: New data file. + * testfile40.debug.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-08-09 Roland McGrath <roland@redhat.com> + + * dwfl-bug-report.c: Fix header inclusion. + +2007-08-08 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case using addr2line -S. + * testfile38.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-07-16 Roland McGrath <roland@redhat.com> + + * dwfl-bug-report.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + (dwfl_bug_report_LDADD): New variable. + +2007-06-06 Roland McGrath <roland@redhat.com> + + * run-unstrip-test.sh: Declare testfile.unstrip for removal. + +2007-06-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Add missing line continuation and + testfile37.bz and testfile37.debug.bz2. + +2007-05-23 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected Alpha results. + +2007-05-18 Roland McGrath <roland@redhat.com> + + * run-strip-test4.sh (stripped, debugfile): Use new reference files. + * testfile37.bz2: New data file. + * testfile37.debug.bz2: New data file. + * run-unstrip-test2.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-05-10 Roland McGrath <roland@redhat.com> + + * run-dwfl-bug-offline-rel.sh: New file. + * testfile36.bz2: New data file. + * testfile36.debug.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-04-28 Roland McGrath <roland@redhat.com> + + * run-strip-test6.sh (stripped, debugfile): Use new reference files. + * testfile35.bz2: New data file. + * testfile35.debug.bz2: New data file. + * run-unstrip-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + + * run-strip-test.sh: Do all elflint and cmp runs even when some fail. + +2007-04-26 Roland McGrath <roland@redhat.com> + + * run-elflint-self.sh: Run all tests even if one fails. + + * run-allregs.sh: Add expected output for alpha. + +2007-04-24 Roland McGrath <roland@redhat.com> + + * run-strip-test.sh: When we saved the debug info, test unstrip too. + +2007-04-22 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected register info. + +2007-04-16 Roland McGrath <roland@redhat.com> + + * dwfl-addr-sect.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwfl_addr_sect_LDADD): New variable. + +2007-04-05 Roland McGrath <roland@redhat.com> + + * get-files.c: Test dwarf_getsrcdirs. + * run-get-files.sh: Update expected output. + +2007-04-01 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Updated expected output for x86_64. + +2007-03-04 Roland McGrath <roland@redhat.com> + + * dwfl-bug-fd-leak.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + (dwfl_bug_fd_leak_LDADD): New variable. + + * dwflmodtest.c: Test dwfl_getmodules before and after getdwarf, + show what files have been located. + +2007-02-02 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + * testfile34.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-01-20 Roland McGrath <roland@redhat.com> + + * testfile33.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it too. + +2007-01-18 Roland McGrath <roland@redhat.com> + + * Makefile.am (CFLAGS): Don't molest it. + +2007-01-11 Roland McGrath <roland@redhat.com> + + * testfile32.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it too. + +2007-02-04 Ulrich Drepper <drepper@redhat.com> + + * arls.c: New file. + * Makefile (noinst_PROGRAMS): Add arls. + + * run-ranlib-test2.sh: Fix type in comment. + +2007-01-10 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh (runtest): Show which file has the problem. + +2007-01-10 Roland McGrath <roland@redhat.com> + + * dwfl-bug-addr-overflow.c: New file. + * Makefile.am (TESTS): Add it. + (dwfl_bug_addr_overflow_LDADD): New variable. + +2006-12-17 Roland McGrath <roland@redhat.com> + + * msg_tst.c (libelf_msgs): Fix ELF_E_INVALID_PHDR msg. + +2006-09-05 Roland McGrath <roland@redhat.com> + + * run-strings-test.sh: Export LC_ALL=C for the test. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * run-arextract.sh: Use testrun, tempfiles functions from test-subr.sh. + * run-arsymtest.sh: Likewise. + + * run-native-test.sh (native.c compilation): Add some braces. + +2006-08-22 Roland McGrath <roland@redhat.com> + + * allregs.c (dwarf_encoding_string): New function, swiped from readelf. + (struct reginfo): New members bits, type. + (one_register, match_register): Update to take new args, + record and display new info. + (main): Display new info. + * run-allregs.sh: Update expected results. + +2006-08-03 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Add sparc cases. + * testfile30.bz2: New data file. + * testfile31.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add them. + +2006-07-21 Roland McGrath <roland@redhat.com> + + * allregs.c (struct reginfo): Increase size of name. + (one_register): Assert that it's big enough. + +2006-04-04 Roland McGrath <roland@redhat.com> + + * run-bug1-test.sh: Test a second case, to cover both byte orders. + * testfile29.bz2: New file. + * testfile29.rdwr.bz2: New file. + * Makefile.am (EXTRA_DIST): Add them. + +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add rules to run run-bug1-test.sh. + * rdwrmmap.c: New file. + * run-bug1-test.sh: New file. + * testfile28.bz2: New file. + * testfile28.rdwr.bz2: New file. + +2006-03-09 Roland McGrath <roland@redhat.com> + + * Makefile.am (AM_LDFLAGS): Define to pass -rpath-link. + +2006-03-01 Roland McGrath <roland@redhat.com> + + * show-die-info.c (tagnames, attrs): Update name tables for dwarf.h + changes matching 3.0 spec. + +2006-01-13 Roland McGrath <roland@redhat.com> + + * run-native-test.sh: Do kill -9 and reap explicitly at end, since + bash 3.1 whines when it's done in the trap 0 handler. + +2006-01-11 Roland McGrath <roland@redhat.com> + + * testfile26.bz2: New data file. + * testfile27.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add them. + * run-allregs.sh: Test s390 data. + +2005-12-14 Roland McGrath <roland@redhat.com> + + * run-native-test.sh: Redirect output from native test process. + +2005-12-13 Roland McGrath <roland@redhat.com> + + * allregs.c (main): Fail if we find no registers. + + * run-native-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2005-12-10 Ulrich Drepper <drepper@redhat.com + + * run-readelf-test1.sh: New file. + * Makefile.am (TESTS): Add run-readelf-test1.sh. + (EXTRA_DIST): Likewise. + +2005-12-07 Roland McGrath <roland@redhat.com> + + * ecp.c (main): Use elf_end to clean up. + +2005-11-25 Roland McGrath <roland@redhat.com> + + * coverage.sh: Given -v argument, print names of unused files. + + * addrscopes.c (main): Use dwfl_end before return. + * allregs.c (main): Likewise. + * find-prologues.c (main): Likewise. + * funcretval.c (main): Likewise. + * funcscopes.c (main): Likewise. + * line2addr.c (main): Likewise. + + * run-allregs.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + + * allregs.c: Use libdwfl wrapper instead of direct libebl calls. + * Makefile.am (allregs_LDADD): Updated. + + * allregs.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (allregs_LDADD): New variable. + +2005-11-18 Roland McGrath <roland@redhat.com> + + * test-subr.sh (installed_testrun): Treat /usr/lib64 like /usr/lib. + * test-wrapper.sh: Likewise. + +2005-11-17 Roland McGrath <roland@redhat.com> + + * Makefile.am (installed_TESTS_ENVIRONMENT): Set libdir, bindir in + environment for test-wrapper.sh. + * test-wrapper.sh: Set LD_LIBRARY_PATH from ${libdir} if not /usr/lib. + * test-subr.sh (installed_testrun): Likewise. + Use explicit path in ${bindir}. + + * Makefile.am (installcheck-local): Fix typo in last change. + +2005-11-16 Roland McGrath <roland@redhat.com> + + * configure.ac: New file, for standalone build/dist of test suite. + * Makefile.am [!STANDALONE] (INCLUDES): Don't define it. + (asm_TESTS): New variable, broken out of ... + (TESTS): ... here. Also remove msg_tst. + [!STANDALONE] (TESTS, noinst_PROGRAMS): Add in $(asm_TESTS), msg_tst. + (installed_TESTS_ENVIRONMENT): New variable. + [STANDALONE] (TESTS_ENVIRONMENT): Use that. + [!STANDALONE] (installcheck-local): Likewise. + [STANDALONE] (libdw, libelf, libasm, libebl): Define using -lfoo. + * addrscopes.c: Include <config.h>. + Use ELFUTILS_HEADER macro in #include of installed elfutils/ headers. + * allfcts.c: Likewise. + * asm-tst1.c: Likewise. + * asm-tst2.c: Likewise. + * asm-tst3.c: Likewise. + * asm-tst4.c: Likewise. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * asm-tst7.c: Likewise. + * asm-tst8.c: Likewise. + * asm-tst9.c: Likewise. + * dwflmodtest.c: Likewise. + * find-prologues.c: Likewise. + * funcscopes.c: Likewise. + * get-aranges.c: Likewise. + * get-files.c: Likewise. + * get-lines.c: Likewise. + * get-pubnames.c: Likewise. + * line2addr.c: Likewise. + * newscn.c: Likewise. + * show-abbrev.c: Likewise. + * show-die-info.c: Likewise. + * update3.c: Likewise. + * update4.c: Likewise. + * funcretval.c: Likewise. + + * dwflmodtest.c (print_instance): Don't use INTUSE. + (options): Don't use N_ macro. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * coverage.sh: Look in backends. + * Makefile.am (BUILD_RPATH): Search ../backends, not ../libebl. + (TESTS_ENVIRONMENT): Likewise. + + * funcretval.c (handle_function): Don't take DW_AT_type of FUNCDIE, + pass FUNCDIE direclty to dwfl_module_return_value_location. + + * Makefile.am (BUILD_RPATH): New variable. + [TESTS_RPATH] (AM_LDFLAGS): Pass -rpath option using that value. + (tests_rpath): New variable. + (installcheck-local): Pass it to test-wrapper.sh. + * test-wrapper.sh: In "installed" format, take yes/no value + for elfutils_tests_rpath, which export. When running a test + binary for installcheck, exit 77. + * test-subr.sh (installed_testrun): When running a test binary + for installcheck, exit 77 if $elfutils_tests_rpath = yes. + +2005-11-14 Roland McGrath <roland@redhat.com> + + * test-subr.sh: New file. + * test-wrapper.sh: New file. + * Makefile.am (EXTRA_DIST): Add them. + (AM_LDFLAGS): Variable removed. + (TESTS_ENVIRONMENT): New variable. + (installcheck-local): New target. + * run-addrscopes.sh: Use test-subr.sh. + * run-allfcts.sh: Likewise. + * run-ecp-test.sh: Likewise. + * run-ecp-test2.sh: Likewise. + * run-elflint-self.sh: Likewise. + * run-elflint-test.sh: Likewise. + * run-find-prologues.sh: Likewise. + * run-funcscopes.sh: Likewise. + * run-get-aranges.sh: Likewise. + * run-get-files.sh: Likewise. + * run-get-lines.sh: Likewise. + * run-get-pubnames.sh: Likewise. + * run-line2addr.sh: Likewise. + * run-ranlib-test.sh: Likewise. + * run-ranlib-test2.sh: Likewise. + * run-show-abbrev.sh: Likewise. + * run-show-ciefde.sh: Likewise. + * run-show-die-info.sh: Likewise. + * run-strings-test.sh: Likewise. + * run-strip-test.sh: Likewise. + +2005-11-13 Roland McGrath <roland@redhat.com> + + * funcretval.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (funcretval_LDADD): New variable. + +2005-11-09 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c (handle_module): Add missing parameter to printf. + +2005-10-27 Roland McGrath <roland@redhat.com> + + * allfcts.c (cb): Update for dwarf_func_* -> dwarf_decl_* changes. + * funcscopes.c (handle_function): Likewise. + * dwflmodtest.c (print_inline, print_func): Likewise. + * find-prologues.c (handle_function): Likewise. + +2005-10-27 Roland McGrath <roland@redhat.com> + + * run-find-prologues.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + + * find-prologues.c (handle_function): Skip inlines. + +2005-10-25 Roland McGrath <roland@redhat.com> + + * find-prologues.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (find_prologues_LDADD): New variable. + +2005-09-02 Ulrich Drepper <drepper@redhat.com> + + * run-strings-test.sh: Remove strings.out in the end. + +2005-08-31 Ulrich Drepper <drepper@redhat.com> + + * run-addrscopes.sh: Use correct exit code if test cannot be performed. + * run-allfcts.sh: Likewise. + * run-ecp-test.sh: Likewise. + * run-ecp-test2.sh: Likewise. + * run-elflint-test.sh: Likewise. + * run-funcscopes.sh: Likewise. + * run-get-aranges.sh: Likewise. + * run-get-files.sh: Likewise. + * run-get-lines.sh: Likewise. + * run-get-pubnames.sh: Likewise. + * run-line2addr.sh: Likewise. + * run-ranlib-test2.sh: Likewise. + * run-show-abbrev.sh: Likewise. + * run-show-ciefde.sh: Likewise. + * run-show-die-info.sh: Likewise. + * run-strings-test.sh: Likewise. + * run-strip-test.sh: Likewise. + +2005-08-30 Ulrich Drepper <drepper@redhat.com> + + * coverage.sh: Handle case where there is no .gcno file at all. + +2005-08-29 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Add coverage. + [GCOV]: Generate coverage summary after the tests ran + * coverage.sh: New file. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.an [BUILD_STATIC] (libdw): Add -ldl. + (CLEANFILES): Add *.gcno *.gcda *.gconv. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * run-strings-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2005-08-27 Roland McGrath <roland@redhat.com> + + * addrscopes.c (handle_address): Apply bias to PC addresses. + + * run-funcscopes.sh: New file. + * testfile25.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2005-08-26 Roland McGrath <roland@redhat.com> + + * addrscopes.c (dwarf_diename_integrate): Removed. + (print_vars, handle_address): Use plain dwarf_diename. + +2005-08-25 Roland McGrath <roland@redhat.com> + + * funcscopes.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (funcscopes_LDADD): New variable. + + * run-addrscopes.sh: Add another case. + * testfile24.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + + * addrscopes.c (handle_address): Take new argument IGNORE_INLINES, + pass it to dwarf_getscopes. + (main): Pass it, true when '=' follows an address. + +2005-08-24 Roland McGrath <roland@redhat.com> + + * line2addr.c (print_address): Omit () for DSOs. + +2005-08-24 Ulrich Drepper <drepper@redhat.com> + + * run-line2addr.sh: Remove testfile23 in the end. + + * Makefile.am [BUILD_STATIC] (libdw): Add $(libelf) and $(libebl). + [MUDFLAP] (AM_LDFLAGS): Define to find libebl modules. + +2005-08-22 Roland McGrath <roland@redhat.com> + + * run-line2addr.sh: Add a case. + * testfile23.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2005-08-18 Roland McGrath <roland@redhat.com> + + * run-addrscopes.sh: New file. + * testfile22.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + + * addrscopes.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (addrscopes_LDADD): New variable. + +2005-08-15 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh: Don't run test if the file doesn't exist. + +2005-08-15 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c (print_instance, print_inline): New functions. + (print_func): Call print_inline. + (options, parse_opt): Grok -i/--inlines. + +2005-08-07 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c: Print function details only if -f flag is given. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh: New file. + * Makefile.am (TESTS): Add run-elflint-self.sh. + (EXTRA_DIST): Likewise. + + * Makefile.am: Link with statis libs if BUILD_STATIC. + (dwflmodtest_LDADD): Also link with -ldl. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add -ldl to asm_tst[1-9]_LDASS. + * asm-tst1.c: Adjust for new asm_begin interface. Open backend + library first. + * asm-tst2.c: Likewise. + * asm-tst3.c: Likewise. + * asm-tst4.c: Likewise. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * asm-tst7.c: Likewise. + * asm-tst8.c: Likewise. + * asm-tst9.c: Likewise. + + * msg_tst.c: Add new error message. + +2005-07-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (dwflmodtest_LDADD): Add $(libebl). + +2005-06-01 Roland McGrath <roland@redhat.com> + + * line2addr.c: Rewritten using libdwfl. + * run-line2addr.sh: Update test for changed arguments. + * Makefile.am (INCLUDES): Add libdwfl source directory to path. + (libdwfl): New variable. + (line2addr_LDADD): Use it. + +2005-07-28 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c: New file, moved from ../libdwfl/ptest.c to here. + * Makefile.am (noinst_PROGRAMS): Add dwflmodtest. + (dwflmodtest_LDADD): New variable. + (INCLUDES): Add -I$(top_srcdir)/libdwfl here. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * testfile18.bz2: New file. + * run-elflint-test.sh: New file. + * Makefile.am (TESTS): Add run-elflint-test.sh. + (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2. + +2005-05-24 Ulrich Drepper <drepper@redhat.com> + + * get-files.c (main): Use correct format specifier. + +2005-05-21 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add -Wextra to CFLAGS. + * get-files.c: Remove warning this produced. + * get-pubnames.c: Likewise. + * newfile.c: Likewise. + * newscn.c: Likewise. + * scnnames.c: Likewise. + * showptable.c: Likewise. + * test-nlist.c: Likewise. + * update1.c: Likewise. + * update2.c: Likewise. + * update3.c: Likewise. + * update4.c: Likewise. + +2005-05-08 Ulrich Drepper <drepper@redhat.com> + + * run-line2addr.sh: Remove testfile14 at the end. + + * run-strip-test.sh: Remove debuginfo test input file as well. + + * Makefile.am (EXTRA_DIST): Newly added files incorrectly used + .bz, not .bz2. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * run-strip-test.sh: Use variables for test file names. + Optionally produce separate debug file and check it. + * run-strip-test2.sh: Use run-strip-test.sh via ., no duplication. + * run-strip-test3.sh: Likewise. + * run-strip-test4.sh: New file. + * run-strip-test5.sh: New file. + * run-strip-test6.sh: New file. + * testfile15.bz: New file. + * testfile15.debug.bz: New file. + * testfile16.bz: New file. + * testfile16.debug.bz: New file. + * testfile17.bz: New file. + * testfile17.debug.bz: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2005-04-25 Ulrich Drepper <drepper@redhat.com> + + * run-line2addr.sh: Also use testfile14. Adjust for correct + return of multiple matches. + * testfile14.bz2: New file. + * Makefile.am (EXTRA_DIST): Add testfile14.bz2. + + * show-abbrev.c (main): Adjust for dwarf_getabbrev interface change. + +2005-04-04 Roland McGrath <roland@redhat.com> + + * line2addr.c (main): Initialize LINES and NLINES before calling + dwarf_getsrc_file, and free LINES afterwards. + + * allfcts.c (main): Use size_t for CUHL. + +2005-04-04 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c: New file. + * run-line2addr.sh: New file. + * Makefile.am: Add rules to build, run, and distribute new code. + +2005-04-02 Ulrich Drepper <drepper@redhat.com> + + * allfcts.c: New file. + * run-allfcts.sh: New file. + * Makefile.am: Add rules to build, run, and distribute new code. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap. Link all test + programs with -lmudflap. + 2004-09-25 Ulrich Drepper <drepper@redhat.com> * asm-tst4.c (main): Add LD_LIBRARY_PATH to elflint invocation. diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 14b0e335..00000000 --- a/tests/Makefile +++ /dev/null @@ -1,794 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# tests/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - -SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c ecp.c get-aranges.c get-files.c get-lines.c get-pubnames.c hash.c msg_tst.c newfile.c newscn.c saridx.c scnnames.c sectiondump.c show-abbrev.c show-die-info.c showptable.c test-nlist.c update1.c update2.c update3.c update4.c - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/elfutils -pkglibdir = $(libdir)/elfutils -pkgincludedir = $(includedir)/elfutils -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \ - newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \ - sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \ - update2$(EXEEXT) update3$(EXEEXT) update4$(EXEEXT) \ - test-nlist$(EXEEXT) show-die-info$(EXEEXT) get-files$(EXEEXT) \ - get-lines$(EXEEXT) get-pubnames$(EXEEXT) get-aranges$(EXEEXT) \ - show-abbrev$(EXEEXT) hash$(EXEEXT) asm-tst1$(EXEEXT) \ - asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) asm-tst4$(EXEEXT) \ - asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) asm-tst7$(EXEEXT) \ - asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) msg_tst$(EXEEXT) \ - newscn$(EXEEXT) ecp$(EXEEXT) -subdir = tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -arextract_SOURCES = arextract.c -arextract_OBJECTS = arextract.$(OBJEXT) -am__DEPENDENCIES_1 = ../libelf/libelf.so -#am__DEPENDENCIES_1 = ../libelf/libelf.a -arextract_DEPENDENCIES = $(am__DEPENDENCIES_1) -arsymtest_SOURCES = arsymtest.c -arsymtest_OBJECTS = arsymtest.$(OBJEXT) -arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_1) -asm_tst1_SOURCES = asm-tst1.c -asm_tst1_OBJECTS = asm-tst1.$(OBJEXT) -am__DEPENDENCIES_2 = ../libasm/libasm.so -#am__DEPENDENCIES_2 = ../libasm/libasm.a -am__DEPENDENCIES_3 = ../libebl/libebl.a -asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst2_SOURCES = asm-tst2.c -asm_tst2_OBJECTS = asm-tst2.$(OBJEXT) -asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst3_SOURCES = asm-tst3.c -asm_tst3_OBJECTS = asm-tst3.$(OBJEXT) -asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst4_SOURCES = asm-tst4.c -asm_tst4_OBJECTS = asm-tst4.$(OBJEXT) -asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst5_SOURCES = asm-tst5.c -asm_tst5_OBJECTS = asm-tst5.$(OBJEXT) -asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst6_SOURCES = asm-tst6.c -asm_tst6_OBJECTS = asm-tst6.$(OBJEXT) -asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst7_SOURCES = asm-tst7.c -asm_tst7_OBJECTS = asm-tst7.$(OBJEXT) -asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst8_SOURCES = asm-tst8.c -asm_tst8_OBJECTS = asm-tst8.$(OBJEXT) -asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -asm_tst9_SOURCES = asm-tst9.c -asm_tst9_OBJECTS = asm-tst9.$(OBJEXT) -asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -ecp_SOURCES = ecp.c -ecp_OBJECTS = ecp.$(OBJEXT) -ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) -get_aranges_SOURCES = get-aranges.c -get_aranges_OBJECTS = get-aranges.$(OBJEXT) -am__DEPENDENCIES_4 = ../libdw/libdw.so -#am__DEPENDENCIES_4 = ../libdw/libdw.a -get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) -get_files_SOURCES = get-files.c -get_files_OBJECTS = get-files.$(OBJEXT) -get_files_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) -get_lines_SOURCES = get-lines.c -get_lines_OBJECTS = get-lines.$(OBJEXT) -get_lines_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) -get_pubnames_SOURCES = get-pubnames.c -get_pubnames_OBJECTS = get-pubnames.$(OBJEXT) -get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_4) \ - $(am__DEPENDENCIES_1) -hash_SOURCES = hash.c -hash_OBJECTS = hash.$(OBJEXT) -hash_DEPENDENCIES = $(am__DEPENDENCIES_1) -msg_tst_SOURCES = msg_tst.c -msg_tst_OBJECTS = msg_tst.$(OBJEXT) -msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_1) -newfile_SOURCES = newfile.c -newfile_OBJECTS = newfile.$(OBJEXT) -newfile_DEPENDENCIES = $(am__DEPENDENCIES_1) -newscn_SOURCES = newscn.c -newscn_OBJECTS = newscn.$(OBJEXT) -newscn_DEPENDENCIES = $(am__DEPENDENCIES_1) -saridx_SOURCES = saridx.c -saridx_OBJECTS = saridx.$(OBJEXT) -saridx_DEPENDENCIES = $(am__DEPENDENCIES_1) -scnnames_SOURCES = scnnames.c -scnnames_OBJECTS = scnnames.$(OBJEXT) -scnnames_DEPENDENCIES = $(am__DEPENDENCIES_1) -sectiondump_SOURCES = sectiondump.c -sectiondump_OBJECTS = sectiondump.$(OBJEXT) -sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_1) -show_abbrev_SOURCES = show-abbrev.c -show_abbrev_OBJECTS = show-abbrev.$(OBJEXT) -show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) -show_die_info_SOURCES = show-die-info.c -show_die_info_OBJECTS = show-die-info.$(OBJEXT) -show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_4) \ - $(am__DEPENDENCIES_1) -showptable_SOURCES = showptable.c -showptable_OBJECTS = showptable.$(OBJEXT) -showptable_DEPENDENCIES = $(am__DEPENDENCIES_1) -test_nlist_SOURCES = test-nlist.c -test_nlist_OBJECTS = test-nlist.$(OBJEXT) -test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_1) -update1_SOURCES = update1.c -update1_OBJECTS = update1.$(OBJEXT) -update1_DEPENDENCIES = $(am__DEPENDENCIES_1) -update2_SOURCES = update2.c -update2_OBJECTS = update2.$(OBJEXT) -update2_DEPENDENCIES = $(am__DEPENDENCIES_1) -update3_SOURCES = update3.c -update3_OBJECTS = update3.$(OBJEXT) -update3_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) -update4_SOURCES = update4.c -update4_OBJECTS = update4.$(OBJEXT) -update4_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c \ - asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c \ - asm-tst9.c ecp.c get-aranges.c get-files.c get-lines.c \ - get-pubnames.c hash.c msg_tst.c newfile.c newscn.c saridx.c \ - scnnames.c sectiondump.c show-abbrev.c show-die-info.c \ - showptable.c test-nlist.c update1.c update2.c update3.c \ - update4.c -DIST_SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c \ - asm-tst3.c asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c \ - asm-tst8.c asm-tst9.c ecp.c get-aranges.c get-files.c \ - get-lines.c get-pubnames.c hash.c msg_tst.c newfile.c newscn.c \ - saridx.c scnnames.c sectiondump.c show-abbrev.c \ - show-die-info.c showptable.c test-nlist.c update1.c update2.c \ - update3.c update4.c -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run tar -AUTOCONF = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoconf -AUTOHEADER = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run autoheader -AUTOMAKE = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run automake-1.9 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -DATADIRNAME = ${prefix}/share -DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -GMSGFMT = /usr/bin/msgfmt -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTLLIBS = -LDFLAGS = -LEX = flex -LEXLIB = -lfl -LEX_OUTPUT_ROOT = lex.yy -LIBICONV = -liconv -LIBINTL = -LIBOBJS = -LIBS = -LOCALEDIR = ${prefix}/share -LTLIBICONV = -liconv -LTLIBINTL = -LTLIBOBJS = -MAKEINFO = ${SHELL} /work/elfutils/stock/elfutils-0.97/config/missing --run makeinfo -MKINSTALLDIRS = config/mkinstalldirs -MSGFMT = /usr/bin/msgfmt -MSGMERGE = /usr/bin/msgmerge -MUDFLAP_FALSE = -MUDFLAP_TRUE = # -NATIVE_LD_FALSE = -NATIVE_LD_TRUE = # -OBJEXT = o -PACKAGE = elfutils -PACKAGE_BUGREPORT = http://bugzilla.redhat.com/bugzilla/ -PACKAGE_NAME = Red Hat elfutils -PACKAGE_STRING = Red Hat elfutils 0.97 -PACKAGE_TARNAME = elfutils -PACKAGE_VERSION = 0.97 -PATH_SEPARATOR = : -POSUB = po -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -STRIP = -USE_NLS = yes -VERSION = 0.97 -XGETTEXT = /usr/bin/xgettext -YACC = bison -y -ac_ct_CC = gcc -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -base_cpu = none -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /work/elfutils/stock/elfutils-0.97/config/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /work/elfutils/google/linux-install-elfutils-0.97/ -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -AM_CFLAGS = -Wall -Werror -std=gnu99 -AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf -INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ - -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ - -I$(top_srcdir)/lib -I.. - -# get-ciefde -TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - update1 update2 update3 update4 \ - run-show-die-info.sh run-get-files.sh run-get-lines.sh \ - run-get-pubnames.sh run-get-aranges.sh \ - run-show-abbrev.sh hash asm-tst1 asm-tst2 \ - asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ - msg_tst newscn run-strip-test.sh run-strip-test2.sh \ - run-strip-test3.sh run-ecp-test.sh run-ecp-test2.sh - -# run-show-ciefde.sh -EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ - run-show-die-info.sh run-get-files.sh run-get-lines.sh \ - run-get-pubnames.sh run-get-aranges.sh \ - run-show-ciefde.sh run-show-abbrev.sh run-strip-test.sh \ - run-strip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ - testfile.bz2 testfile2.bz2 testfile3.bz2 testfile4.bz2 \ - testfile5.bz2 testfile6.bz2 testfile7.bz2 testfile8.bz2 \ - testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \ - testfile13.bz2 run-strip-test3.sh - -libdw = ../libdw/libdw.so -#libdw = ../libdw/libdw.a -libelf = ../libelf/libelf.so -#libelf = ../libelf/libelf.a -libasm = ../libasm/libasm.so -#libasm = ../libasm/libasm.a -libebl = ../libebl/libebl.a -arextract_LDADD = $(libelf) -arsymtest_LDADD = $(libelf) -newfile_LDADD = $(libelf) -saridx_LDADD = $(libelf) -scnnames_LDADD = $(libelf) -sectiondump_LDADD = $(libelf) -showptable_LDADD = $(libelf) -hash_LDADD = $(libelf) -test_nlist_LDADD = $(libelf) -msg_tst_LDADD = $(libelf) -newscn_LDADD = $(libelf) -ecp_LDADD = $(libelf) -update1_LDADD = $(libelf) -update2_LDADD = $(libelf) -update3_LDADD = $(libebl) $(libelf) -update4_LDADD = $(libebl) $(libelf) -show_die_info_LDADD = $(libdw) $(libelf) -get_pubnames_LDADD = $(libdw) $(libelf) -show_abbrev_LDADD = $(libdw) $(libelf) -get_lines_LDADD = $(libdw) $(libelf) -get_files_LDADD = $(libdw) $(libelf) -get_aranges_LDADD = $(libdw) $(libelf) -#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) -asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) -CLEANFILES = xxx -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits tests/Makefile -.PRECIOUS: 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__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - 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 - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -arextract$(EXEEXT): $(arextract_OBJECTS) $(arextract_DEPENDENCIES) - @rm -f arextract$(EXEEXT) - $(LINK) $(arextract_LDFLAGS) $(arextract_OBJECTS) $(arextract_LDADD) $(LIBS) -arsymtest$(EXEEXT): $(arsymtest_OBJECTS) $(arsymtest_DEPENDENCIES) - @rm -f arsymtest$(EXEEXT) - $(LINK) $(arsymtest_LDFLAGS) $(arsymtest_OBJECTS) $(arsymtest_LDADD) $(LIBS) -asm-tst1$(EXEEXT): $(asm_tst1_OBJECTS) $(asm_tst1_DEPENDENCIES) - @rm -f asm-tst1$(EXEEXT) - $(LINK) $(asm_tst1_LDFLAGS) $(asm_tst1_OBJECTS) $(asm_tst1_LDADD) $(LIBS) -asm-tst2$(EXEEXT): $(asm_tst2_OBJECTS) $(asm_tst2_DEPENDENCIES) - @rm -f asm-tst2$(EXEEXT) - $(LINK) $(asm_tst2_LDFLAGS) $(asm_tst2_OBJECTS) $(asm_tst2_LDADD) $(LIBS) -asm-tst3$(EXEEXT): $(asm_tst3_OBJECTS) $(asm_tst3_DEPENDENCIES) - @rm -f asm-tst3$(EXEEXT) - $(LINK) $(asm_tst3_LDFLAGS) $(asm_tst3_OBJECTS) $(asm_tst3_LDADD) $(LIBS) -asm-tst4$(EXEEXT): $(asm_tst4_OBJECTS) $(asm_tst4_DEPENDENCIES) - @rm -f asm-tst4$(EXEEXT) - $(LINK) $(asm_tst4_LDFLAGS) $(asm_tst4_OBJECTS) $(asm_tst4_LDADD) $(LIBS) -asm-tst5$(EXEEXT): $(asm_tst5_OBJECTS) $(asm_tst5_DEPENDENCIES) - @rm -f asm-tst5$(EXEEXT) - $(LINK) $(asm_tst5_LDFLAGS) $(asm_tst5_OBJECTS) $(asm_tst5_LDADD) $(LIBS) -asm-tst6$(EXEEXT): $(asm_tst6_OBJECTS) $(asm_tst6_DEPENDENCIES) - @rm -f asm-tst6$(EXEEXT) - $(LINK) $(asm_tst6_LDFLAGS) $(asm_tst6_OBJECTS) $(asm_tst6_LDADD) $(LIBS) -asm-tst7$(EXEEXT): $(asm_tst7_OBJECTS) $(asm_tst7_DEPENDENCIES) - @rm -f asm-tst7$(EXEEXT) - $(LINK) $(asm_tst7_LDFLAGS) $(asm_tst7_OBJECTS) $(asm_tst7_LDADD) $(LIBS) -asm-tst8$(EXEEXT): $(asm_tst8_OBJECTS) $(asm_tst8_DEPENDENCIES) - @rm -f asm-tst8$(EXEEXT) - $(LINK) $(asm_tst8_LDFLAGS) $(asm_tst8_OBJECTS) $(asm_tst8_LDADD) $(LIBS) -asm-tst9$(EXEEXT): $(asm_tst9_OBJECTS) $(asm_tst9_DEPENDENCIES) - @rm -f asm-tst9$(EXEEXT) - $(LINK) $(asm_tst9_LDFLAGS) $(asm_tst9_OBJECTS) $(asm_tst9_LDADD) $(LIBS) -ecp$(EXEEXT): $(ecp_OBJECTS) $(ecp_DEPENDENCIES) - @rm -f ecp$(EXEEXT) - $(LINK) $(ecp_LDFLAGS) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS) -get-aranges$(EXEEXT): $(get_aranges_OBJECTS) $(get_aranges_DEPENDENCIES) - @rm -f get-aranges$(EXEEXT) - $(LINK) $(get_aranges_LDFLAGS) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS) -get-files$(EXEEXT): $(get_files_OBJECTS) $(get_files_DEPENDENCIES) - @rm -f get-files$(EXEEXT) - $(LINK) $(get_files_LDFLAGS) $(get_files_OBJECTS) $(get_files_LDADD) $(LIBS) -get-lines$(EXEEXT): $(get_lines_OBJECTS) $(get_lines_DEPENDENCIES) - @rm -f get-lines$(EXEEXT) - $(LINK) $(get_lines_LDFLAGS) $(get_lines_OBJECTS) $(get_lines_LDADD) $(LIBS) -get-pubnames$(EXEEXT): $(get_pubnames_OBJECTS) $(get_pubnames_DEPENDENCIES) - @rm -f get-pubnames$(EXEEXT) - $(LINK) $(get_pubnames_LDFLAGS) $(get_pubnames_OBJECTS) $(get_pubnames_LDADD) $(LIBS) -hash$(EXEEXT): $(hash_OBJECTS) $(hash_DEPENDENCIES) - @rm -f hash$(EXEEXT) - $(LINK) $(hash_LDFLAGS) $(hash_OBJECTS) $(hash_LDADD) $(LIBS) -msg_tst$(EXEEXT): $(msg_tst_OBJECTS) $(msg_tst_DEPENDENCIES) - @rm -f msg_tst$(EXEEXT) - $(LINK) $(msg_tst_LDFLAGS) $(msg_tst_OBJECTS) $(msg_tst_LDADD) $(LIBS) -newfile$(EXEEXT): $(newfile_OBJECTS) $(newfile_DEPENDENCIES) - @rm -f newfile$(EXEEXT) - $(LINK) $(newfile_LDFLAGS) $(newfile_OBJECTS) $(newfile_LDADD) $(LIBS) -newscn$(EXEEXT): $(newscn_OBJECTS) $(newscn_DEPENDENCIES) - @rm -f newscn$(EXEEXT) - $(LINK) $(newscn_LDFLAGS) $(newscn_OBJECTS) $(newscn_LDADD) $(LIBS) -saridx$(EXEEXT): $(saridx_OBJECTS) $(saridx_DEPENDENCIES) - @rm -f saridx$(EXEEXT) - $(LINK) $(saridx_LDFLAGS) $(saridx_OBJECTS) $(saridx_LDADD) $(LIBS) -scnnames$(EXEEXT): $(scnnames_OBJECTS) $(scnnames_DEPENDENCIES) - @rm -f scnnames$(EXEEXT) - $(LINK) $(scnnames_LDFLAGS) $(scnnames_OBJECTS) $(scnnames_LDADD) $(LIBS) -sectiondump$(EXEEXT): $(sectiondump_OBJECTS) $(sectiondump_DEPENDENCIES) - @rm -f sectiondump$(EXEEXT) - $(LINK) $(sectiondump_LDFLAGS) $(sectiondump_OBJECTS) $(sectiondump_LDADD) $(LIBS) -show-abbrev$(EXEEXT): $(show_abbrev_OBJECTS) $(show_abbrev_DEPENDENCIES) - @rm -f show-abbrev$(EXEEXT) - $(LINK) $(show_abbrev_LDFLAGS) $(show_abbrev_OBJECTS) $(show_abbrev_LDADD) $(LIBS) -show-die-info$(EXEEXT): $(show_die_info_OBJECTS) $(show_die_info_DEPENDENCIES) - @rm -f show-die-info$(EXEEXT) - $(LINK) $(show_die_info_LDFLAGS) $(show_die_info_OBJECTS) $(show_die_info_LDADD) $(LIBS) -showptable$(EXEEXT): $(showptable_OBJECTS) $(showptable_DEPENDENCIES) - @rm -f showptable$(EXEEXT) - $(LINK) $(showptable_LDFLAGS) $(showptable_OBJECTS) $(showptable_LDADD) $(LIBS) -test-nlist$(EXEEXT): $(test_nlist_OBJECTS) $(test_nlist_DEPENDENCIES) - @rm -f test-nlist$(EXEEXT) - $(LINK) $(test_nlist_LDFLAGS) $(test_nlist_OBJECTS) $(test_nlist_LDADD) $(LIBS) -update1$(EXEEXT): $(update1_OBJECTS) $(update1_DEPENDENCIES) - @rm -f update1$(EXEEXT) - $(LINK) $(update1_LDFLAGS) $(update1_OBJECTS) $(update1_LDADD) $(LIBS) -update2$(EXEEXT): $(update2_OBJECTS) $(update2_DEPENDENCIES) - @rm -f update2$(EXEEXT) - $(LINK) $(update2_LDFLAGS) $(update2_OBJECTS) $(update2_LDADD) $(LIBS) -update3$(EXEEXT): $(update3_OBJECTS) $(update3_DEPENDENCIES) - @rm -f update3$(EXEEXT) - $(LINK) $(update3_LDFLAGS) $(update3_OBJECTS) $(update3_LDADD) $(LIBS) -update4$(EXEEXT): $(update4_OBJECTS) $(update4_DEPENDENCIES) - @rm -f update4$(EXEEXT) - $(LINK) $(update4_LDFLAGS) $(update4_OBJECTS) $(update4_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/arextract.Po -include ./$(DEPDIR)/arsymtest.Po -include ./$(DEPDIR)/asm-tst1.Po -include ./$(DEPDIR)/asm-tst2.Po -include ./$(DEPDIR)/asm-tst3.Po -include ./$(DEPDIR)/asm-tst4.Po -include ./$(DEPDIR)/asm-tst5.Po -include ./$(DEPDIR)/asm-tst6.Po -include ./$(DEPDIR)/asm-tst7.Po -include ./$(DEPDIR)/asm-tst8.Po -include ./$(DEPDIR)/asm-tst9.Po -include ./$(DEPDIR)/ecp.Po -include ./$(DEPDIR)/get-aranges.Po -include ./$(DEPDIR)/get-files.Po -include ./$(DEPDIR)/get-lines.Po -include ./$(DEPDIR)/get-pubnames.Po -include ./$(DEPDIR)/hash.Po -include ./$(DEPDIR)/msg_tst.Po -include ./$(DEPDIR)/newfile.Po -include ./$(DEPDIR)/newscn.Po -include ./$(DEPDIR)/saridx.Po -include ./$(DEPDIR)/scnnames.Po -include ./$(DEPDIR)/sectiondump.Po -include ./$(DEPDIR)/show-abbrev.Po -include ./$(DEPDIR)/show-die-info.Po -include ./$(DEPDIR)/showptable.Po -include ./$(DEPDIR)/test-nlist.Po -include ./$(DEPDIR)/update1.Po -include ./$(DEPDIR)/update2.Po -include ./$(DEPDIR)/update3.Po -include ./$(DEPDIR)/update4.Po - -.c.o: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c $< - -.c.obj: - if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-generic clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# 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/tests/Makefile.am b/tests/Makefile.am index 1e4f9a8d..b533521c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,46 +1,105 @@ ## Process this file with automake to create Makefile.in -## Configure input file for elfutils. ## -## Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc. +## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. +## This file is part of Red Hat elfutils. ## -## This program is Open Source software; you can redistribute it and/or -## modify it under the terms of the Open Software License version 1.0 as -## published by the Open Source Initiative. +## Red Hat elfutils 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; version 2 of the License. ## -## You should have received a copy of the Open Software License along -## with this program; if not, you may obtain a copy of the Open Software -## License version 1.0 from http://www.opensource.org/licenses/osl.php or -## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -## 3001 King Ranch Road, Ukiah, CA 95482. +## Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. ## DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE -AM_CFLAGS = -Wall -Werror -std=gnu99 -if !MUDFLAP -AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf +if MUDFLAP +AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 -fmudflap\ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) +BUILD_RPATH = \$$ORIGIN/../backends +else +AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) +BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf endif + +AM_LDFLAGS = + +if !STANDALONE INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/libdwfl \ -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ -I$(top_srcdir)/lib -I.. +AM_LDFLAGS += -Wl,-rpath-link,../libasm:../libdw:../libelf +endif !STANDALONE + +if TESTS_RPATH +AM_LDFLAGS += -Wl,-rpath,$(BUILT_RPATH) +tests_rpath = yes +else +tests_rpath = no +endif noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ showptable update1 update2 update3 update4 test-nlist \ show-die-info get-files get-lines get-pubnames \ - get-aranges \ - show-abbrev hash asm-tst1 asm-tst2 asm-tst3 \ - asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ - msg_tst newscn ecp + get-aranges allfcts line2addr addrscopes funcscopes \ + show-abbrev hash newscn ecp dwflmodtest \ + find-prologues funcretval allregs rdwrmmap \ + dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \ + dwfl-addr-sect dwfl-bug-report early-offscn \ + dwfl-bug-getmodules # get-ciefde +asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ + asm-tst6 asm-tst7 asm-tst8 asm-tst9 TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ update1 update2 update3 update4 \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ - run-get-pubnames.sh run-get-aranges.sh \ - run-show-abbrev.sh hash asm-tst1 asm-tst2 \ - asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ - msg_tst newscn run-strip-test.sh run-strip-test2.sh \ - run-strip-test3.sh run-ecp-test.sh run-ecp-test2.sh + run-get-pubnames.sh run-get-aranges.sh run-allfcts.sh \ + run-show-abbrev.sh run-line2addr.sh hash \ + newscn run-strip-test.sh run-strip-test2.sh \ + run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \ + run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.sh \ + run-ecp-test.sh run-ecp-test2.sh \ + run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ + run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-native-test.sh run-bug1-test.sh \ + dwfl-bug-addr-overflow run-addrname-test.sh \ + dwfl-bug-fd-leak dwfl-bug-report \ + run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ + run-disasm-x86.sh run-disasm-x86-64.sh \ + run-early-offscn.sh # run-show-ciefde.sh +if !STANDALONE +noinst_PROGRAMS += msg_tst sha1-tst +TESTS += msg_tst sha1-tst +endif + +if HAVE_LIBASM +noinst_PROGRAMS += $(asm_TESTS) +TESTS += $(asm_TESTS) +endif + + EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ run-get-pubnames.sh run-get-aranges.sh \ @@ -49,10 +108,70 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile.bz2 testfile2.bz2 testfile3.bz2 testfile4.bz2 \ testfile5.bz2 testfile6.bz2 testfile7.bz2 testfile8.bz2 \ testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \ - testfile13.bz2 run-strip-test3.sh + testfile13.bz2 run-strip-test3.sh run-allfcts.sh \ + run-line2addr.sh run-elflint-test.sh testfile14.bz2 \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.sh \ + run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ + run-ranlib-test3.sh run-ranlib-test4.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-native-test.sh \ + run-addrname-test.sh run-dwfl-bug-offline-rel.sh \ + run-dwfl-addr-sect.sh run-early-offscn.sh \ + testfile15.bz2 testfile15.debug.bz2 \ + testfile16.bz2 testfile16.debug.bz2 \ + testfile17.bz2 testfile17.debug.bz2 \ + testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \ + testfile20.bz2 testfile20.index.bz2 \ + testfile21.bz2 testfile21.index.bz2 \ + testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \ + testfile26.bz2 testfile27.bz2 \ + coverage.sh test-subr.sh test-wrapper.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \ + testfile29.bz2 testfile29.rdwr.bz2 \ + testfile30.bz2 testfile31.bz2 testfile32.bz2 testfile33.bz2 \ + testfile34.bz2 testfile35.bz2 testfile35.debug.bz2 \ + testfile36.bz2 testfile36.debug.bz2 \ + testfile37.bz2 testfile37.debug.bz2 \ + testfile38.bz2 testfile39.bz2 testfile40.bz2 testfile40.debug.bz2 \ + testfile41.bz2 testfile42.bz2 testfile43.bz2 \ + testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ + testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ + testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ + testfile49.bz2 + +installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ + bindir=$(DESTDIR)$(bindir) \ + $(srcdir)/test-wrapper.sh \ + installed $(tests_rpath) \ + $(program_transform_name) +if STANDALONE +TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) +else !STANDALONE +TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \ + ../libdw:../backends:../libelf:../libasm + +installcheck-local: + $(MAKE) $(AM_MAKEFLAGS) \ + TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS +endif !STANDALONE if MUDFLAP -libdw = ../libdw/libdw.a +static_build=yes +libmudflap = -lmudflap +endif + +if STANDALONE +libdw = -ldw +libelf = -lelf +libasm = -lasm +libebl = -lebl +else !STANDALONE +if BUILD_STATIC +libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl libelf = ../libelf/libelf.a libasm = ../libasm/libasm.a else @@ -61,38 +180,65 @@ libelf = ../libelf/libelf.so libasm = ../libasm/libasm.so endif libebl = ../libebl/libebl.a +libeu = ../lib/libeu.a +endif !STANDALONE + +arextract_LDADD = $(libelf) $(libmudflap) +arsymtest_LDADD = $(libelf) $(libmudflap) +newfile_LDADD = $(libelf) $(libmudflap) +saridx_LDADD = $(libelf) $(libmudflap) +scnnames_LDADD = $(libelf) $(libmudflap) +sectiondump_LDADD = $(libelf) $(libmudflap) +showptable_LDADD = $(libelf) $(libmudflap) +hash_LDADD = $(libelf) $(libmudflap) +test_nlist_LDADD = $(libelf) $(libmudflap) +msg_tst_LDADD = $(libelf) $(libmudflap) +newscn_LDADD = $(libelf) $(libmudflap) +early_offscn_LDADD = $(libelf) $(libmudflap) +ecp_LDADD = $(libelf) $(libmudflap) +update1_LDADD = $(libelf) $(libmudflap) +update2_LDADD = $(libelf) $(libmudflap) +update3_LDADD = $(libebl) $(libelf) $(libmudflap) +update4_LDADD = $(libebl) $(libelf) $(libmudflap) +show_die_info_LDADD = $(libdw) $(libelf) $(libmudflap) +get_pubnames_LDADD = $(libdw) $(libelf) $(libmudflap) +show_abbrev_LDADD = $(libdw) $(libelf) $(libmudflap) +get_lines_LDADD = $(libdw) $(libelf) $(libmudflap) +get_files_LDADD = $(libdw) $(libelf) $(libmudflap) +get_aranges_LDADD = $(libdw) $(libelf) $(libmudflap) +allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) +line2addr_no_Wformat = yes +line2addr_LDADD = $(libdw) $(libmudflap) +addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) +funcretval_LDADD = $(libdw) $(libmudflap) +allregs_LDADD = $(libdw) $(libmudflap) +find_prologues_LDADD = $(libdw) $(libmudflap) +#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap) +asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +rdwrmmap_LDADD = $(libelf) +dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +arls_LDADD = $(libelf) $(libmudflap) +dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +sha1_tst_LDADD = $(libeu) $(libmudflap) -arextract_LDADD = $(libelf) -arsymtest_LDADD = $(libelf) -newfile_LDADD = $(libelf) -saridx_LDADD = $(libelf) -scnnames_LDADD = $(libelf) -sectiondump_LDADD = $(libelf) -showptable_LDADD = $(libelf) -hash_LDADD = $(libelf) -test_nlist_LDADD = $(libelf) -msg_tst_LDADD = $(libelf) -newscn_LDADD = $(libelf) -ecp_LDADD = $(libelf) -update1_LDADD = $(libelf) -update2_LDADD = $(libelf) -update3_LDADD = $(libebl) $(libelf) -update4_LDADD = $(libebl) $(libelf) -show_die_info_LDADD = $(libdw) $(libelf) -get_pubnames_LDADD = $(libdw) $(libelf) -show_abbrev_LDADD = $(libdw) $(libelf) -get_lines_LDADD = $(libdw) $(libelf) -get_files_LDADD = $(libdw) $(libelf) -get_aranges_LDADD = $(libdw) $(libelf) -#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) -asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) - -CLEANFILES = xxx +CLEANFILES = xxx *.gcno *.gcda *gconv + +if GCOV +check: check-am coverage +.PHONY: coverage +coverage: + -$(srcdir)/coverage.sh +endif diff --git a/tests/Makefile.in b/tests/Makefile.in index c5dd6529..47a1cb97 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -14,17 +14,11 @@ @SET_MAKE@ -SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c ecp.c get-aranges.c get-files.c get-lines.c get-pubnames.c hash.c msg_tst.c newfile.c newscn.c saridx.c scnnames.c sectiondump.c show-abbrev.c show-die-info.c showptable.c test-nlist.c update1.c update2.c update3.c update4.c - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,168 +32,289 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@STANDALONE_FALSE@am__append_1 = -Wl,-rpath-link,../libasm:../libdw:../libelf +@TESTS_RPATH_TRUE@am__append_2 = -Wl,-rpath,$(BUILT_RPATH) noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \ newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \ sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \ update2$(EXEEXT) update3$(EXEEXT) update4$(EXEEXT) \ test-nlist$(EXEEXT) show-die-info$(EXEEXT) get-files$(EXEEXT) \ get-lines$(EXEEXT) get-pubnames$(EXEEXT) get-aranges$(EXEEXT) \ - show-abbrev$(EXEEXT) hash$(EXEEXT) asm-tst1$(EXEEXT) \ - asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) asm-tst4$(EXEEXT) \ - asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) asm-tst7$(EXEEXT) \ - asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) msg_tst$(EXEEXT) \ - newscn$(EXEEXT) ecp$(EXEEXT) + allfcts$(EXEEXT) line2addr$(EXEEXT) addrscopes$(EXEEXT) \ + funcscopes$(EXEEXT) show-abbrev$(EXEEXT) hash$(EXEEXT) \ + newscn$(EXEEXT) ecp$(EXEEXT) dwflmodtest$(EXEEXT) \ + find-prologues$(EXEEXT) funcretval$(EXEEXT) allregs$(EXEEXT) \ + rdwrmmap$(EXEEXT) dwfl-bug-addr-overflow$(EXEEXT) \ + arls$(EXEEXT) dwfl-bug-fd-leak$(EXEEXT) \ + dwfl-addr-sect$(EXEEXT) dwfl-bug-report$(EXEEXT) \ + early-offscn$(EXEEXT) dwfl-bug-getmodules$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_3) +TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \ + test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \ + update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \ + run-get-files.sh run-get-lines.sh run-get-pubnames.sh \ + run-get-aranges.sh run-allfcts.sh run-show-abbrev.sh \ + run-line2addr.sh hash$(EXEEXT) newscn$(EXEEXT) \ + run-strip-test.sh run-strip-test2.sh run-strip-test3.sh \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh run-unstrip-test.sh \ + run-unstrip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ + run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ + run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-readelf-test1.sh \ + run-readelf-test2.sh run-readelf-test3.sh run-readelf-test4.sh \ + run-native-test.sh run-bug1-test.sh \ + dwfl-bug-addr-overflow$(EXEEXT) run-addrname-test.sh \ + dwfl-bug-fd-leak$(EXEEXT) dwfl-bug-report$(EXEEXT) \ + run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ + run-disasm-x86.sh run-disasm-x86-64.sh run-early-offscn.sh \ + $(am__EXEEXT_1) $(am__EXEEXT_3) +# run-show-ciefde.sh +@STANDALONE_FALSE@am__append_3 = msg_tst sha1-tst +@STANDALONE_FALSE@am__append_4 = msg_tst sha1-tst +@HAVE_LIBASM_TRUE@am__append_5 = $(asm_TESTS) +@HAVE_LIBASM_TRUE@am__append_6 = $(asm_TESTS) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +@STANDALONE_FALSE@am__EXEEXT_1 = msg_tst$(EXEEXT) sha1-tst$(EXEEXT) +am__EXEEXT_2 = asm-tst1$(EXEEXT) asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) \ + asm-tst4$(EXEEXT) asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) \ + asm-tst7$(EXEEXT) asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) +@HAVE_LIBASM_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) PROGRAMS = $(noinst_PROGRAMS) +addrscopes_SOURCES = addrscopes.c +addrscopes_OBJECTS = addrscopes.$(OBJEXT) +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_1 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libelf/libelf.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_1 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libelf/libelf.a +@STANDALONE_FALSE@am__DEPENDENCIES_2 = ../libebl/libebl.a +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_3 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libdw/libdw.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_3 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libdw/libdw.a \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_1) \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_2) +am__DEPENDENCIES_4 = +addrscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +allfcts_SOURCES = allfcts.c +allfcts_OBJECTS = allfcts.$(OBJEXT) +allfcts_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +allregs_SOURCES = allregs.c +allregs_OBJECTS = allregs.$(OBJEXT) +allregs_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) arextract_SOURCES = arextract.c arextract_OBJECTS = arextract.$(OBJEXT) -@MUDFLAP_FALSE@am__DEPENDENCIES_1 = ../libelf/libelf.so -@MUDFLAP_TRUE@am__DEPENDENCIES_1 = ../libelf/libelf.a -arextract_DEPENDENCIES = $(am__DEPENDENCIES_1) +arextract_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +arls_SOURCES = arls.c +arls_OBJECTS = arls.$(OBJEXT) +arls_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) arsymtest_SOURCES = arsymtest.c arsymtest_OBJECTS = arsymtest.$(OBJEXT) -arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_1) +arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst1_SOURCES = asm-tst1.c asm_tst1_OBJECTS = asm-tst1.$(OBJEXT) -@MUDFLAP_FALSE@am__DEPENDENCIES_2 = ../libasm/libasm.so -@MUDFLAP_TRUE@am__DEPENDENCIES_2 = ../libasm/libasm.a -am__DEPENDENCIES_3 = ../libebl/libebl.a -asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libasm/libasm.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libasm/libasm.a +asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst2_SOURCES = asm-tst2.c asm_tst2_OBJECTS = asm-tst2.$(OBJEXT) -asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst3_SOURCES = asm-tst3.c asm_tst3_OBJECTS = asm-tst3.$(OBJEXT) -asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst4_SOURCES = asm-tst4.c asm_tst4_OBJECTS = asm-tst4.$(OBJEXT) -asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst5_SOURCES = asm-tst5.c asm_tst5_OBJECTS = asm-tst5.$(OBJEXT) -asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst6_SOURCES = asm-tst6.c asm_tst6_OBJECTS = asm-tst6.$(OBJEXT) -asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst7_SOURCES = asm-tst7.c asm_tst7_OBJECTS = asm-tst7.$(OBJEXT) -asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst8_SOURCES = asm-tst8.c asm_tst8_OBJECTS = asm-tst8.$(OBJEXT) -asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) asm_tst9_SOURCES = asm-tst9.c asm_tst9_OBJECTS = asm-tst9.$(OBJEXT) -asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) +asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +dwfl_addr_sect_SOURCES = dwfl-addr-sect.c +dwfl_addr_sect_OBJECTS = dwfl-addr-sect.$(OBJEXT) +dwfl_addr_sect_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +dwfl_bug_addr_overflow_SOURCES = dwfl-bug-addr-overflow.c +dwfl_bug_addr_overflow_OBJECTS = dwfl-bug-addr-overflow.$(OBJEXT) +dwfl_bug_addr_overflow_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +dwfl_bug_fd_leak_SOURCES = dwfl-bug-fd-leak.c +dwfl_bug_fd_leak_OBJECTS = dwfl-bug-fd-leak.$(OBJEXT) +dwfl_bug_fd_leak_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +dwfl_bug_getmodules_SOURCES = dwfl-bug-getmodules.c +dwfl_bug_getmodules_OBJECTS = dwfl-bug-getmodules.$(OBJEXT) +dwfl_bug_getmodules_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +dwfl_bug_report_SOURCES = dwfl-bug-report.c +dwfl_bug_report_OBJECTS = dwfl-bug-report.$(OBJEXT) +dwfl_bug_report_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +dwflmodtest_SOURCES = dwflmodtest.c +dwflmodtest_OBJECTS = dwflmodtest.$(OBJEXT) +dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +early_offscn_SOURCES = early-offscn.c +early_offscn_OBJECTS = early-offscn.$(OBJEXT) +early_offscn_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) ecp_SOURCES = ecp.c ecp_OBJECTS = ecp.$(OBJEXT) -ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +find_prologues_SOURCES = find-prologues.c +find_prologues_OBJECTS = find-prologues.$(OBJEXT) +find_prologues_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_4) +funcretval_SOURCES = funcretval.c +funcretval_OBJECTS = funcretval.$(OBJEXT) +funcretval_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +funcscopes_SOURCES = funcscopes.c +funcscopes_OBJECTS = funcscopes.$(OBJEXT) +funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) get_aranges_SOURCES = get-aranges.c get_aranges_OBJECTS = get-aranges.$(OBJEXT) -@MUDFLAP_FALSE@am__DEPENDENCIES_4 = ../libdw/libdw.so -@MUDFLAP_TRUE@am__DEPENDENCIES_4 = ../libdw/libdw.a -get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) get_files_SOURCES = get-files.c get_files_OBJECTS = get-files.$(OBJEXT) -get_files_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +get_files_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) get_lines_SOURCES = get-lines.c get_lines_OBJECTS = get-lines.$(OBJEXT) -get_lines_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +get_lines_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) get_pubnames_SOURCES = get-pubnames.c get_pubnames_OBJECTS = get-pubnames.$(OBJEXT) -get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_4) \ - $(am__DEPENDENCIES_1) +get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) hash_SOURCES = hash.c hash_OBJECTS = hash.$(OBJEXT) -hash_DEPENDENCIES = $(am__DEPENDENCIES_1) +hash_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +line2addr_SOURCES = line2addr.c +line2addr_OBJECTS = line2addr.$(OBJEXT) +line2addr_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) msg_tst_SOURCES = msg_tst.c msg_tst_OBJECTS = msg_tst.$(OBJEXT) -msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_1) +msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) newfile_SOURCES = newfile.c newfile_OBJECTS = newfile.$(OBJEXT) -newfile_DEPENDENCIES = $(am__DEPENDENCIES_1) +newfile_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) newscn_SOURCES = newscn.c newscn_OBJECTS = newscn.$(OBJEXT) -newscn_DEPENDENCIES = $(am__DEPENDENCIES_1) +newscn_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +rdwrmmap_SOURCES = rdwrmmap.c +rdwrmmap_OBJECTS = rdwrmmap.$(OBJEXT) +rdwrmmap_DEPENDENCIES = $(am__DEPENDENCIES_1) saridx_SOURCES = saridx.c saridx_OBJECTS = saridx.$(OBJEXT) -saridx_DEPENDENCIES = $(am__DEPENDENCIES_1) +saridx_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) scnnames_SOURCES = scnnames.c scnnames_OBJECTS = scnnames.$(OBJEXT) -scnnames_DEPENDENCIES = $(am__DEPENDENCIES_1) +scnnames_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) sectiondump_SOURCES = sectiondump.c sectiondump_OBJECTS = sectiondump.$(OBJEXT) -sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_1) +sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +sha1_tst_SOURCES = sha1-tst.c +sha1_tst_OBJECTS = sha1-tst.$(OBJEXT) +sha1_tst_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_4) show_abbrev_SOURCES = show-abbrev.c show_abbrev_OBJECTS = show-abbrev.$(OBJEXT) -show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) show_die_info_SOURCES = show-die-info.c show_die_info_OBJECTS = show-die-info.$(OBJEXT) -show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_4) \ - $(am__DEPENDENCIES_1) +show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) showptable_SOURCES = showptable.c showptable_OBJECTS = showptable.$(OBJEXT) -showptable_DEPENDENCIES = $(am__DEPENDENCIES_1) +showptable_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) test_nlist_SOURCES = test-nlist.c test_nlist_OBJECTS = test-nlist.$(OBJEXT) -test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) update1_SOURCES = update1.c update1_OBJECTS = update1.$(OBJEXT) -update1_DEPENDENCIES = $(am__DEPENDENCIES_1) +update1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) update2_SOURCES = update2.c update2_OBJECTS = update2.$(OBJEXT) -update2_DEPENDENCIES = $(am__DEPENDENCIES_1) +update2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) update3_SOURCES = update3.c update3_OBJECTS = update3.$(OBJEXT) -update3_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) +update3_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) update4_SOURCES = update4.c update4_OBJECTS = update4.$(OBJEXT) -update4_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +update4_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_4) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c \ - asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c \ - asm-tst9.c ecp.c get-aranges.c get-files.c get-lines.c \ - get-pubnames.c hash.c msg_tst.c newfile.c newscn.c saridx.c \ - scnnames.c sectiondump.c show-abbrev.c show-die-info.c \ - showptable.c test-nlist.c update1.c update2.c update3.c \ - update4.c -DIST_SOURCES = arextract.c arsymtest.c asm-tst1.c asm-tst2.c \ - asm-tst3.c asm-tst4.c asm-tst5.c asm-tst6.c asm-tst7.c \ - asm-tst8.c asm-tst9.c ecp.c get-aranges.c get-files.c \ - get-lines.c get-pubnames.c hash.c msg_tst.c newfile.c newscn.c \ - saridx.c scnnames.c sectiondump.c show-abbrev.c \ - show-die-info.c showptable.c test-nlist.c update1.c update2.c \ - update3.c update4.c +SOURCES = addrscopes.c allfcts.c allregs.c arextract.c arls.c \ + arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \ + asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c \ + dwfl-addr-sect.c dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \ + dwfl-bug-getmodules.c dwfl-bug-report.c dwflmodtest.c \ + early-offscn.c ecp.c find-prologues.c funcretval.c \ + funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + rdwrmmap.c saridx.c scnnames.c sectiondump.c sha1-tst.c \ + show-abbrev.c show-die-info.c showptable.c test-nlist.c \ + update1.c update2.c update3.c update4.c +DIST_SOURCES = addrscopes.c allfcts.c allregs.c arextract.c arls.c \ + arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \ + asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c \ + dwfl-addr-sect.c dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \ + dwfl-bug-getmodules.c dwfl-bug-report.c dwflmodtest.c \ + early-offscn.c ecp.c find-prologues.c funcretval.c \ + funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + rdwrmmap.c saridx.c scnnames.c sectiondump.c sha1-tst.c \ + show-abbrev.c show-die-info.c showptable.c test-nlist.c \ + update1.c update2.c update3.c update4.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -208,43 +323,39 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEBUGPRED = @DEBUGPRED@ DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -253,7 +364,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -261,12 +371,14 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -279,45 +391,61 @@ 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@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ 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@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -AM_CFLAGS = -Wall -Werror -std=gnu99 -@MUDFLAP_FALSE@AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf -INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ - -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ - -I$(top_srcdir)/lib -I.. +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ +@MUDFLAP_FALSE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + +@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 -fmudflap\ +@MUDFLAP_TRUE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + +@MUDFLAP_TRUE@BUILD_RPATH = \$$ORIGIN/../backends +@MUDFLAP_FALSE@BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf +AM_LDFLAGS = $(am__append_1) $(am__append_2) +@STANDALONE_FALSE@INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ +@STANDALONE_FALSE@ -I$(top_srcdir)/libdwfl \ +@STANDALONE_FALSE@ -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ +@STANDALONE_FALSE@ -I$(top_srcdir)/lib -I.. +@TESTS_RPATH_FALSE@tests_rpath = no +@TESTS_RPATH_TRUE@tests_rpath = yes # get-ciefde -TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - update1 update2 update3 update4 \ - run-show-die-info.sh run-get-files.sh run-get-lines.sh \ - run-get-pubnames.sh run-get-aranges.sh \ - run-show-abbrev.sh hash asm-tst1 asm-tst2 \ - asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ - msg_tst newscn run-strip-test.sh run-strip-test2.sh \ - run-strip-test3.sh run-ecp-test.sh run-ecp-test2.sh +asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ + asm-tst6 asm-tst7 asm-tst8 asm-tst9 -# run-show-ciefde.sh EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ run-get-pubnames.sh run-get-aranges.sh \ @@ -326,53 +454,121 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile.bz2 testfile2.bz2 testfile3.bz2 testfile4.bz2 \ testfile5.bz2 testfile6.bz2 testfile7.bz2 testfile8.bz2 \ testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \ - testfile13.bz2 run-strip-test3.sh - -@MUDFLAP_FALSE@libdw = ../libdw/libdw.so -@MUDFLAP_TRUE@libdw = ../libdw/libdw.a -@MUDFLAP_FALSE@libelf = ../libelf/libelf.so -@MUDFLAP_TRUE@libelf = ../libelf/libelf.a -@MUDFLAP_FALSE@libasm = ../libasm/libasm.so -@MUDFLAP_TRUE@libasm = ../libasm/libasm.a -libebl = ../libebl/libebl.a -arextract_LDADD = $(libelf) -arsymtest_LDADD = $(libelf) -newfile_LDADD = $(libelf) -saridx_LDADD = $(libelf) -scnnames_LDADD = $(libelf) -sectiondump_LDADD = $(libelf) -showptable_LDADD = $(libelf) -hash_LDADD = $(libelf) -test_nlist_LDADD = $(libelf) -msg_tst_LDADD = $(libelf) -newscn_LDADD = $(libelf) -ecp_LDADD = $(libelf) -update1_LDADD = $(libelf) -update2_LDADD = $(libelf) -update3_LDADD = $(libebl) $(libelf) -update4_LDADD = $(libebl) $(libelf) -show_die_info_LDADD = $(libdw) $(libelf) -get_pubnames_LDADD = $(libdw) $(libelf) -show_abbrev_LDADD = $(libdw) $(libelf) -get_lines_LDADD = $(libdw) $(libelf) -get_files_LDADD = $(libdw) $(libelf) -get_aranges_LDADD = $(libdw) $(libelf) -#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) -asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) -asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) -CLEANFILES = xxx + testfile13.bz2 run-strip-test3.sh run-allfcts.sh \ + run-line2addr.sh run-elflint-test.sh testfile14.bz2 \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.sh \ + run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ + run-ranlib-test3.sh run-ranlib-test4.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-native-test.sh \ + run-addrname-test.sh run-dwfl-bug-offline-rel.sh \ + run-dwfl-addr-sect.sh run-early-offscn.sh \ + testfile15.bz2 testfile15.debug.bz2 \ + testfile16.bz2 testfile16.debug.bz2 \ + testfile17.bz2 testfile17.debug.bz2 \ + testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \ + testfile20.bz2 testfile20.index.bz2 \ + testfile21.bz2 testfile21.index.bz2 \ + testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \ + testfile26.bz2 testfile27.bz2 \ + coverage.sh test-subr.sh test-wrapper.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \ + testfile29.bz2 testfile29.rdwr.bz2 \ + testfile30.bz2 testfile31.bz2 testfile32.bz2 testfile33.bz2 \ + testfile34.bz2 testfile35.bz2 testfile35.debug.bz2 \ + testfile36.bz2 testfile36.debug.bz2 \ + testfile37.bz2 testfile37.debug.bz2 \ + testfile38.bz2 testfile39.bz2 testfile40.bz2 testfile40.debug.bz2 \ + testfile41.bz2 testfile42.bz2 testfile43.bz2 \ + testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ + testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ + testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ + testfile49.bz2 + +installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ + bindir=$(DESTDIR)$(bindir) \ + $(srcdir)/test-wrapper.sh \ + installed $(tests_rpath) \ + $(program_transform_name) + +@STANDALONE_FALSE@TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \ +@STANDALONE_FALSE@ ../libdw:../backends:../libelf:../libasm + +@STANDALONE_TRUE@TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) +@MUDFLAP_TRUE@static_build = yes +@MUDFLAP_TRUE@libmudflap = -lmudflap +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libdw = ../libdw/libdw.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +@STANDALONE_TRUE@libdw = -ldw +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libelf = ../libelf/libelf.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libelf = ../libelf/libelf.a +@STANDALONE_TRUE@libelf = -lelf +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libasm = ../libasm/libasm.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libasm = ../libasm/libasm.a +@STANDALONE_TRUE@libasm = -lasm +@STANDALONE_FALSE@libebl = ../libebl/libebl.a +@STANDALONE_TRUE@libebl = -lebl +@STANDALONE_FALSE@libeu = ../lib/libeu.a +arextract_LDADD = $(libelf) $(libmudflap) +arsymtest_LDADD = $(libelf) $(libmudflap) +newfile_LDADD = $(libelf) $(libmudflap) +saridx_LDADD = $(libelf) $(libmudflap) +scnnames_LDADD = $(libelf) $(libmudflap) +sectiondump_LDADD = $(libelf) $(libmudflap) +showptable_LDADD = $(libelf) $(libmudflap) +hash_LDADD = $(libelf) $(libmudflap) +test_nlist_LDADD = $(libelf) $(libmudflap) +msg_tst_LDADD = $(libelf) $(libmudflap) +newscn_LDADD = $(libelf) $(libmudflap) +early_offscn_LDADD = $(libelf) $(libmudflap) +ecp_LDADD = $(libelf) $(libmudflap) +update1_LDADD = $(libelf) $(libmudflap) +update2_LDADD = $(libelf) $(libmudflap) +update3_LDADD = $(libebl) $(libelf) $(libmudflap) +update4_LDADD = $(libebl) $(libelf) $(libmudflap) +show_die_info_LDADD = $(libdw) $(libelf) $(libmudflap) +get_pubnames_LDADD = $(libdw) $(libelf) $(libmudflap) +show_abbrev_LDADD = $(libdw) $(libelf) $(libmudflap) +get_lines_LDADD = $(libdw) $(libelf) $(libmudflap) +get_files_LDADD = $(libdw) $(libelf) $(libmudflap) +get_aranges_LDADD = $(libdw) $(libelf) $(libmudflap) +allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) +line2addr_no_Wformat = yes +line2addr_LDADD = $(libdw) $(libmudflap) +addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) +funcretval_LDADD = $(libdw) $(libmudflap) +allregs_LDADD = $(libdw) $(libmudflap) +find_prologues_LDADD = $(libdw) $(libmudflap) +#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap) +asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +rdwrmmap_LDADD = $(libelf) +dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +arls_LDADD = $(libelf) $(libmudflap) +dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +sha1_tst_LDADD = $(libeu) $(libmudflap) +CLEANFILES = xxx *.gcno *.gcda *gconv all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -397,106 +593,157 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +addrscopes$(EXEEXT): $(addrscopes_OBJECTS) $(addrscopes_DEPENDENCIES) + @rm -f addrscopes$(EXEEXT) + $(LINK) $(addrscopes_OBJECTS) $(addrscopes_LDADD) $(LIBS) +allfcts$(EXEEXT): $(allfcts_OBJECTS) $(allfcts_DEPENDENCIES) + @rm -f allfcts$(EXEEXT) + $(LINK) $(allfcts_OBJECTS) $(allfcts_LDADD) $(LIBS) +allregs$(EXEEXT): $(allregs_OBJECTS) $(allregs_DEPENDENCIES) + @rm -f allregs$(EXEEXT) + $(LINK) $(allregs_OBJECTS) $(allregs_LDADD) $(LIBS) arextract$(EXEEXT): $(arextract_OBJECTS) $(arextract_DEPENDENCIES) @rm -f arextract$(EXEEXT) - $(LINK) $(arextract_LDFLAGS) $(arextract_OBJECTS) $(arextract_LDADD) $(LIBS) + $(LINK) $(arextract_OBJECTS) $(arextract_LDADD) $(LIBS) +arls$(EXEEXT): $(arls_OBJECTS) $(arls_DEPENDENCIES) + @rm -f arls$(EXEEXT) + $(LINK) $(arls_OBJECTS) $(arls_LDADD) $(LIBS) arsymtest$(EXEEXT): $(arsymtest_OBJECTS) $(arsymtest_DEPENDENCIES) @rm -f arsymtest$(EXEEXT) - $(LINK) $(arsymtest_LDFLAGS) $(arsymtest_OBJECTS) $(arsymtest_LDADD) $(LIBS) + $(LINK) $(arsymtest_OBJECTS) $(arsymtest_LDADD) $(LIBS) asm-tst1$(EXEEXT): $(asm_tst1_OBJECTS) $(asm_tst1_DEPENDENCIES) @rm -f asm-tst1$(EXEEXT) - $(LINK) $(asm_tst1_LDFLAGS) $(asm_tst1_OBJECTS) $(asm_tst1_LDADD) $(LIBS) + $(LINK) $(asm_tst1_OBJECTS) $(asm_tst1_LDADD) $(LIBS) asm-tst2$(EXEEXT): $(asm_tst2_OBJECTS) $(asm_tst2_DEPENDENCIES) @rm -f asm-tst2$(EXEEXT) - $(LINK) $(asm_tst2_LDFLAGS) $(asm_tst2_OBJECTS) $(asm_tst2_LDADD) $(LIBS) + $(LINK) $(asm_tst2_OBJECTS) $(asm_tst2_LDADD) $(LIBS) asm-tst3$(EXEEXT): $(asm_tst3_OBJECTS) $(asm_tst3_DEPENDENCIES) @rm -f asm-tst3$(EXEEXT) - $(LINK) $(asm_tst3_LDFLAGS) $(asm_tst3_OBJECTS) $(asm_tst3_LDADD) $(LIBS) + $(LINK) $(asm_tst3_OBJECTS) $(asm_tst3_LDADD) $(LIBS) asm-tst4$(EXEEXT): $(asm_tst4_OBJECTS) $(asm_tst4_DEPENDENCIES) @rm -f asm-tst4$(EXEEXT) - $(LINK) $(asm_tst4_LDFLAGS) $(asm_tst4_OBJECTS) $(asm_tst4_LDADD) $(LIBS) + $(LINK) $(asm_tst4_OBJECTS) $(asm_tst4_LDADD) $(LIBS) asm-tst5$(EXEEXT): $(asm_tst5_OBJECTS) $(asm_tst5_DEPENDENCIES) @rm -f asm-tst5$(EXEEXT) - $(LINK) $(asm_tst5_LDFLAGS) $(asm_tst5_OBJECTS) $(asm_tst5_LDADD) $(LIBS) + $(LINK) $(asm_tst5_OBJECTS) $(asm_tst5_LDADD) $(LIBS) asm-tst6$(EXEEXT): $(asm_tst6_OBJECTS) $(asm_tst6_DEPENDENCIES) @rm -f asm-tst6$(EXEEXT) - $(LINK) $(asm_tst6_LDFLAGS) $(asm_tst6_OBJECTS) $(asm_tst6_LDADD) $(LIBS) + $(LINK) $(asm_tst6_OBJECTS) $(asm_tst6_LDADD) $(LIBS) asm-tst7$(EXEEXT): $(asm_tst7_OBJECTS) $(asm_tst7_DEPENDENCIES) @rm -f asm-tst7$(EXEEXT) - $(LINK) $(asm_tst7_LDFLAGS) $(asm_tst7_OBJECTS) $(asm_tst7_LDADD) $(LIBS) + $(LINK) $(asm_tst7_OBJECTS) $(asm_tst7_LDADD) $(LIBS) asm-tst8$(EXEEXT): $(asm_tst8_OBJECTS) $(asm_tst8_DEPENDENCIES) @rm -f asm-tst8$(EXEEXT) - $(LINK) $(asm_tst8_LDFLAGS) $(asm_tst8_OBJECTS) $(asm_tst8_LDADD) $(LIBS) + $(LINK) $(asm_tst8_OBJECTS) $(asm_tst8_LDADD) $(LIBS) asm-tst9$(EXEEXT): $(asm_tst9_OBJECTS) $(asm_tst9_DEPENDENCIES) @rm -f asm-tst9$(EXEEXT) - $(LINK) $(asm_tst9_LDFLAGS) $(asm_tst9_OBJECTS) $(asm_tst9_LDADD) $(LIBS) + $(LINK) $(asm_tst9_OBJECTS) $(asm_tst9_LDADD) $(LIBS) +dwfl-addr-sect$(EXEEXT): $(dwfl_addr_sect_OBJECTS) $(dwfl_addr_sect_DEPENDENCIES) + @rm -f dwfl-addr-sect$(EXEEXT) + $(LINK) $(dwfl_addr_sect_OBJECTS) $(dwfl_addr_sect_LDADD) $(LIBS) +dwfl-bug-addr-overflow$(EXEEXT): $(dwfl_bug_addr_overflow_OBJECTS) $(dwfl_bug_addr_overflow_DEPENDENCIES) + @rm -f dwfl-bug-addr-overflow$(EXEEXT) + $(LINK) $(dwfl_bug_addr_overflow_OBJECTS) $(dwfl_bug_addr_overflow_LDADD) $(LIBS) +dwfl-bug-fd-leak$(EXEEXT): $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_DEPENDENCIES) + @rm -f dwfl-bug-fd-leak$(EXEEXT) + $(LINK) $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_LDADD) $(LIBS) +dwfl-bug-getmodules$(EXEEXT): $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_DEPENDENCIES) + @rm -f dwfl-bug-getmodules$(EXEEXT) + $(LINK) $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_LDADD) $(LIBS) +dwfl-bug-report$(EXEEXT): $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_DEPENDENCIES) + @rm -f dwfl-bug-report$(EXEEXT) + $(LINK) $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_LDADD) $(LIBS) +dwflmodtest$(EXEEXT): $(dwflmodtest_OBJECTS) $(dwflmodtest_DEPENDENCIES) + @rm -f dwflmodtest$(EXEEXT) + $(LINK) $(dwflmodtest_OBJECTS) $(dwflmodtest_LDADD) $(LIBS) +early-offscn$(EXEEXT): $(early_offscn_OBJECTS) $(early_offscn_DEPENDENCIES) + @rm -f early-offscn$(EXEEXT) + $(LINK) $(early_offscn_OBJECTS) $(early_offscn_LDADD) $(LIBS) ecp$(EXEEXT): $(ecp_OBJECTS) $(ecp_DEPENDENCIES) @rm -f ecp$(EXEEXT) - $(LINK) $(ecp_LDFLAGS) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS) + $(LINK) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS) +find-prologues$(EXEEXT): $(find_prologues_OBJECTS) $(find_prologues_DEPENDENCIES) + @rm -f find-prologues$(EXEEXT) + $(LINK) $(find_prologues_OBJECTS) $(find_prologues_LDADD) $(LIBS) +funcretval$(EXEEXT): $(funcretval_OBJECTS) $(funcretval_DEPENDENCIES) + @rm -f funcretval$(EXEEXT) + $(LINK) $(funcretval_OBJECTS) $(funcretval_LDADD) $(LIBS) +funcscopes$(EXEEXT): $(funcscopes_OBJECTS) $(funcscopes_DEPENDENCIES) + @rm -f funcscopes$(EXEEXT) + $(LINK) $(funcscopes_OBJECTS) $(funcscopes_LDADD) $(LIBS) get-aranges$(EXEEXT): $(get_aranges_OBJECTS) $(get_aranges_DEPENDENCIES) @rm -f get-aranges$(EXEEXT) - $(LINK) $(get_aranges_LDFLAGS) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS) + $(LINK) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS) get-files$(EXEEXT): $(get_files_OBJECTS) $(get_files_DEPENDENCIES) @rm -f get-files$(EXEEXT) - $(LINK) $(get_files_LDFLAGS) $(get_files_OBJECTS) $(get_files_LDADD) $(LIBS) + $(LINK) $(get_files_OBJECTS) $(get_files_LDADD) $(LIBS) get-lines$(EXEEXT): $(get_lines_OBJECTS) $(get_lines_DEPENDENCIES) @rm -f get-lines$(EXEEXT) - $(LINK) $(get_lines_LDFLAGS) $(get_lines_OBJECTS) $(get_lines_LDADD) $(LIBS) + $(LINK) $(get_lines_OBJECTS) $(get_lines_LDADD) $(LIBS) get-pubnames$(EXEEXT): $(get_pubnames_OBJECTS) $(get_pubnames_DEPENDENCIES) @rm -f get-pubnames$(EXEEXT) - $(LINK) $(get_pubnames_LDFLAGS) $(get_pubnames_OBJECTS) $(get_pubnames_LDADD) $(LIBS) + $(LINK) $(get_pubnames_OBJECTS) $(get_pubnames_LDADD) $(LIBS) hash$(EXEEXT): $(hash_OBJECTS) $(hash_DEPENDENCIES) @rm -f hash$(EXEEXT) - $(LINK) $(hash_LDFLAGS) $(hash_OBJECTS) $(hash_LDADD) $(LIBS) + $(LINK) $(hash_OBJECTS) $(hash_LDADD) $(LIBS) +line2addr$(EXEEXT): $(line2addr_OBJECTS) $(line2addr_DEPENDENCIES) + @rm -f line2addr$(EXEEXT) + $(LINK) $(line2addr_OBJECTS) $(line2addr_LDADD) $(LIBS) msg_tst$(EXEEXT): $(msg_tst_OBJECTS) $(msg_tst_DEPENDENCIES) @rm -f msg_tst$(EXEEXT) - $(LINK) $(msg_tst_LDFLAGS) $(msg_tst_OBJECTS) $(msg_tst_LDADD) $(LIBS) + $(LINK) $(msg_tst_OBJECTS) $(msg_tst_LDADD) $(LIBS) newfile$(EXEEXT): $(newfile_OBJECTS) $(newfile_DEPENDENCIES) @rm -f newfile$(EXEEXT) - $(LINK) $(newfile_LDFLAGS) $(newfile_OBJECTS) $(newfile_LDADD) $(LIBS) + $(LINK) $(newfile_OBJECTS) $(newfile_LDADD) $(LIBS) newscn$(EXEEXT): $(newscn_OBJECTS) $(newscn_DEPENDENCIES) @rm -f newscn$(EXEEXT) - $(LINK) $(newscn_LDFLAGS) $(newscn_OBJECTS) $(newscn_LDADD) $(LIBS) + $(LINK) $(newscn_OBJECTS) $(newscn_LDADD) $(LIBS) +rdwrmmap$(EXEEXT): $(rdwrmmap_OBJECTS) $(rdwrmmap_DEPENDENCIES) + @rm -f rdwrmmap$(EXEEXT) + $(LINK) $(rdwrmmap_OBJECTS) $(rdwrmmap_LDADD) $(LIBS) saridx$(EXEEXT): $(saridx_OBJECTS) $(saridx_DEPENDENCIES) @rm -f saridx$(EXEEXT) - $(LINK) $(saridx_LDFLAGS) $(saridx_OBJECTS) $(saridx_LDADD) $(LIBS) + $(LINK) $(saridx_OBJECTS) $(saridx_LDADD) $(LIBS) scnnames$(EXEEXT): $(scnnames_OBJECTS) $(scnnames_DEPENDENCIES) @rm -f scnnames$(EXEEXT) - $(LINK) $(scnnames_LDFLAGS) $(scnnames_OBJECTS) $(scnnames_LDADD) $(LIBS) + $(LINK) $(scnnames_OBJECTS) $(scnnames_LDADD) $(LIBS) sectiondump$(EXEEXT): $(sectiondump_OBJECTS) $(sectiondump_DEPENDENCIES) @rm -f sectiondump$(EXEEXT) - $(LINK) $(sectiondump_LDFLAGS) $(sectiondump_OBJECTS) $(sectiondump_LDADD) $(LIBS) + $(LINK) $(sectiondump_OBJECTS) $(sectiondump_LDADD) $(LIBS) +sha1-tst$(EXEEXT): $(sha1_tst_OBJECTS) $(sha1_tst_DEPENDENCIES) + @rm -f sha1-tst$(EXEEXT) + $(LINK) $(sha1_tst_OBJECTS) $(sha1_tst_LDADD) $(LIBS) show-abbrev$(EXEEXT): $(show_abbrev_OBJECTS) $(show_abbrev_DEPENDENCIES) @rm -f show-abbrev$(EXEEXT) - $(LINK) $(show_abbrev_LDFLAGS) $(show_abbrev_OBJECTS) $(show_abbrev_LDADD) $(LIBS) + $(LINK) $(show_abbrev_OBJECTS) $(show_abbrev_LDADD) $(LIBS) show-die-info$(EXEEXT): $(show_die_info_OBJECTS) $(show_die_info_DEPENDENCIES) @rm -f show-die-info$(EXEEXT) - $(LINK) $(show_die_info_LDFLAGS) $(show_die_info_OBJECTS) $(show_die_info_LDADD) $(LIBS) + $(LINK) $(show_die_info_OBJECTS) $(show_die_info_LDADD) $(LIBS) showptable$(EXEEXT): $(showptable_OBJECTS) $(showptable_DEPENDENCIES) @rm -f showptable$(EXEEXT) - $(LINK) $(showptable_LDFLAGS) $(showptable_OBJECTS) $(showptable_LDADD) $(LIBS) + $(LINK) $(showptable_OBJECTS) $(showptable_LDADD) $(LIBS) test-nlist$(EXEEXT): $(test_nlist_OBJECTS) $(test_nlist_DEPENDENCIES) @rm -f test-nlist$(EXEEXT) - $(LINK) $(test_nlist_LDFLAGS) $(test_nlist_OBJECTS) $(test_nlist_LDADD) $(LIBS) + $(LINK) $(test_nlist_OBJECTS) $(test_nlist_LDADD) $(LIBS) update1$(EXEEXT): $(update1_OBJECTS) $(update1_DEPENDENCIES) @rm -f update1$(EXEEXT) - $(LINK) $(update1_LDFLAGS) $(update1_OBJECTS) $(update1_LDADD) $(LIBS) + $(LINK) $(update1_OBJECTS) $(update1_LDADD) $(LIBS) update2$(EXEEXT): $(update2_OBJECTS) $(update2_DEPENDENCIES) @rm -f update2$(EXEEXT) - $(LINK) $(update2_LDFLAGS) $(update2_OBJECTS) $(update2_LDADD) $(LIBS) + $(LINK) $(update2_OBJECTS) $(update2_LDADD) $(LIBS) update3$(EXEEXT): $(update3_OBJECTS) $(update3_DEPENDENCIES) @rm -f update3$(EXEEXT) - $(LINK) $(update3_LDFLAGS) $(update3_OBJECTS) $(update3_LDADD) $(LIBS) + $(LINK) $(update3_OBJECTS) $(update3_LDADD) $(LIBS) update4$(EXEEXT): $(update4_OBJECTS) $(update4_DEPENDENCIES) @rm -f update4$(EXEEXT) - $(LINK) $(update4_LDFLAGS) $(update4_OBJECTS) $(update4_LDADD) $(LIBS) + $(LINK) $(update4_OBJECTS) $(update4_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -504,7 +751,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addrscopes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allfcts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allregs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arextract.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arsymtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst2.Po@am__quote@ @@ -515,18 +766,31 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst7.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst8.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst9.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-addr-sect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-addr-overflow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-fd-leak.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-getmodules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-report.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwflmodtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/early-offscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find-prologues.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcretval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcscopes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-aranges.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-lines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-pubnames.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line2addr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_tst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newscn.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdwrmmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saridx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scnnames.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sectiondump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1-tst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-abbrev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-die-info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/showptable.Po@am__quote@ @@ -537,27 +801,26 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update4.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -569,8 +832,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -580,13 +843,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -600,9 +862,9 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ + list=' $(TESTS) '; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ @@ -611,7 +873,7 @@ check-TESTS: $(TESTS) if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ + *$$ws$$tst$$ws*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ @@ -623,7 +885,7 @@ check-TESTS: $(TESTS) elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ + *$$ws$$tst$$ws*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ @@ -673,22 +935,21 @@ check-TESTS: $(TESTS) else :; fi distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @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; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -729,6 +990,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@STANDALONE_TRUE@installcheck-local: clean: clean-am clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am @@ -751,13 +1013,21 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: +install-html: install-html-am + install-info: install-info-am install-man: -installcheck-am: +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: installcheck-local maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) @@ -776,19 +1046,32 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-generic clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-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 installcheck-local installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +@STANDALONE_FALSE@installcheck-local: +@STANDALONE_FALSE@ $(MAKE) $(AM_MAKEFLAGS) \ +@STANDALONE_FALSE@ TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS +@GCOV_TRUE@check: check-am coverage +@GCOV_TRUE@.PHONY: coverage +@GCOV_TRUE@coverage: +@GCOV_TRUE@ -$(srcdir)/coverage.sh # 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/tests/addrscopes.c b/tests/addrscopes.c new file mode 100644 index 00000000..3394cd29 --- /dev/null +++ b/tests/addrscopes.c @@ -0,0 +1,203 @@ +/* Test program for dwarf_getscopes. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> + + +static void +paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line) +{ + const char *src; + int lineno, linecol; + if (line != NULL + && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol, + NULL, NULL)) != NULL) + { + if (linecol != 0) + printf ("%s%#" PRIx64 " (%s:%d:%d)", + prefix, addr, src, lineno, linecol); + else + printf ("%s%#" PRIx64 " (%s:%d)", + prefix, addr, src, lineno); + } + else + printf ("%s%#" PRIx64, prefix, addr); +} + +static void +print_vars (unsigned int indent, Dwarf_Die *die) +{ + Dwarf_Die child; + if (dwarf_child (die, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "", + dwarf_diename (&child), + (uint64_t) dwarf_dieoffset (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); + + Dwarf_Attribute attr_mem; + Dwarf_Die origin; + if (dwarf_hasattr (die, DW_AT_abstract_origin) + && dwarf_formref_die (dwarf_attr (die, DW_AT_abstract_origin, &attr_mem), + &origin) != NULL + && dwarf_child (&origin, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%s (abstract)\n", indent, "", + dwarf_diename (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); +} + + +#define INDENT 4 + +static void +handle_address (GElf_Addr pc, Dwfl *dwfl) +{ + Dwarf_Addr cubias; + Dwarf_Die *cudie = dwfl_addrdie (dwfl, pc, &cubias); + if (cudie == NULL) + error (EXIT_FAILURE, 0, "dwfl_addrdie: %s", dwfl_errmsg (-1)); + + Dwarf_Die *scopes; + int n = dwarf_getscopes (cudie, pc - cubias, &scopes); + if (n < 0) + error (EXIT_FAILURE, 0, "dwarf_getscopes: %s", dwarf_errmsg (-1)); + else if (n == 0) + printf ("%#" PRIx64 ": not in any scope\n", pc); + else + { + printf ("%#" PRIx64 ":\n", pc); + unsigned int indent = 0; + while (n-- > 0) + { + Dwarf_Die *const die = &scopes[n]; + + indent += INDENT; + printf ("%*s%s (%#x)", indent, "", + dwarf_diename (die) ?: "<unnamed>", + dwarf_tag (die)); + + Dwarf_Addr lowpc, highpc; + if (dwarf_lowpc (die, &lowpc) == 0 + && dwarf_highpc (die, &highpc) == 0) + { + lowpc += cubias; + highpc += cubias; + Dwfl_Line *loline = dwfl_getsrc (dwfl, lowpc); + Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc); + paddr (": ", lowpc, loline); + if (highpc != lowpc) + paddr (" .. ", lowpc, hiline == loline ? NULL : hiline); + } + puts (""); + + print_vars (indent + INDENT, die); + } + } +} + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + int result = 0; + + /* Now handle the addresses. In case none are given on the command + line, read from stdin. */ + if (remaining == argc) + { + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + + char *buf = NULL; + size_t len = 0; + while (!feof_unlocked (stdin)) + { + if (getline (&buf, &len, stdin) < 0) + break; + + char *endp; + uintmax_t addr = strtoumax (buf, &endp, 0); + if (endp != buf) + handle_address (addr, dwfl); + else + result = 1; + } + + free (buf); + } + else + { + do + { + char *endp; + uintmax_t addr = strtoumax (argv[remaining], &endp, 0); + if (endp != argv[remaining]) + handle_address (addr, dwfl); + else + result = 1; + } + while (++remaining < argc); + } + + dwfl_end (dwfl); + + return result; +} diff --git a/tests/allfcts.c b/tests/allfcts.c new file mode 100644 index 00000000..5fed8148 --- /dev/null +++ b/tests/allfcts.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +static int +cb (Dwarf_Die *func, void *arg __attribute__ ((unused))) +{ + const char *file = dwarf_decl_file (func); + int line = -1; + dwarf_decl_line (func, &line); + const char *fct = dwarf_diename (func); + + printf ("%s:%d:%s\n", file, line, fct); + + return DWARF_CB_OK; +} + + +int +main (int argc, char *argv[]) +{ + for (int i = 1; i < argc; ++i) + { + int fd = open (argv[i], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg != NULL) + { + Dwarf_Off off = 0; + size_t cuhl; + Dwarf_Off noff; + + while (dwarf_nextcu (dbg, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + { + Dwarf_Die die_mem; + Dwarf_Die *die = dwarf_offdie (dbg, off + cuhl, &die_mem); + + (void) dwarf_getfuncs (die, cb, NULL, 0); + + off = noff; + } + + dwarf_end (dbg); + } + + close (fd); + } +} diff --git a/tests/allregs.c b/tests/allregs.c new file mode 100644 index 00000000..f1856dfd --- /dev/null +++ b/tests/allregs.c @@ -0,0 +1,229 @@ +/* Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include <assert.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + + +static const char * +dwarf_encoding_string (unsigned int code) +{ + static const char *known[] = + { + [DW_ATE_void] = "void", + [DW_ATE_address] = "address", + [DW_ATE_boolean] = "boolean", + [DW_ATE_complex_float] = "complex_float", + [DW_ATE_float] = "float", + [DW_ATE_signed] = "signed", + [DW_ATE_signed_char] = "signed_char", + [DW_ATE_unsigned] = "unsigned", + [DW_ATE_unsigned_char] = "unsigned_char", + [DW_ATE_imaginary_float] = "imaginary_float", + [DW_ATE_packed_decimal] = "packed_decimal", + [DW_ATE_numeric_string] = "numeric_string", + [DW_ATE_edited] = "edited", + [DW_ATE_signed_fixed] = "signed_fixed", + [DW_ATE_unsigned_fixed] = "unsigned_fixed", + [DW_ATE_decimal_float] = "decimal_float", + }; + + if (code < sizeof (known) / sizeof (known[0])) + return known[code]; + + if (code >= DW_ATE_lo_user && code <= DW_ATE_hi_user) + { + static char buf[30]; + snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_ATE_lo_user); + return buf; + } + + return "???"; +} + +static int +first_module (Dwfl_Module *mod, + void **userdatap __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr low_addr __attribute__ ((unused)), + void *arg) +{ + Dwarf_Addr bias; + if (dwfl_module_getelf (mod, &bias) == NULL) /* Not really a module. */ + return DWARF_CB_OK; + + *(Dwfl_Module **) arg = mod; + return DWARF_CB_ABORT; +} + + +struct state +{ + struct reginfo *info; + int nregs; +}; + +struct reginfo +{ + const char *set, *pfx; + int regno; + int bits; + int type; + char name[32]; +}; + +static int +compare (const void *r1, const void *r2) +{ + const struct reginfo *a = r1, *b = r2; + if (a->set == b->set) + return a->regno - b->regno; + if (a->set == NULL) + return 1; + if (b->set == NULL) + return -1; + if (!strcmp (a->set, "integer")) + return -1; + if (!strcmp (b->set, "integer")) + return 1; + return strcmp (a->set, b->set); +} + +static int +one_register (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits, int type) +{ + struct state *state = arg; + + if (regno >= state->nregs) + { + state->info = realloc (state->info, (regno + 1) * sizeof state->info[0]); + memset (&state->info[state->nregs], 0, + ((void *) &state->info[regno + 1] + - (void *) &state->info[state->nregs])); + state->nregs = regno + 1; + } + + state->info[regno].regno = regno; + state->info[regno].set = setname; + state->info[regno].pfx = prefix; + state->info[regno].bits = bits; + state->info[regno].type = type; + assert (strlen (regname) < sizeof state->info[regno].name); + strcpy (state->info[regno].name, regname); + + return DWARF_CB_OK; +} + + +static int +match_register (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits, int type) +{ + if (regno == *(int *) arg) + printf ("%5d => %s register %s%s %s %d bits\n", + regno, setname, prefix, regname, + dwarf_encoding_string (type), bits); + + return DWARF_CB_ABORT; +} + + +int +main (int argc, char **argv) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + Dwfl_Module *mod = NULL; + if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0) + error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + if (remaining == argc) + { + struct state state = { NULL, 0 }; + int result = dwfl_module_register_names (mod, &one_register, &state); + if (result != 0 || state.nregs == 0) + error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", + result ? dwfl_errmsg (-1) : "no backend registers known"); + + qsort (state.info, state.nregs, sizeof state.info[0], &compare); + + const char *set = NULL; + for (int i = 0; i < state.nregs; ++i) + if (state.info[i].set != NULL) + { + if (set != state.info[i].set) + printf ("%s registers:\n", state.info[i].set); + set = state.info[i].set; + + printf ("\t%3d: %s%s (%s), %s %d bits\n", + state.info[i].regno, + state.info[i].pfx ?: "", state.info[i].name, + state.info[i].name, + dwarf_encoding_string (state.info[i].type), + state.info[i].bits); + } + } + else + do + { + const char *arg = argv[remaining++]; + int regno = atoi (arg); + int result = dwfl_module_register_names (mod, &match_register, ®no); + if (result != DWARF_CB_ABORT) + error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", + result ? dwfl_errmsg (-1) : "no backend registers known"); + } + while (remaining < argc); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/arextract.c b/tests/arextract.c index aa86fb4e..5bc4f274 100644 --- a/tests/arextract.c +++ b/tests/arextract.c @@ -1,15 +1,27 @@ /* Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/tests/arls.c b/tests/arls.c new file mode 100644 index 00000000..79b867da --- /dev/null +++ b/tests/arls.c @@ -0,0 +1,91 @@ +#include <ar.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <unistd.h> + + +static int handle (const char *fname); + + +int +main (int argc, char *argv[]) +{ + elf_version (EV_CURRENT); + + int result = 0; + if (argc == 1) + result = handle ("a.out"); + else + for (int i = 1; i < argc; ++i) + result |= handle (argv[1]); + + return result; +} + + +static int +handle (const char *fname) +{ + int fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open '%s': %m\n", fname); + return 1; + } + + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf == NULL) + { + printf ("cannot get ELF handling for '%s': %s\n", + fname, elf_errmsg (-1)); + close (fd); + return 1; + } + + if (elf_kind (elf) != ELF_K_AR) + { + printf ("'%s' is no archive\n", fname); + elf_end (elf); + close (fd); + return 1; + } + + printf ("%s:\n", fname); + Elf *subelf = NULL; + Elf_Cmd cmd = ELF_C_READ_MMAP; + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + { + printf ("cannot get archive header in '%s': %s\n", + fname, elf_errmsg (-1)); + elf_end (subelf); + elf_end (elf); + close (fd); + return 1; + } + + off_t off = elf_getaroff (subelf); + + printf ("\nOffset %llu\n" + " Name %s\n" + " Date %ld\n" + " UID %d\n" + " GID %d\n" + " Mode %o\n" + " Size %lld\n", + (unsigned long long int) off, + arhdr->ar_name, (long int) arhdr->ar_date, (int) arhdr->ar_uid, + (int) arhdr->ar_gid, + (int) arhdr->ar_mode, (long long int) arhdr->ar_size); + + cmd = elf_next (subelf); + elf_end (subelf); + } + + close (fd); + + return 0; +} diff --git a/tests/arsymtest.c b/tests/arsymtest.c index e4c2cf09..86d82cf6 100644 --- a/tests/arsymtest.c +++ b/tests/arsymtest.c @@ -1,15 +1,27 @@ /* Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> diff --git a/tests/asm-tst1.c b/tests/asm-tst1.c index b76930d0..123346a3 100644 --- a/tests/asm-tst1.c +++ b/tests/asm-tst1.c @@ -1,18 +1,34 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <string.h> @@ -66,7 +82,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -235,5 +258,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst2.c b/tests/asm-tst2.c index a309976d..7caaf362 100644 --- a/tests/asm-tst2.c +++ b/tests/asm-tst2.c @@ -1,18 +1,34 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <string.h> @@ -65,7 +81,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -257,5 +280,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst3.c b/tests/asm-tst3.c index fb79ea78..f38feeb1 100644 --- a/tests/asm-tst3.c +++ b/tests/asm-tst3.c @@ -1,18 +1,34 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <string.h> @@ -57,7 +73,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -318,5 +341,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c index 29d6485d..54d054c2 100644 --- a/tests/asm-tst4.c +++ b/tests/asm-tst4.c @@ -1,18 +1,34 @@ -/* Copyright (C) 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <stdlib.h> @@ -33,7 +49,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -84,5 +107,7 @@ env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst4-out.o")); /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c index 4f761aed..2a8b3f02 100644 --- a/tests/asm-tst5.c +++ b/tests/asm-tst5.c @@ -1,18 +1,34 @@ -/* Copyright (C) 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <stdlib.h> @@ -35,7 +51,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -96,5 +119,7 @@ env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst5-out.o")); /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c index ece69bc2..bd6a71df 100644 --- a/tests/asm-tst6.c +++ b/tests/asm-tst6.c @@ -1,17 +1,33 @@ -/* Copyright (C) 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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. -#include <libasm.h> + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <stdlib.h> @@ -33,7 +49,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -130,5 +153,7 @@ env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst6-out.o")); /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst7.c b/tests/asm-tst7.c index ebd45594..329f03ba 100644 --- a/tests/asm-tst7.c +++ b/tests/asm-tst7.c @@ -1,19 +1,35 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <inttypes.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <unistd.h> @@ -33,7 +49,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -160,5 +183,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst8.c b/tests/asm-tst8.c index 6ce7c9c0..19c7aa96 100644 --- a/tests/asm-tst8.c +++ b/tests/asm-tst8.c @@ -1,19 +1,35 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <inttypes.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <unistd.h> @@ -33,7 +49,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -168,5 +191,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/asm-tst9.c b/tests/asm-tst9.c index 28bb4787..1797e48c 100644 --- a/tests/asm-tst9.c +++ b/tests/asm-tst9.c @@ -1,19 +1,35 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <inttypes.h> -#include <libasm.h> +#include ELFUTILS_HEADER(asm) #include <libelf.h> #include <stdio.h> #include <string.h> @@ -85,7 +101,14 @@ main (void) elf_version (EV_CURRENT); - ctx = asm_begin (fname, false, EM_386, ELFCLASS32, ELFDATA2LSB); + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); if (ctx == NULL) { printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); @@ -314,5 +337,7 @@ main (void) /* We don't need the file anymore. */ unlink (fname); + ebl_closebackend (ebl); + return result; } diff --git a/tests/coverage.sh b/tests/coverage.sh new file mode 100755 index 00000000..5cc353c9 --- /dev/null +++ b/tests/coverage.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +if [ "x$1" = "x-v" ]; then + verbose=yes +else + verbose=no +fi + +cd .. + +for d in lib libasm libdw libdwfl libebl libelf backends src; do + tmp=$d-data + cd $d + unused=0 + unused_files= + for f in *.gcno; do + base="$(basename $f .gcno)" + fc="$base.c" + gcda="$base.gcda" + if [ -f "$gcda" ]; then + gcov -n -a "$fc" | + gawk "/$d.$fc/ { getline; co=gensub(/.*:(.*)% .*/, \"\\\\1\", \"g\"); co=co+0.0; li=\$4+0; printf \"%-35s %6.2f %5d\n\", \"$d/$fc\", co, li } " >> $tmp + else + unused=$(($unused + 1)) + unused_files="$unused_files $fc" + fi + done + if [ -f $tmp ]; then + gawk "{ copct=\$2; co=(\$3*copct)/100; toco+=(co+0); toli += (\$3+0); } END { printf \"%-12s %6.2f%% covered unused files: %3d\n\", \"$d\", (toco*100)/toli, \"$unused\" }" $tmp + rm -f $tmp + else + printf "%-12s 0.00%% covered unused files: %3d\n" "$d" $unused + fi + if [ $verbose = yes ]; then + for f in $unused_files; do + printf '%-42s%s\n' '' $f + done + fi + cd .. +done diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c new file mode 100644 index 00000000..62d11541 --- /dev/null +++ b/tests/dwfl-addr-sect.c @@ -0,0 +1,88 @@ +/* Test program for libdwfl ... foo + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + +static int +handle_address (Dwfl *dwfl, Dwarf_Addr address) +{ + Dwfl_Module *mod = dwfl_addrmodule (dwfl, address); + Dwarf_Addr adjusted = address; + Dwarf_Addr bias; + Elf_Scn *scn = dwfl_module_address_section (mod, &adjusted, &bias); + if (scn == NULL) + { + error (0, 0, "%#" PRIx64 ": dwfl_module_address_section: %s", + address, dwfl_errmsg (-1)); + return 1; + } + printf ("address %#" PRIx64 " => module \"%s\" section %zu + %#" PRIx64 "\n", + address, + dwfl_module_info (mod, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + elf_ndxscn (scn), adjusted); + return 0; +} + +int +main (int argc, char **argv) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + int remaining; + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + int result = 0; + for (; remaining < argc; ++remaining) + { + char *endp; + uintmax_t addr = strtoumax (argv[remaining], &endp, 0); + if (endp != argv[remaining]) + result |= handle_address (dwfl, addr); + else + result = 1; + } + + dwfl_end (dwfl); + + return result; +} diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c new file mode 100644 index 00000000..0e875dac --- /dev/null +++ b/tests/dwfl-bug-addr-overflow.c @@ -0,0 +1,81 @@ +/* Test program for libdwfl basic module tracking, relocation. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <error.h> +#include <locale.h> +#include ELFUTILS_HEADER(dwfl) + + +static const Dwfl_Callbacks offline_callbacks = + { + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), + .section_address = INTUSE(dwfl_offline_section_address), + }; + + +int +main (void) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = dwfl_begin (&offline_callbacks); + assert (dwfl != NULL); + + Dwfl_Module *high = dwfl_report_module (dwfl, "high", + UINT64_C (0xffffffff00010000), + UINT64_C (0xffffffff00020000)); + assert (high); + Dwfl_Module *low = dwfl_report_module (dwfl, "low", + UINT64_C (0x00010000), + UINT64_C (0x00020000)); + assert (low); + Dwfl_Module *middle = dwfl_report_module (dwfl, "middle", + UINT64_C (0xffff00010000), + UINT64_C (0xffff00020000)); + assert (middle); + + int ret = dwfl_report_end (dwfl, NULL, NULL); + assert (ret == 0); + + Dwfl_Module *mod = dwfl_addrmodule (dwfl, UINT64_C (0xffffffff00010123)); + assert (mod == high); + mod = dwfl_addrmodule (dwfl, UINT64_C (0x00010123)); + assert (mod == low); + mod = dwfl_addrmodule (dwfl, UINT64_C (0xffff00010123)); + assert (mod == middle); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c new file mode 100644 index 00000000..37ff402e --- /dev/null +++ b/tests/dwfl-bug-fd-leak.c @@ -0,0 +1,110 @@ +/* Test program for libdwfl file decriptors leakage. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <dirent.h> +#include <stdlib.h> +#include <errno.h> +#include <error.h> +#include <unistd.h> +#include <dwarf.h> +#include <sys/resource.h> +#include ELFUTILS_HEADER(dwfl) + + +static Dwfl * +elfutils_open (pid_t pid, Dwarf_Addr address) +{ + static char *debuginfo_path; + static const Dwfl_Callbacks proc_callbacks = + { + .find_debuginfo = dwfl_standard_find_debuginfo, + .debuginfo_path = &debuginfo_path, + + .find_elf = dwfl_linux_proc_find_elf, + }; + Dwfl *dwfl = dwfl_begin (&proc_callbacks); + if (dwfl == NULL) + error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1)); + + int result = dwfl_linux_proc_report (dwfl, pid); + if (result < 0) + error (2, 0, "dwfl_linux_proc_report: %s", dwfl_errmsg (-1)); + else if (result > 0) + error (2, result, "dwfl_linux_proc_report"); + + if (dwfl_report_end (dwfl, NULL, NULL) != 0) + error (2, 0, "dwfl_report_end: %s", dwfl_errmsg (-1)); + + Dwarf_Addr bias; + Dwarf *dbg = dwfl_addrdwarf (dwfl, address, &bias); + if (dbg != NULL) + { + Elf *elf = dwarf_getelf (dbg); + if (elf == NULL) + error (2, 0, "dwarf_getelf: %s", dwarf_errmsg (-1)); + } + else + { + Elf *elf = dwfl_module_getelf (dwfl_addrmodule (dwfl, address), &bias); + if (elf == NULL) + error (2, 0, "dwfl_module_getelf: %s", dwfl_errmsg (-1)); + } + + return dwfl; +} + +static void +elfutils_close (Dwfl *dwfl) +{ + dwfl_end (dwfl); +} + +int +main (void) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct rlimit fd_limit = { .rlim_cur = 32, .rlim_max = 32 }; + if (setrlimit (RLIMIT_NOFILE, &fd_limit) < 0) + error (2, errno, "setrlimit"); + + for (int i = 0; i < 5000; ++i) + { + Dwfl *dwfl = elfutils_open (getpid (), (Dwarf_Addr) (uintptr_t) &main); + elfutils_close (dwfl); + } + + return 0; +} diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c new file mode 100644 index 00000000..f7042c02 --- /dev/null +++ b/tests/dwfl-bug-getmodules.c @@ -0,0 +1,74 @@ +/* Test program for dwfl_getmodules bug. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include ELFUTILS_HEADER(dwfl) + +#include <error.h> + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +static int +iterate (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr base, void *arg) +{ + if (base != 0x2000) + return DWARF_CB_OK; + + if (dwfl_addrmodule (arg, 0x2100) == NULL) + error (1, 0, "dwfl_addrmodule: %s", dwfl_errmsg (-1)); + + return DWARF_CB_ABORT; +} + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + dwfl_report_module (dwfl, "m1", 0, 0x1000); + dwfl_report_module (dwfl, "m2", 0x2000, 0x3000); + dwfl_report_module (dwfl, "m3", 0x4000, 0x5000); + + dwfl_report_end (dwfl, NULL, NULL); + + ptrdiff_t offset = dwfl_getmodules (dwfl, &iterate, dwfl, 0); + if (offset <= 0) + error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + offset = dwfl_getmodules (dwfl, &iterate, NULL, offset); + if (offset != 0) + error (1, 0, "dwfl_getmodules (%d): %s", (int) offset, dwfl_errmsg (-1)); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwfl-bug-report.c b/tests/dwfl-bug-report.c new file mode 100644 index 00000000..459a41ae --- /dev/null +++ b/tests/dwfl-bug-report.c @@ -0,0 +1,56 @@ +/* Test program for dwfl_report_end bug. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include ELFUTILS_HEADER(dwfl) + +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + for (int i = 0; i < 5; ++i) + { + dwfl_report_begin (dwfl); + dwfl_report_module (dwfl, "module1", 0, 10); + dwfl_report_end (dwfl, NULL, NULL); + } + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c new file mode 100644 index 00000000..94f960fa --- /dev/null +++ b/tests/dwflmodtest.c @@ -0,0 +1,295 @@ +/* Test program for libdwfl basic module tracking, relocation. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + +static bool show_inlines; + +struct info +{ + Dwarf_Die *cudie; + Dwarf_Addr dwbias; +}; + +static int +print_instance (Dwarf_Die *instance, void *arg) +{ + const struct info *info = arg; + + printf (" inlined"); + + Dwarf_Files *files; + if (dwarf_getsrcfiles (info->cudie, &files, NULL) == 0) + { + Dwarf_Attribute attr_mem; + Dwarf_Word val; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_file, + &attr_mem), &val) == 0) + { + const char *file = dwarf_filesrc (files, val, NULL, NULL); + int lineno = 0, colno = 0; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_line, + &attr_mem), &val) == 0) + lineno = val; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_column, + &attr_mem), &val) == 0) + colno = val; + if (lineno == 0) + { + if (file != NULL) + printf (" from %s", file); + } + else if (colno == 0) + printf (" at %s:%u", file, lineno); + else + printf (" at %s:%u:%u", file, lineno, colno); + } + } + + Dwarf_Addr lo = -1, hi = -1, entry = -1; + if (dwarf_lowpc (instance, &lo) == 0) + lo += info->dwbias; + else + printf (" (lowpc => %s)", dwarf_errmsg (-1)); + if (dwarf_highpc (instance, &hi) == 0) + hi += info->dwbias; + else + printf (" (highpc => %s)", dwarf_errmsg (-1)); + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr (instance, DW_AT_entry_pc, &attr_mem); + if (attr != NULL) + { + if (dwarf_formaddr (attr, &entry) == 0) + entry += info->dwbias; + else + printf (" (entrypc => %s)", dwarf_errmsg (-1)); + } + + if (lo != (Dwarf_Addr) -1 || hi != (Dwarf_Addr) -1) + printf (" %#" PRIx64 "..%#" PRIx64, lo, hi); + if (entry != (Dwarf_Addr) -1) + printf (" => %#" PRIx64 "\n", entry); + else + puts (""); + + return DWARF_CB_OK; +} + +static void +print_inline (Dwarf_Die *func, void *arg) +{ + if (dwarf_func_inline_instances (func, &print_instance, arg) != 0) + printf (" error finding instances: %s\n", dwarf_errmsg (-1)); +} + +static int +print_func (Dwarf_Die *func, void *arg) +{ + const struct info *info = arg; + + const char *file = dwarf_decl_file (func); + int line = -1; + dwarf_decl_line (func, &line); + const char *fct = dwarf_diename (func); + + printf (" %s:%d: %s:", file, line, fct); + + if (dwarf_func_inline (func)) + { + puts (" inline function"); + if (show_inlines) + print_inline (func, arg); + } + else + { + Dwarf_Addr lo = -1, hi = -1, entry = -1; + if (dwarf_lowpc (func, &lo) == 0) + lo += info->dwbias; + else + printf (" (lowpc => %s)", dwarf_errmsg (-1)); + if (dwarf_highpc (func, &hi) == 0) + hi += info->dwbias; + else + printf (" (highpc => %s)", dwarf_errmsg (-1)); + if (dwarf_entrypc (func, &entry) == 0) + entry += info->dwbias; + else + printf (" (entrypc => %s)", dwarf_errmsg (-1)); + + if (lo != (Dwarf_Addr) -1 || hi != (Dwarf_Addr) -1 + || entry != (Dwarf_Addr) -1) + printf (" %#" PRIx64 "..%#" PRIx64 " => %#" PRIx64 "\n", + lo, hi, entry); + else + puts (""); + } + + return DWARF_CB_OK; +} + +static int +list_module (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name, Dwarf_Addr base, + void *arg __attribute__ ((unused))) +{ + Dwarf_Addr start; + Dwarf_Addr end; + const char *file; + const char *debug; + if (dwfl_module_info (mod, NULL, &start, &end, + NULL, NULL, &file, &debug) != name + || start != base) + abort (); + printf ("module: %30s %08" PRIx64 "..%08" PRIx64 " %s %s\n", + name, start, end, file, debug); + return DWARF_CB_OK; +} + +static int +print_module (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name, Dwarf_Addr base, + Dwarf *dw, Dwarf_Addr bias, + void *arg) +{ + printf ("module: %30s %08" PRIx64 " %s %" PRIx64 " (%s)\n", + name, base, dw == NULL ? "no" : "DWARF", bias, dwfl_errmsg (-1)); + + if (dw != NULL && *(const bool *) arg) + { + Dwarf_Off off = 0; + size_t cuhl; + Dwarf_Off noff; + + while (dwarf_nextcu (dw, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + { + Dwarf_Die die_mem; + struct info info = { dwarf_offdie (dw, off + cuhl, &die_mem), bias }; + (void) dwarf_getfuncs (info.cudie, print_func, &info, 0); + + off = noff; + } + } + + return DWARF_CB_OK; +} + +static bool show_functions; + +/* gettext helper macro. */ +#undef N_ +#define N_(Str) Str + +static const struct argp_option options[] = + { + { "functions", 'f', NULL, 0, N_("Additionally show function names"), 0 }, + { "inlines", 'i', NULL, 0, N_("Show instances of inlined functions"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } + }; + +static error_t +parse_opt (int key, char *arg __attribute__ ((unused)), + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case ARGP_KEY_INIT: + state->child_inputs[0] = state->input; + break; + + case 'f': + show_functions = true; + break; + + case 'i': + show_inlines = show_functions = true; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +int +main (int argc, char **argv) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + const struct argp_child argp_children[] = + { + { .argp = dwfl_standard_argp () }, + { .argp = NULL } + }; + const struct argp argp = + { + options, parse_opt, NULL, NULL, argp_children, NULL, NULL + }; + (void) argp_parse (&argp, argc, argv, 0, NULL, &dwfl); + assert (dwfl != NULL); + + ptrdiff_t p = 0; + do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + do + p = dwfl_getdwarf (dwfl, &print_module, &show_functions, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getdwarf: %s", dwfl_errmsg (-1)); + + p = 0; + do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/early-offscn.c b/tests/early-offscn.c new file mode 100644 index 00000000..8778d506 --- /dev/null +++ b/tests/early-offscn.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdio.h> +#include <stdlib.h> + +int +main (int argc, char *argv[]) +{ + if (argc < 2) + error (1, 0, "Usage: %s FILE OFFSET", argv[0]); + + /* Set the ELF version. */ + elf_version (EV_CURRENT); + + /* Open the archive. */ + int fd = open (argv[1], O_RDONLY); + if (fd < 0) + error (1, errno, "cannot open '%s'", argv[1]); + + Elf *elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + error (2, 0, "elf_begin: %s", elf_errmsg (-1)); + + Elf_Scn *scn = gelf_offscn (elf, strtoull (argv[2], NULL, 0)); + if (scn == NULL) + error (3, 0, "gelf_offscn: %s", elf_errmsg (-1)); + + elf_end (elf); + return 0; +} diff --git a/tests/ecp.c b/tests/ecp.c index 15bc71cc..9d0a706e 100644 --- a/tests/ecp.c +++ b/tests/ecp.c @@ -1,15 +1,27 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <errno.h> #include <error.h> @@ -82,7 +94,10 @@ main (int argc, char *argv[]) if (elf_update (outelf, ELF_C_WRITE) == -1) error (EXIT_FAILURE, 0, "elf_update failed: %s", elf_errmsg (-1)); + elf_end (outelf); close (outfd); + elf_end (inelf); + return 0; } diff --git a/tests/find-prologues.c b/tests/find-prologues.c new file mode 100644 index 00000000..c0e73d0d --- /dev/null +++ b/tests/find-prologues.c @@ -0,0 +1,116 @@ +/* Test program for dwarf_entry_breakpoints. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> +#include <fnmatch.h> + + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *func, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (func); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + if (dwarf_func_inline (func)) + return 0; + + Dwarf_Addr entrypc; + if (dwarf_entrypc (func, &entrypc) != 0) + error (EXIT_FAILURE, 0, "dwarf_entrypc: %s: %s", + dwarf_diename (func), dwarf_errmsg (-1)); + entrypc += a->dwbias; + + printf ("%-16s %#.16" PRIx64, dwarf_diename (func), entrypc); + + Dwarf_Addr *bkpts = NULL; + int result = dwarf_entry_breakpoints (func, &bkpts); + if (result <= 0) + printf ("\t%s\n", dwarf_errmsg (-1)); + else + { + for (int i = 0; i < result; ++i) + printf (" %#.16" PRIx64 "%s", bkpts[i] + a->dwbias, + i == result - 1 ? "\n" : ""); + free (bkpts); + } + + return 0; +} + + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct args a = { .dwfl = NULL, .cu = NULL }; + + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, + &a.dwfl); + assert (a.dwfl != NULL); + a.argv = &argv[remaining]; + + int result = 0; + + while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL) + dwarf_getfuncs (a.cu, &handle_function, &a, 0); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/funcretval.c b/tests/funcretval.c new file mode 100644 index 00000000..3a8750f6 --- /dev/null +++ b/tests/funcretval.c @@ -0,0 +1,114 @@ +/* Test program for dwfl_module_return_value_location. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> +#include <fnmatch.h> + + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *funcdie, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (funcdie); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + printf ("(%s) %s: ", dwfl_module_info (dwfl_cumodule (a->cu), NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL), name); + + const Dwarf_Op *locops; + int nlocops = dwfl_module_return_value_location (dwfl_cumodule (a->cu), + funcdie, &locops); + if (nlocops < 0) + error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s", + dwfl_errmsg (-1)); + else if (nlocops == 0) + puts ("returns no value"); + else + { + printf ("return value location:"); + for (int i = 0; i < nlocops; ++i) + printf (" {%#x, %#" PRIx64 "}", locops[i].atom, locops[i].number); + puts (""); + } + + return 0; +} + + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct args a = { .dwfl = NULL, .cu = NULL }; + + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, + &a.dwfl); + assert (a.dwfl != NULL); + a.argv = &argv[remaining]; + + int result = 0; + + while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL) + dwarf_getfuncs (a.cu, &handle_function, &a, 0); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/funcscopes.c b/tests/funcscopes.c new file mode 100644 index 00000000..4b583698 --- /dev/null +++ b/tests/funcscopes.c @@ -0,0 +1,202 @@ +/* Test program for dwarf_getscopes. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> +#include <fnmatch.h> + + +static void +paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line) +{ + const char *src; + int lineno, linecol; + if (line != NULL + && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol, + NULL, NULL)) != NULL) + { + if (linecol != 0) + printf ("%s%#" PRIx64 " (%s:%d:%d)", + prefix, addr, src, lineno, linecol); + else + printf ("%s%#" PRIx64 " (%s:%d)", + prefix, addr, src, lineno); + } + else + printf ("%s%#" PRIx64, prefix, addr); +} + + +static void +print_vars (unsigned int indent, Dwarf_Die *die) +{ + Dwarf_Die child; + if (dwarf_child (die, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "", + dwarf_diename (&child), + (uint64_t) dwarf_dieoffset (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); + + Dwarf_Attribute attr_mem; + Dwarf_Die origin; + if (dwarf_hasattr (die, DW_AT_abstract_origin) + && dwarf_formref_die (dwarf_attr (die, DW_AT_abstract_origin, &attr_mem), + &origin) != NULL + && dwarf_child (&origin, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%s (abstract)\n", indent, "", + dwarf_diename (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); +} + + +#define INDENT 4 + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *funcdie, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (funcdie); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + Dwarf_Die *scopes; + int n = dwarf_getscopes_die (funcdie, &scopes); + if (n <= 0) + error (EXIT_FAILURE, 0, "dwarf_getscopes_die: %s", dwarf_errmsg (-1)); + else + { + Dwarf_Addr start, end; + const char *fname; + const char *modname = dwfl_module_info (dwfl_cumodule (a->cu), NULL, + &start, &end, + NULL, NULL, + &fname, NULL); + if (modname == NULL) + error (EXIT_FAILURE, 0, "dwfl_module_info: %s", dwarf_errmsg (-1)); + if (modname[0] == '\0') + modname = fname; + printf ("%s: %#" PRIx64 " .. %#" PRIx64 "\n", modname, start, end); + + unsigned int indent = 0; + while (n-- > 0) + { + Dwarf_Die *const die = &scopes[n]; + + indent += INDENT; + printf ("%*s%s (%#x)", indent, "", + dwarf_diename (die) ?: "<unnamed>", + dwarf_tag (die)); + + Dwarf_Addr lowpc, highpc; + if (dwarf_lowpc (die, &lowpc) == 0 + && dwarf_highpc (die, &highpc) == 0) + { + lowpc += a->dwbias; + highpc += a->dwbias; + Dwfl_Line *loline = dwfl_getsrc (a->dwfl, lowpc); + Dwfl_Line *hiline = dwfl_getsrc (a->dwfl, highpc); + paddr (": ", lowpc, loline); + if (highpc != lowpc) + paddr (" .. ", lowpc, hiline == loline ? NULL : hiline); + } + puts (""); + + print_vars (indent + INDENT, die); + } + } + + return 0; +} + + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct args a = { .dwfl = NULL, .cu = NULL }; + + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, + &a.dwfl); + assert (a.dwfl != NULL); + a.argv = &argv[remaining]; + + int result = 0; + + while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL) + dwarf_getfuncs (a.cu, &handle_function, &a, 0); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/get-aranges.c b/tests/get-aranges.c index 1be76b2d..c6cd511a 100644 --- a/tests/get-aranges.c +++ b/tests/get-aranges.c @@ -1,19 +1,35 @@ /* Copyright (C) 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <libelf.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <stdio.h> #include <unistd.h> diff --git a/tests/get-files.c b/tests/get-files.c index 537d1eac..81daea27 100644 --- a/tests/get-files.c +++ b/tests/get-files.c @@ -1,19 +1,35 @@ -/* Copyright (C) 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2002, 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <libelf.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <stdio.h> #include <unistd.h> @@ -68,8 +84,24 @@ main (int argc, char *argv[]) break; } - for (int i = 0; i < nfiles; ++i) - printf (" file[%d] = \"%s\"\n", i, + const char *const *dirs; + size_t ndirs; + if (dwarf_getsrcdirs (files, &dirs, &ndirs) != 0) + { + printf ("%s: cannot get include directories\n", argv[cnt]); + result = 1; + break; + } + + if (dirs[0] == NULL) + puts (" dirs[0] = (null)"); + else + printf (" dirs[0] = \"%s\"\n", dirs[0]); + for (size_t i = 1; i < ndirs; ++i) + printf (" dirs[%zu] = \"%s\"\n", i, dirs[i]); + + for (size_t i = 0; i < nfiles; ++i) + printf (" file[%zu] = \"%s\"\n", i, dwarf_filesrc (files, i, NULL, NULL)); o = ncu; diff --git a/tests/get-lines.c b/tests/get-lines.c index 6a8c0764..45d2c8d1 100644 --- a/tests/get-lines.c +++ b/tests/get-lines.c @@ -1,20 +1,36 @@ /* Copyright (C) 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <inttypes.h> #include <libelf.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <stdio.h> #include <unistd.h> diff --git a/tests/get-pubnames.c b/tests/get-pubnames.c index 3523f72f..f1361c63 100644 --- a/tests/get-pubnames.c +++ b/tests/get-pubnames.c @@ -1,19 +1,35 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <fcntl.h> #include <libelf.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <stdio.h> #include <unistd.h> @@ -21,7 +37,7 @@ static int globcnt; static int -callback (Dwarf *dbg, Dwarf_Global *gl, void *arg) +callback (Dwarf *dbg, Dwarf_Global *gl, void *arg __attribute__ ((unused))) { int result = DWARF_CB_OK; diff --git a/tests/hash.c b/tests/hash.c index afe853bb..ab7efeb3 100644 --- a/tests/hash.c +++ b/tests/hash.c @@ -1,15 +1,27 @@ /* Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/tests/line2addr.c b/tests/line2addr.c new file mode 100644 index 00000000..5630da3c --- /dev/null +++ b/tests/line2addr.c @@ -0,0 +1,156 @@ +/* Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <assert.h> +#include ELFUTILS_HEADER(dwfl) +#include <argp.h> +#include <stdio.h> +#include <locale.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> + + +static void +print_address (Dwfl_Module *mod, Dwarf_Addr address) +{ + int n = dwfl_module_relocations (mod); + if (n < 0) + error (0, 0, "dwfl_module_relocations: %s", dwfl_errmsg (-1)); + else if (n > 0) + { + int i = dwfl_module_relocate_address (mod, &address); + if (i < 0) + error (0, 0, "dwfl_module_relocate_address: %s", dwfl_errmsg (-1)); + else + { + const char *modname = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + const char *secname = dwfl_module_relocation_info (mod, i, NULL); + if (n > 1 || secname[0] != '\0') + printf ("%s(%s)+%#" PRIx64, modname, secname, address); + else + printf ("%s+%#" PRIx64, modname, address); + return; + } + } + + printf ("%#" PRIx64, address); +} + + +struct args +{ + const char *arg; + char *file; + int line; +}; + +static int +handle_module (Dwfl_Module *mod __attribute__ ((unused)), + void **udata __attribute__ ((unused)), + const char *modname, Dwarf_Addr base __attribute__ ((unused)), + Dwarf *dbg __attribute__ ((unused)), + Dwarf_Addr bias __attribute__ ((unused)), void *arg) +{ + const struct args *const a = arg; + + Dwfl_Line **lines = NULL; + size_t nlines = 0; + + if (dwfl_module_getsrc_file (mod, a->file, a->line, 0, &lines, &nlines) == 0) + { + for (size_t inner = 0; inner < nlines; ++inner) + { + Dwarf_Addr addr; + int line = a->line, col = 0; + const char *file = dwfl_lineinfo (lines[inner], &addr, &line, &col, + NULL, NULL); + if (file != NULL) + { + printf ("%s -> ", a->arg); + print_address (mod, addr); + if (modname[0] != '\0') + printf (" (%s:", modname); + if (strcmp (file, a->file) || line != a->line || col != 0) + printf (" %s%s:%d", modname[0] != '\0' ? "" : "(", + file, line); + if (col != 0) + printf (":%d", col); + if (modname[0] != '\0' + || strcmp (file, a->file) || line != a->line || col != 0) + puts (")"); + else + puts (""); + } + } + free (lines); + } + + return DWARF_CB_OK; +} + +int +main (int argc, char *argv[]) +{ + int cnt; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &cnt, &dwfl); + assert (dwfl != NULL); + + for (; cnt < argc; ++cnt) + { + struct args a = { .arg = argv[cnt] }; + + switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line)) + { + default: + case 0: + printf ("ignored %s\n", argv[cnt]); + continue; + case 1: + a.line = 0; + break; + case 2: + break; + } + + (void) dwfl_getdwarf (dwfl, &handle_module, &a, 0); + + free (a.file); + } + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/msg_tst.c b/tests/msg_tst.c index 67e63c0e..db078533 100644 --- a/tests/msg_tst.c +++ b/tests/msg_tst.c @@ -1,15 +1,27 @@ -/* Copyright (C) 2002 Red Hat, Inc. +/* Copyright (C) 2002, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> @@ -67,9 +79,10 @@ static struct { ELF_E_GROUP_NOT_REL, "only relocatable files can contain section groups" }, { ELF_E_INVALID_PHDR, - "program header only allowed in executables and shared objects" }, - { ELF_E_NO_PHDR, - "file has no program header" } + "program header only allowed in executables, shared objects, \ +and core files" }, + { ELF_E_NO_PHDR, "file has no program header" }, + { ELF_E_INVALID_OFFSET, "invalid offset" } }; diff --git a/tests/newfile.c b/tests/newfile.c index 5efc862a..f8b132f9 100644 --- a/tests/newfile.c +++ b/tests/newfile.c @@ -1,15 +1,27 @@ -/* Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. +/* Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> @@ -46,7 +58,7 @@ print_ehdr (Elf32_Ehdr *ehdr) } int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { Elf *elf; int result = 0; diff --git a/tests/newscn.c b/tests/newscn.c index bc975130..56eae971 100644 --- a/tests/newscn.c +++ b/tests/newscn.c @@ -1,14 +1,30 @@ -/* Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. +/* Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <assert.h> #include <fcntl.h> @@ -19,7 +35,7 @@ int -main (int argc, char *argv[]) +main (void) { Elf *elf; int fd; diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c new file mode 100644 index 00000000..263be0fd --- /dev/null +++ b/tests/rdwrmmap.c @@ -0,0 +1,29 @@ +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <libelf.h> + +int +main (int argc __attribute__ ((unused)), char *argv[]) +{ + int fd = open (argv[1], O_RDWR); + if (fd < 0) + error (2, errno, "open: %s", argv[1]); + + if (elf_version (EV_CURRENT) == EV_NONE) + error (1, 0, "libelf version mismatch"); + + Elf *elf = elf_begin (fd, ELF_C_RDWR_MMAP, NULL); + if (elf == NULL) + error (1, 0, "elf_begin: %s", elf_errmsg (-1)); + + if (elf_update (elf, ELF_C_WRITE) < 0) + error (1, 0, "elf_update: %s", elf_errmsg (-1)); + + elf_end (elf); + close (fd); + + return 0; +} diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh new file mode 100755 index 00000000..d525523d --- /dev/null +++ b/tests/run-addrname-test.sh @@ -0,0 +1,222 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile34 testfile38 testfile41 testfile49 + +testrun_compare ../src/addr2line -f -e testfile34 \ + 0x08048074 0x08048075 0x08048076 \ + 0x08049078 0x08048080 0x08049080 <<\EOF +foo +??:0 +bar +??:0 +_etext +??:0 +data1 +??:0 +?? +??:0 +_end +??:0 +EOF + +testrun_compare ../src/addr2line -S -e testfile38 0x02 0x10a 0x211 0x31a <<\EOF +t1_global_outer+0x2 +??:0 +t2_global_symbol+0x2 +??:0 +t3_global_after_0+0x1 +??:0 +(.text)+0x31a +??:0 +EOF + +testrun_compare ../src/addr2line -S -e testfile41 0x1 0x104 <<\EOF +small_global_at_large_global+0x1 +??:0 +small_global_first_at_large_global+0x1 +??:0 +EOF + +testfiles testfile12 testfile14 +tempfiles testmaps + +cat > testmaps <<EOF +00400000-00401000 r-xp 00000000 fd:01 4006812 `pwd`/testfile14 +00500000-00501000 rw-p 00000000 fd:01 4006812 `pwd`/testfile14 +01000000-01001000 r-xp 00000000 fd:01 1234567 `pwd`/testfile12 +01100000-01011000 rw-p 00000000 fd:01 1234567 `pwd`/testfile12 +2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0 +2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0 +7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0 [stack] +7fff611fe000-7fff61200000 r-xp 7fff611fe000 00:00 0 [vdso] +ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] +EOF + +testrun_compare ../src/addr2line -S -M testmaps 0x40047c 0x10009db <<\EOF +caller+0x14 +/home/drepper/local/elfutils-build/20050425/v.c:11 +foo+0xb +/home/drepper/local/elfutils-build/20030710/u.c:5 +EOF + +# .section .text +# nop #0 +#sizeless_foo: +# nop #1 +# nop #2 +#sized_bar: +# nop #3 +# nop #4 +#sizeless_baz: +# nop #5 +# nop #6 +# .size sized_bar, . - sized_bar +# nop #7 +# nop #8 +#sizeless_x: +# nop #9 +# .org 0x100 +# nop #0 +# .globl global_outer +#global_outer: +# nop #1 +# nop #2 +# .globl global_in_global +#global_in_global: +# nop #3 +# nop #4 +# .size global_in_global, . - global_in_global +#local_in_global: +# nop #5 +# nop #6 +# .size local_in_global, . - local_in_global +# nop #7 +# nop #8 +#.Lsizeless1: +# nop #9 +# nop #10 +# .size global_outer, . - global_outer +# nop #11 +# .org 0x200 +# nop #0 +#local_outer: +# nop #1 +# nop #2 +# .globl global_in_local +#global_in_local: +# nop #3 +# nop #4 +# .size global_in_local, . - global_in_local +#local_in_local: +# nop #5 +# nop #6 +# .size local_in_local, . - local_in_local +# nop #7 +# nop #8 +#.Lsizeless2: +# nop #9 +# nop #10 +# .size local_outer, . - local_outer +# nop #11 +testrun_compare ../src/addr2line -S -e testfile49 \ + 0 1 2 3 4 5 6 7 8 9 \ + 0x100 0x101 0x102 0x103 0x104 0x105 \ + 0x106 0x107 0x108 0x109 0x10a 0x10b \ + 0x200 0x201 0x202 0x203 0x204 0x205 \ + 0x206 0x207 0x208 0x209 0x20a 0x20b <<\EOF +(.text)+0 +??:0 +sizeless_foo +??:0 +sizeless_foo+0x1 +??:0 +sized_bar +??:0 +sized_bar+0x1 +??:0 +sized_bar+0x2 +??:0 +sized_bar+0x3 +??:0 +(.text)+0x7 +??:0 +(.text)+0x8 +??:0 +sizeless_x +??:0 +sizeless_x+0xf7 +??:0 +global_outer +??:0 +global_outer+0x1 +??:0 +global_in_global +??:0 +global_in_global+0x1 +??:0 +global_outer+0x4 +??:0 +global_outer+0x5 +??:0 +global_outer+0x6 +??:0 +global_outer+0x7 +??:0 +global_outer+0x8 +??:0 +global_outer+0x9 +??:0 +(.text)+0x10b +??:0 +(.text)+0x200 +??:0 +local_outer +??:0 +local_outer+0x1 +??:0 +global_in_local +??:0 +global_in_local+0x1 +??:0 +local_in_local +??:0 +local_in_local+0x1 +??:0 +local_outer+0x6 +??:0 +local_outer+0x7 +??:0 +local_outer+0x8 +??:0 +local_outer+0x9 +??:0 +(.text)+0x20b +??:0 +EOF + +exit 0 diff --git a/tests/run-addrscopes.sh b/tests/run-addrscopes.sh new file mode 100755 index 00000000..d13c55df --- /dev/null +++ b/tests/run-addrscopes.sh @@ -0,0 +1,51 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile22 + +testrun_compare ./addrscopes -e testfile22 0x8048353 <<\EOF +0x8048353: + tests/foo.c (0x11): 0x8048348 (tests/foo.c:5) .. 0x804837e (tests/foo.c:16) + global [ be] + function (0x2e): 0x8048348 (tests/foo.c:5) .. 0x804835b (tests/foo.c:14) + local [ 8f] +EOF + +test_cleanup + +testfiles testfile24 +testrun_compare ./addrscopes -e testfile24 0x804834e <<\EOF +0x804834e: + inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x8048364 (/home/roland/build/stock-elfutils/inline-test.c:16) + add (0x1d): 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:3) .. 0x8048350 (/home/roland/build/stock-elfutils/inline-test.c:9) + y [ 9d] + x [ a2] + x (abstract) + y (abstract) +EOF + +exit 0 diff --git a/tests/run-allfcts.sh b/tests/run-allfcts.sh new file mode 100755 index 00000000..e990a63e --- /dev/null +++ b/tests/run-allfcts.sh @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 testfile8 + +testrun_compare ./allfcts testfile testfile2 testfile8 <<\EOF +/home/drepper/gnu/new-bu/build/ttt/m.c:5:main +/home/drepper/gnu/new-bu/build/ttt/b.c:4:bar +/home/drepper/gnu/new-bu/build/ttt/f.c:3:foo +/shoggoth/drepper/b.c:4:bar +/shoggoth/drepper/f.c:3:foo +/shoggoth/drepper/m.c:5:main +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:107:main +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:159:print_version +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:173:parse_opt +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:201:more_help +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:217:process_file +/usr/include/sys/stat.h:375:stat64 +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:291:crc32_file +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:313:handle_elf +EOF + +exit 0 diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh new file mode 100755 index 00000000..7ebaa719 --- /dev/null +++ b/tests/run-allregs.sh @@ -0,0 +1,2595 @@ +#! /bin/sh +# Copyright (C) 2005, 2006, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +regs_test() +{ + tempfiles good.regs + cat > good.regs + testfiles "$@" + for f; do testrun_compare ./allregs -e $f < good.regs; done + test_cleanup +} + +regs_test testfile11 <<\EOF +integer registers: + 0: %eax (eax), signed 32 bits + 1: %ecx (ecx), signed 32 bits + 2: %edx (edx), signed 32 bits + 3: %ebx (ebx), signed 32 bits + 4: %esp (esp), address 32 bits + 5: %ebp (ebp), address 32 bits + 6: %esi (esi), signed 32 bits + 7: %edi (edi), signed 32 bits + 8: %eip (eip), address 32 bits + 9: %eflags (eflags), unsigned 32 bits + 10: %trapno (trapno), unsigned 32 bits +FPU-control registers: + 37: %fctrl (fctrl), unsigned 16 bits + 38: %fstat (fstat), unsigned 16 bits + 39: %mxcsr (mxcsr), unsigned 32 bits +MMX registers: + 29: %mm0 (mm0), unsigned 64 bits + 30: %mm1 (mm1), unsigned 64 bits + 31: %mm2 (mm2), unsigned 64 bits + 32: %mm3 (mm3), unsigned 64 bits + 33: %mm4 (mm4), unsigned 64 bits + 34: %mm5 (mm5), unsigned 64 bits + 35: %mm6 (mm6), unsigned 64 bits + 36: %mm7 (mm7), unsigned 64 bits +SSE registers: + 21: %xmm0 (xmm0), unsigned 128 bits + 22: %xmm1 (xmm1), unsigned 128 bits + 23: %xmm2 (xmm2), unsigned 128 bits + 24: %xmm3 (xmm3), unsigned 128 bits + 25: %xmm4 (xmm4), unsigned 128 bits + 26: %xmm5 (xmm5), unsigned 128 bits + 27: %xmm6 (xmm6), unsigned 128 bits + 28: %xmm7 (xmm7), unsigned 128 bits +segment registers: + 40: %es (es), unsigned 16 bits + 41: %cs (cs), unsigned 16 bits + 42: %ss (ss), unsigned 16 bits + 43: %ds (ds), unsigned 16 bits + 44: %fs (fs), unsigned 16 bits + 45: %gs (gs), unsigned 16 bits +x87 registers: + 11: %st0 (st0), float 80 bits + 12: %st1 (st1), float 80 bits + 13: %st2 (st2), float 80 bits + 14: %st3 (st3), float 80 bits + 15: %st4 (st4), float 80 bits + 16: %st5 (st5), float 80 bits + 17: %st6 (st6), float 80 bits + 18: %st7 (st7), float 80 bits +EOF + +regs_test testfile12 <<\EOF +integer registers: + 0: %rax (rax), signed 64 bits + 1: %rdx (rdx), signed 64 bits + 2: %rcx (rcx), signed 64 bits + 3: %rbx (rbx), signed 64 bits + 4: %rsi (rsi), signed 64 bits + 5: %rdi (rdi), signed 64 bits + 6: %rbp (rbp), address 64 bits + 7: %rsp (rsp), address 64 bits + 8: %r8 (r8), signed 64 bits + 9: %r9 (r9), signed 64 bits + 10: %r10 (r10), signed 64 bits + 11: %r11 (r11), signed 64 bits + 12: %r12 (r12), signed 64 bits + 13: %r13 (r13), signed 64 bits + 14: %r14 (r14), signed 64 bits + 15: %r15 (r15), signed 64 bits + 16: %rip (rip), address 64 bits + 49: %rflags (rflags), unsigned 64 bits +MMX registers: + 41: %mm0 (mm0), unsigned 64 bits + 42: %mm1 (mm1), unsigned 64 bits + 43: %mm2 (mm2), unsigned 64 bits + 44: %mm3 (mm3), unsigned 64 bits + 45: %mm4 (mm4), unsigned 64 bits + 46: %mm5 (mm5), unsigned 64 bits + 47: %mm6 (mm6), unsigned 64 bits + 48: %mm7 (mm7), unsigned 64 bits +SSE registers: + 17: %xmm0 (xmm0), unsigned 128 bits + 18: %xmm1 (xmm1), unsigned 128 bits + 19: %xmm2 (xmm2), unsigned 128 bits + 20: %xmm3 (xmm3), unsigned 128 bits + 21: %xmm4 (xmm4), unsigned 128 bits + 22: %xmm5 (xmm5), unsigned 128 bits + 23: %xmm6 (xmm6), unsigned 128 bits + 24: %xmm7 (xmm7), unsigned 128 bits + 25: %xmm8 (xmm8), unsigned 128 bits + 26: %xmm9 (xmm9), unsigned 128 bits + 27: %xmm10 (xmm10), unsigned 128 bits + 28: %xmm11 (xmm11), unsigned 128 bits + 29: %xmm12 (xmm12), unsigned 128 bits + 30: %xmm13 (xmm13), unsigned 128 bits + 31: %xmm14 (xmm14), unsigned 128 bits + 32: %xmm15 (xmm15), unsigned 128 bits +control registers: + 62: %tr (tr), unsigned 64 bits + 63: %ldtr (ldtr), unsigned 64 bits + 64: %mxcsr (mxcsr), unsigned 64 bits + 65: %fcw (fcw), unsigned 16 bits + 66: %fsw (fsw), unsigned 16 bits +segment registers: + 50: %es (es), unsigned 16 bits + 51: %cs (cs), unsigned 16 bits + 52: %ss (ss), unsigned 16 bits + 53: %ds (ds), unsigned 16 bits + 54: %fs (fs), unsigned 16 bits + 55: %gs (gs), unsigned 16 bits + 58: %fs.base (fs.base), address 64 bits + 59: %gs.base (gs.base), address 64 bits +x87 registers: + 33: %st0 (st0), float 80 bits + 34: %st1 (st1), float 80 bits + 35: %st2 (st2), float 80 bits + 36: %st3 (st3), float 80 bits + 37: %st4 (st4), float 80 bits + 38: %st5 (st5), float 80 bits + 39: %st6 (st6), float 80 bits + 40: %st7 (st7), float 80 bits +EOF + +regs_test testfile2 <<\EOF +integer registers: + 0: r0 (r0), signed 32 bits + 1: r1 (r1), signed 32 bits + 2: r2 (r2), signed 32 bits + 3: r3 (r3), signed 32 bits + 4: r4 (r4), signed 32 bits + 5: r5 (r5), signed 32 bits + 6: r6 (r6), signed 32 bits + 7: r7 (r7), signed 32 bits + 8: r8 (r8), signed 32 bits + 9: r9 (r9), signed 32 bits + 10: r10 (r10), signed 32 bits + 11: r11 (r11), signed 32 bits + 12: r12 (r12), signed 32 bits + 13: r13 (r13), signed 32 bits + 14: r14 (r14), signed 32 bits + 15: r15 (r15), signed 32 bits + 16: r16 (r16), signed 32 bits + 17: r17 (r17), signed 32 bits + 18: r18 (r18), signed 32 bits + 19: r19 (r19), signed 32 bits + 20: r20 (r20), signed 32 bits + 21: r21 (r21), signed 32 bits + 22: r22 (r22), signed 32 bits + 23: r23 (r23), signed 32 bits + 24: r24 (r24), signed 32 bits + 25: r25 (r25), signed 32 bits + 26: r26 (r26), signed 32 bits + 27: r27 (r27), signed 32 bits + 28: r28 (r28), signed 32 bits + 29: r29 (r29), signed 32 bits + 30: r30 (r30), signed 32 bits + 31: r31 (r31), signed 32 bits + 64: cr (cr), unsigned 32 bits + 66: msr (msr), unsigned 32 bits +FPU registers: + 32: f0 (f0), float 64 bits + 33: f1 (f1), float 64 bits + 34: f2 (f2), float 64 bits + 35: f3 (f3), float 64 bits + 36: f4 (f4), float 64 bits + 37: f5 (f5), float 64 bits + 38: f6 (f6), float 64 bits + 39: f7 (f7), float 64 bits + 40: f8 (f8), float 64 bits + 41: f9 (f9), float 64 bits + 42: f10 (f10), float 64 bits + 43: f11 (f11), float 64 bits + 44: f12 (f12), float 64 bits + 45: f13 (f13), float 64 bits + 46: f14 (f14), float 64 bits + 47: f15 (f15), float 64 bits + 48: f16 (f16), float 64 bits + 49: f17 (f17), float 64 bits + 50: f18 (f18), float 64 bits + 51: f19 (f19), float 64 bits + 52: f20 (f20), float 64 bits + 53: f21 (f21), float 64 bits + 54: f22 (f22), float 64 bits + 55: f23 (f23), float 64 bits + 56: f24 (f24), float 64 bits + 57: f25 (f25), float 64 bits + 58: f26 (f26), float 64 bits + 59: f27 (f27), float 64 bits + 60: f28 (f28), float 64 bits + 61: f29 (f29), float 64 bits + 62: f30 (f30), float 64 bits + 63: f31 (f31), float 64 bits + 65: fpscr (fpscr), unsigned 32 bits +privileged registers: + 70: sr0 (sr0), unsigned 32 bits + 71: sr1 (sr1), unsigned 32 bits + 72: sr2 (sr2), unsigned 32 bits + 73: sr3 (sr3), unsigned 32 bits + 74: sr4 (sr4), unsigned 32 bits + 75: sr5 (sr5), unsigned 32 bits + 76: sr6 (sr6), unsigned 32 bits + 77: sr7 (sr7), unsigned 32 bits + 78: sr8 (sr8), unsigned 32 bits + 79: sr9 (sr9), unsigned 32 bits + 80: sr10 (sr10), unsigned 32 bits + 81: sr11 (sr11), unsigned 32 bits + 82: sr12 (sr12), unsigned 32 bits + 83: sr13 (sr13), unsigned 32 bits + 84: sr14 (sr14), unsigned 32 bits + 85: sr15 (sr15), unsigned 32 bits + 100: mq (mq), unsigned 32 bits + 101: xer (xer), unsigned 32 bits + 102: spr2 (spr2), unsigned 32 bits + 103: spr3 (spr3), unsigned 32 bits + 104: spr4 (spr4), unsigned 32 bits + 105: spr5 (spr5), unsigned 32 bits + 106: spr6 (spr6), unsigned 32 bits + 107: spr7 (spr7), unsigned 32 bits + 108: lr (lr), unsigned 32 bits + 109: ctr (ctr), unsigned 32 bits + 110: spr10 (spr10), unsigned 32 bits + 111: spr11 (spr11), unsigned 32 bits + 112: spr12 (spr12), unsigned 32 bits + 113: spr13 (spr13), unsigned 32 bits + 114: spr14 (spr14), unsigned 32 bits + 115: spr15 (spr15), unsigned 32 bits + 116: spr16 (spr16), unsigned 32 bits + 117: spr17 (spr17), unsigned 32 bits + 118: dsisr (dsisr), unsigned 32 bits + 119: dar (dar), unsigned 32 bits + 120: spr20 (spr20), unsigned 32 bits + 121: spr21 (spr21), unsigned 32 bits + 122: dec (dec), unsigned 32 bits + 123: spr23 (spr23), unsigned 32 bits + 124: spr24 (spr24), unsigned 32 bits + 125: spr25 (spr25), unsigned 32 bits + 126: spr26 (spr26), unsigned 32 bits + 127: spr27 (spr27), unsigned 32 bits + 128: spr28 (spr28), unsigned 32 bits + 129: spr29 (spr29), unsigned 32 bits + 130: spr30 (spr30), unsigned 32 bits + 131: spr31 (spr31), unsigned 32 bits + 132: spr32 (spr32), unsigned 32 bits + 133: spr33 (spr33), unsigned 32 bits + 134: spr34 (spr34), unsigned 32 bits + 135: spr35 (spr35), unsigned 32 bits + 136: spr36 (spr36), unsigned 32 bits + 137: spr37 (spr37), unsigned 32 bits + 138: spr38 (spr38), unsigned 32 bits + 139: spr39 (spr39), unsigned 32 bits + 140: spr40 (spr40), unsigned 32 bits + 141: spr41 (spr41), unsigned 32 bits + 142: spr42 (spr42), unsigned 32 bits + 143: spr43 (spr43), unsigned 32 bits + 144: spr44 (spr44), unsigned 32 bits + 145: spr45 (spr45), unsigned 32 bits + 146: spr46 (spr46), unsigned 32 bits + 147: spr47 (spr47), unsigned 32 bits + 148: spr48 (spr48), unsigned 32 bits + 149: spr49 (spr49), unsigned 32 bits + 150: spr50 (spr50), unsigned 32 bits + 151: spr51 (spr51), unsigned 32 bits + 152: spr52 (spr52), unsigned 32 bits + 153: spr53 (spr53), unsigned 32 bits + 154: spr54 (spr54), unsigned 32 bits + 155: spr55 (spr55), unsigned 32 bits + 156: spr56 (spr56), unsigned 32 bits + 157: spr57 (spr57), unsigned 32 bits + 158: spr58 (spr58), unsigned 32 bits + 159: spr59 (spr59), unsigned 32 bits + 160: spr60 (spr60), unsigned 32 bits + 161: spr61 (spr61), unsigned 32 bits + 162: spr62 (spr62), unsigned 32 bits + 163: spr63 (spr63), unsigned 32 bits + 164: spr64 (spr64), unsigned 32 bits + 165: spr65 (spr65), unsigned 32 bits + 166: spr66 (spr66), unsigned 32 bits + 167: spr67 (spr67), unsigned 32 bits + 168: spr68 (spr68), unsigned 32 bits + 169: spr69 (spr69), unsigned 32 bits + 170: spr70 (spr70), unsigned 32 bits + 171: spr71 (spr71), unsigned 32 bits + 172: spr72 (spr72), unsigned 32 bits + 173: spr73 (spr73), unsigned 32 bits + 174: spr74 (spr74), unsigned 32 bits + 175: spr75 (spr75), unsigned 32 bits + 176: spr76 (spr76), unsigned 32 bits + 177: spr77 (spr77), unsigned 32 bits + 178: spr78 (spr78), unsigned 32 bits + 179: spr79 (spr79), unsigned 32 bits + 180: spr80 (spr80), unsigned 32 bits + 181: spr81 (spr81), unsigned 32 bits + 182: spr82 (spr82), unsigned 32 bits + 183: spr83 (spr83), unsigned 32 bits + 184: spr84 (spr84), unsigned 32 bits + 185: spr85 (spr85), unsigned 32 bits + 186: spr86 (spr86), unsigned 32 bits + 187: spr87 (spr87), unsigned 32 bits + 188: spr88 (spr88), unsigned 32 bits + 189: spr89 (spr89), unsigned 32 bits + 190: spr90 (spr90), unsigned 32 bits + 191: spr91 (spr91), unsigned 32 bits + 192: spr92 (spr92), unsigned 32 bits + 193: spr93 (spr93), unsigned 32 bits + 194: spr94 (spr94), unsigned 32 bits + 195: spr95 (spr95), unsigned 32 bits + 196: spr96 (spr96), unsigned 32 bits + 197: spr97 (spr97), unsigned 32 bits + 198: spr98 (spr98), unsigned 32 bits + 199: spr99 (spr99), unsigned 32 bits + 200: spr100 (spr100), unsigned 32 bits + 201: spr101 (spr101), unsigned 32 bits + 202: spr102 (spr102), unsigned 32 bits + 203: spr103 (spr103), unsigned 32 bits + 204: spr104 (spr104), unsigned 32 bits + 205: spr105 (spr105), unsigned 32 bits + 206: spr106 (spr106), unsigned 32 bits + 207: spr107 (spr107), unsigned 32 bits + 208: spr108 (spr108), unsigned 32 bits + 209: spr109 (spr109), unsigned 32 bits + 210: spr110 (spr110), unsigned 32 bits + 211: spr111 (spr111), unsigned 32 bits + 212: spr112 (spr112), unsigned 32 bits + 213: spr113 (spr113), unsigned 32 bits + 214: spr114 (spr114), unsigned 32 bits + 215: spr115 (spr115), unsigned 32 bits + 216: spr116 (spr116), unsigned 32 bits + 217: spr117 (spr117), unsigned 32 bits + 218: spr118 (spr118), unsigned 32 bits + 219: spr119 (spr119), unsigned 32 bits + 220: spr120 (spr120), unsigned 32 bits + 221: spr121 (spr121), unsigned 32 bits + 222: spr122 (spr122), unsigned 32 bits + 223: spr123 (spr123), unsigned 32 bits + 224: spr124 (spr124), unsigned 32 bits + 225: spr125 (spr125), unsigned 32 bits + 226: spr126 (spr126), unsigned 32 bits + 227: spr127 (spr127), unsigned 32 bits + 228: spr128 (spr128), unsigned 32 bits + 229: spr129 (spr129), unsigned 32 bits + 230: spr130 (spr130), unsigned 32 bits + 231: spr131 (spr131), unsigned 32 bits + 232: spr132 (spr132), unsigned 32 bits + 233: spr133 (spr133), unsigned 32 bits + 234: spr134 (spr134), unsigned 32 bits + 235: spr135 (spr135), unsigned 32 bits + 236: spr136 (spr136), unsigned 32 bits + 237: spr137 (spr137), unsigned 32 bits + 238: spr138 (spr138), unsigned 32 bits + 239: spr139 (spr139), unsigned 32 bits + 240: spr140 (spr140), unsigned 32 bits + 241: spr141 (spr141), unsigned 32 bits + 242: spr142 (spr142), unsigned 32 bits + 243: spr143 (spr143), unsigned 32 bits + 244: spr144 (spr144), unsigned 32 bits + 245: spr145 (spr145), unsigned 32 bits + 246: spr146 (spr146), unsigned 32 bits + 247: spr147 (spr147), unsigned 32 bits + 248: spr148 (spr148), unsigned 32 bits + 249: spr149 (spr149), unsigned 32 bits + 250: spr150 (spr150), unsigned 32 bits + 251: spr151 (spr151), unsigned 32 bits + 252: spr152 (spr152), unsigned 32 bits + 253: spr153 (spr153), unsigned 32 bits + 254: spr154 (spr154), unsigned 32 bits + 255: spr155 (spr155), unsigned 32 bits + 256: spr156 (spr156), unsigned 32 bits + 257: spr157 (spr157), unsigned 32 bits + 258: spr158 (spr158), unsigned 32 bits + 259: spr159 (spr159), unsigned 32 bits + 260: spr160 (spr160), unsigned 32 bits + 261: spr161 (spr161), unsigned 32 bits + 262: spr162 (spr162), unsigned 32 bits + 263: spr163 (spr163), unsigned 32 bits + 264: spr164 (spr164), unsigned 32 bits + 265: spr165 (spr165), unsigned 32 bits + 266: spr166 (spr166), unsigned 32 bits + 267: spr167 (spr167), unsigned 32 bits + 268: spr168 (spr168), unsigned 32 bits + 269: spr169 (spr169), unsigned 32 bits + 270: spr170 (spr170), unsigned 32 bits + 271: spr171 (spr171), unsigned 32 bits + 272: spr172 (spr172), unsigned 32 bits + 273: spr173 (spr173), unsigned 32 bits + 274: spr174 (spr174), unsigned 32 bits + 275: spr175 (spr175), unsigned 32 bits + 276: spr176 (spr176), unsigned 32 bits + 277: spr177 (spr177), unsigned 32 bits + 278: spr178 (spr178), unsigned 32 bits + 279: spr179 (spr179), unsigned 32 bits + 280: spr180 (spr180), unsigned 32 bits + 281: spr181 (spr181), unsigned 32 bits + 282: spr182 (spr182), unsigned 32 bits + 283: spr183 (spr183), unsigned 32 bits + 284: spr184 (spr184), unsigned 32 bits + 285: spr185 (spr185), unsigned 32 bits + 286: spr186 (spr186), unsigned 32 bits + 287: spr187 (spr187), unsigned 32 bits + 288: spr188 (spr188), unsigned 32 bits + 289: spr189 (spr189), unsigned 32 bits + 290: spr190 (spr190), unsigned 32 bits + 291: spr191 (spr191), unsigned 32 bits + 292: spr192 (spr192), unsigned 32 bits + 293: spr193 (spr193), unsigned 32 bits + 294: spr194 (spr194), unsigned 32 bits + 295: spr195 (spr195), unsigned 32 bits + 296: spr196 (spr196), unsigned 32 bits + 297: spr197 (spr197), unsigned 32 bits + 298: spr198 (spr198), unsigned 32 bits + 299: spr199 (spr199), unsigned 32 bits + 300: spr200 (spr200), unsigned 32 bits + 301: spr201 (spr201), unsigned 32 bits + 302: spr202 (spr202), unsigned 32 bits + 303: spr203 (spr203), unsigned 32 bits + 304: spr204 (spr204), unsigned 32 bits + 305: spr205 (spr205), unsigned 32 bits + 306: spr206 (spr206), unsigned 32 bits + 307: spr207 (spr207), unsigned 32 bits + 308: spr208 (spr208), unsigned 32 bits + 309: spr209 (spr209), unsigned 32 bits + 310: spr210 (spr210), unsigned 32 bits + 311: spr211 (spr211), unsigned 32 bits + 312: spr212 (spr212), unsigned 32 bits + 313: spr213 (spr213), unsigned 32 bits + 314: spr214 (spr214), unsigned 32 bits + 315: spr215 (spr215), unsigned 32 bits + 316: spr216 (spr216), unsigned 32 bits + 317: spr217 (spr217), unsigned 32 bits + 318: spr218 (spr218), unsigned 32 bits + 319: spr219 (spr219), unsigned 32 bits + 320: spr220 (spr220), unsigned 32 bits + 321: spr221 (spr221), unsigned 32 bits + 322: spr222 (spr222), unsigned 32 bits + 323: spr223 (spr223), unsigned 32 bits + 324: spr224 (spr224), unsigned 32 bits + 325: spr225 (spr225), unsigned 32 bits + 326: spr226 (spr226), unsigned 32 bits + 327: spr227 (spr227), unsigned 32 bits + 328: spr228 (spr228), unsigned 32 bits + 329: spr229 (spr229), unsigned 32 bits + 330: spr230 (spr230), unsigned 32 bits + 331: spr231 (spr231), unsigned 32 bits + 332: spr232 (spr232), unsigned 32 bits + 333: spr233 (spr233), unsigned 32 bits + 334: spr234 (spr234), unsigned 32 bits + 335: spr235 (spr235), unsigned 32 bits + 336: spr236 (spr236), unsigned 32 bits + 337: spr237 (spr237), unsigned 32 bits + 338: spr238 (spr238), unsigned 32 bits + 339: spr239 (spr239), unsigned 32 bits + 340: spr240 (spr240), unsigned 32 bits + 341: spr241 (spr241), unsigned 32 bits + 342: spr242 (spr242), unsigned 32 bits + 343: spr243 (spr243), unsigned 32 bits + 344: spr244 (spr244), unsigned 32 bits + 345: spr245 (spr245), unsigned 32 bits + 346: spr246 (spr246), unsigned 32 bits + 347: spr247 (spr247), unsigned 32 bits + 348: spr248 (spr248), unsigned 32 bits + 349: spr249 (spr249), unsigned 32 bits + 350: spr250 (spr250), unsigned 32 bits + 351: spr251 (spr251), unsigned 32 bits + 352: spr252 (spr252), unsigned 32 bits + 353: spr253 (spr253), unsigned 32 bits + 354: spr254 (spr254), unsigned 32 bits + 355: spr255 (spr255), unsigned 32 bits + 357: spr257 (spr257), unsigned 32 bits + 358: spr258 (spr258), unsigned 32 bits + 359: spr259 (spr259), unsigned 32 bits + 360: spr260 (spr260), unsigned 32 bits + 361: spr261 (spr261), unsigned 32 bits + 362: spr262 (spr262), unsigned 32 bits + 363: spr263 (spr263), unsigned 32 bits + 364: spr264 (spr264), unsigned 32 bits + 365: spr265 (spr265), unsigned 32 bits + 366: spr266 (spr266), unsigned 32 bits + 367: spr267 (spr267), unsigned 32 bits + 368: spr268 (spr268), unsigned 32 bits + 369: spr269 (spr269), unsigned 32 bits + 370: spr270 (spr270), unsigned 32 bits + 371: spr271 (spr271), unsigned 32 bits + 372: spr272 (spr272), unsigned 32 bits + 373: spr273 (spr273), unsigned 32 bits + 374: spr274 (spr274), unsigned 32 bits + 375: spr275 (spr275), unsigned 32 bits + 376: spr276 (spr276), unsigned 32 bits + 377: spr277 (spr277), unsigned 32 bits + 378: spr278 (spr278), unsigned 32 bits + 379: spr279 (spr279), unsigned 32 bits + 380: spr280 (spr280), unsigned 32 bits + 381: spr281 (spr281), unsigned 32 bits + 382: spr282 (spr282), unsigned 32 bits + 383: spr283 (spr283), unsigned 32 bits + 384: spr284 (spr284), unsigned 32 bits + 385: spr285 (spr285), unsigned 32 bits + 386: spr286 (spr286), unsigned 32 bits + 387: spr287 (spr287), unsigned 32 bits + 388: spr288 (spr288), unsigned 32 bits + 389: spr289 (spr289), unsigned 32 bits + 390: spr290 (spr290), unsigned 32 bits + 391: spr291 (spr291), unsigned 32 bits + 392: spr292 (spr292), unsigned 32 bits + 393: spr293 (spr293), unsigned 32 bits + 394: spr294 (spr294), unsigned 32 bits + 395: spr295 (spr295), unsigned 32 bits + 396: spr296 (spr296), unsigned 32 bits + 397: spr297 (spr297), unsigned 32 bits + 398: spr298 (spr298), unsigned 32 bits + 399: spr299 (spr299), unsigned 32 bits + 400: spr300 (spr300), unsigned 32 bits + 401: spr301 (spr301), unsigned 32 bits + 402: spr302 (spr302), unsigned 32 bits + 403: spr303 (spr303), unsigned 32 bits + 404: spr304 (spr304), unsigned 32 bits + 405: spr305 (spr305), unsigned 32 bits + 406: spr306 (spr306), unsigned 32 bits + 407: spr307 (spr307), unsigned 32 bits + 408: spr308 (spr308), unsigned 32 bits + 409: spr309 (spr309), unsigned 32 bits + 410: spr310 (spr310), unsigned 32 bits + 411: spr311 (spr311), unsigned 32 bits + 412: spr312 (spr312), unsigned 32 bits + 413: spr313 (spr313), unsigned 32 bits + 414: spr314 (spr314), unsigned 32 bits + 415: spr315 (spr315), unsigned 32 bits + 416: spr316 (spr316), unsigned 32 bits + 417: spr317 (spr317), unsigned 32 bits + 418: spr318 (spr318), unsigned 32 bits + 419: spr319 (spr319), unsigned 32 bits + 420: spr320 (spr320), unsigned 32 bits + 421: spr321 (spr321), unsigned 32 bits + 422: spr322 (spr322), unsigned 32 bits + 423: spr323 (spr323), unsigned 32 bits + 424: spr324 (spr324), unsigned 32 bits + 425: spr325 (spr325), unsigned 32 bits + 426: spr326 (spr326), unsigned 32 bits + 427: spr327 (spr327), unsigned 32 bits + 428: spr328 (spr328), unsigned 32 bits + 429: spr329 (spr329), unsigned 32 bits + 430: spr330 (spr330), unsigned 32 bits + 431: spr331 (spr331), unsigned 32 bits + 432: spr332 (spr332), unsigned 32 bits + 433: spr333 (spr333), unsigned 32 bits + 434: spr334 (spr334), unsigned 32 bits + 435: spr335 (spr335), unsigned 32 bits + 436: spr336 (spr336), unsigned 32 bits + 437: spr337 (spr337), unsigned 32 bits + 438: spr338 (spr338), unsigned 32 bits + 439: spr339 (spr339), unsigned 32 bits + 440: spr340 (spr340), unsigned 32 bits + 441: spr341 (spr341), unsigned 32 bits + 442: spr342 (spr342), unsigned 32 bits + 443: spr343 (spr343), unsigned 32 bits + 444: spr344 (spr344), unsigned 32 bits + 445: spr345 (spr345), unsigned 32 bits + 446: spr346 (spr346), unsigned 32 bits + 447: spr347 (spr347), unsigned 32 bits + 448: spr348 (spr348), unsigned 32 bits + 449: spr349 (spr349), unsigned 32 bits + 450: spr350 (spr350), unsigned 32 bits + 451: spr351 (spr351), unsigned 32 bits + 452: spr352 (spr352), unsigned 32 bits + 453: spr353 (spr353), unsigned 32 bits + 454: spr354 (spr354), unsigned 32 bits + 455: spr355 (spr355), unsigned 32 bits + 456: spr356 (spr356), unsigned 32 bits + 457: spr357 (spr357), unsigned 32 bits + 458: spr358 (spr358), unsigned 32 bits + 459: spr359 (spr359), unsigned 32 bits + 460: spr360 (spr360), unsigned 32 bits + 461: spr361 (spr361), unsigned 32 bits + 462: spr362 (spr362), unsigned 32 bits + 463: spr363 (spr363), unsigned 32 bits + 464: spr364 (spr364), unsigned 32 bits + 465: spr365 (spr365), unsigned 32 bits + 466: spr366 (spr366), unsigned 32 bits + 467: spr367 (spr367), unsigned 32 bits + 468: spr368 (spr368), unsigned 32 bits + 469: spr369 (spr369), unsigned 32 bits + 470: spr370 (spr370), unsigned 32 bits + 471: spr371 (spr371), unsigned 32 bits + 472: spr372 (spr372), unsigned 32 bits + 473: spr373 (spr373), unsigned 32 bits + 474: spr374 (spr374), unsigned 32 bits + 475: spr375 (spr375), unsigned 32 bits + 476: spr376 (spr376), unsigned 32 bits + 477: spr377 (spr377), unsigned 32 bits + 478: spr378 (spr378), unsigned 32 bits + 479: spr379 (spr379), unsigned 32 bits + 480: spr380 (spr380), unsigned 32 bits + 481: spr381 (spr381), unsigned 32 bits + 482: spr382 (spr382), unsigned 32 bits + 483: spr383 (spr383), unsigned 32 bits + 484: spr384 (spr384), unsigned 32 bits + 485: spr385 (spr385), unsigned 32 bits + 486: spr386 (spr386), unsigned 32 bits + 487: spr387 (spr387), unsigned 32 bits + 488: spr388 (spr388), unsigned 32 bits + 489: spr389 (spr389), unsigned 32 bits + 490: spr390 (spr390), unsigned 32 bits + 491: spr391 (spr391), unsigned 32 bits + 492: spr392 (spr392), unsigned 32 bits + 493: spr393 (spr393), unsigned 32 bits + 494: spr394 (spr394), unsigned 32 bits + 495: spr395 (spr395), unsigned 32 bits + 496: spr396 (spr396), unsigned 32 bits + 497: spr397 (spr397), unsigned 32 bits + 498: spr398 (spr398), unsigned 32 bits + 499: spr399 (spr399), unsigned 32 bits + 500: spr400 (spr400), unsigned 32 bits + 501: spr401 (spr401), unsigned 32 bits + 502: spr402 (spr402), unsigned 32 bits + 503: spr403 (spr403), unsigned 32 bits + 504: spr404 (spr404), unsigned 32 bits + 505: spr405 (spr405), unsigned 32 bits + 506: spr406 (spr406), unsigned 32 bits + 507: spr407 (spr407), unsigned 32 bits + 508: spr408 (spr408), unsigned 32 bits + 509: spr409 (spr409), unsigned 32 bits + 510: spr410 (spr410), unsigned 32 bits + 511: spr411 (spr411), unsigned 32 bits + 512: spr412 (spr412), unsigned 32 bits + 513: spr413 (spr413), unsigned 32 bits + 514: spr414 (spr414), unsigned 32 bits + 515: spr415 (spr415), unsigned 32 bits + 516: spr416 (spr416), unsigned 32 bits + 517: spr417 (spr417), unsigned 32 bits + 518: spr418 (spr418), unsigned 32 bits + 519: spr419 (spr419), unsigned 32 bits + 520: spr420 (spr420), unsigned 32 bits + 521: spr421 (spr421), unsigned 32 bits + 522: spr422 (spr422), unsigned 32 bits + 523: spr423 (spr423), unsigned 32 bits + 524: spr424 (spr424), unsigned 32 bits + 525: spr425 (spr425), unsigned 32 bits + 526: spr426 (spr426), unsigned 32 bits + 527: spr427 (spr427), unsigned 32 bits + 528: spr428 (spr428), unsigned 32 bits + 529: spr429 (spr429), unsigned 32 bits + 530: spr430 (spr430), unsigned 32 bits + 531: spr431 (spr431), unsigned 32 bits + 532: spr432 (spr432), unsigned 32 bits + 533: spr433 (spr433), unsigned 32 bits + 534: spr434 (spr434), unsigned 32 bits + 535: spr435 (spr435), unsigned 32 bits + 536: spr436 (spr436), unsigned 32 bits + 537: spr437 (spr437), unsigned 32 bits + 538: spr438 (spr438), unsigned 32 bits + 539: spr439 (spr439), unsigned 32 bits + 540: spr440 (spr440), unsigned 32 bits + 541: spr441 (spr441), unsigned 32 bits + 542: spr442 (spr442), unsigned 32 bits + 543: spr443 (spr443), unsigned 32 bits + 544: spr444 (spr444), unsigned 32 bits + 545: spr445 (spr445), unsigned 32 bits + 546: spr446 (spr446), unsigned 32 bits + 547: spr447 (spr447), unsigned 32 bits + 548: spr448 (spr448), unsigned 32 bits + 549: spr449 (spr449), unsigned 32 bits + 550: spr450 (spr450), unsigned 32 bits + 551: spr451 (spr451), unsigned 32 bits + 552: spr452 (spr452), unsigned 32 bits + 553: spr453 (spr453), unsigned 32 bits + 554: spr454 (spr454), unsigned 32 bits + 555: spr455 (spr455), unsigned 32 bits + 556: spr456 (spr456), unsigned 32 bits + 557: spr457 (spr457), unsigned 32 bits + 558: spr458 (spr458), unsigned 32 bits + 559: spr459 (spr459), unsigned 32 bits + 560: spr460 (spr460), unsigned 32 bits + 561: spr461 (spr461), unsigned 32 bits + 562: spr462 (spr462), unsigned 32 bits + 563: spr463 (spr463), unsigned 32 bits + 564: spr464 (spr464), unsigned 32 bits + 565: spr465 (spr465), unsigned 32 bits + 566: spr466 (spr466), unsigned 32 bits + 567: spr467 (spr467), unsigned 32 bits + 568: spr468 (spr468), unsigned 32 bits + 569: spr469 (spr469), unsigned 32 bits + 570: spr470 (spr470), unsigned 32 bits + 571: spr471 (spr471), unsigned 32 bits + 572: spr472 (spr472), unsigned 32 bits + 573: spr473 (spr473), unsigned 32 bits + 574: spr474 (spr474), unsigned 32 bits + 575: spr475 (spr475), unsigned 32 bits + 576: spr476 (spr476), unsigned 32 bits + 577: spr477 (spr477), unsigned 32 bits + 578: spr478 (spr478), unsigned 32 bits + 579: spr479 (spr479), unsigned 32 bits + 580: spr480 (spr480), unsigned 32 bits + 581: spr481 (spr481), unsigned 32 bits + 582: spr482 (spr482), unsigned 32 bits + 583: spr483 (spr483), unsigned 32 bits + 584: spr484 (spr484), unsigned 32 bits + 585: spr485 (spr485), unsigned 32 bits + 586: spr486 (spr486), unsigned 32 bits + 587: spr487 (spr487), unsigned 32 bits + 588: spr488 (spr488), unsigned 32 bits + 589: spr489 (spr489), unsigned 32 bits + 590: spr490 (spr490), unsigned 32 bits + 591: spr491 (spr491), unsigned 32 bits + 592: spr492 (spr492), unsigned 32 bits + 593: spr493 (spr493), unsigned 32 bits + 594: spr494 (spr494), unsigned 32 bits + 595: spr495 (spr495), unsigned 32 bits + 596: spr496 (spr496), unsigned 32 bits + 597: spr497 (spr497), unsigned 32 bits + 598: spr498 (spr498), unsigned 32 bits + 599: spr499 (spr499), unsigned 32 bits + 600: spr500 (spr500), unsigned 32 bits + 601: spr501 (spr501), unsigned 32 bits + 602: spr502 (spr502), unsigned 32 bits + 603: spr503 (spr503), unsigned 32 bits + 604: spr504 (spr504), unsigned 32 bits + 605: spr505 (spr505), unsigned 32 bits + 606: spr506 (spr506), unsigned 32 bits + 607: spr507 (spr507), unsigned 32 bits + 608: spr508 (spr508), unsigned 32 bits + 609: spr509 (spr509), unsigned 32 bits + 610: spr510 (spr510), unsigned 32 bits + 611: spr511 (spr511), unsigned 32 bits + 613: spr513 (spr513), unsigned 32 bits + 614: spr514 (spr514), unsigned 32 bits + 615: spr515 (spr515), unsigned 32 bits + 616: spr516 (spr516), unsigned 32 bits + 617: spr517 (spr517), unsigned 32 bits + 618: spr518 (spr518), unsigned 32 bits + 619: spr519 (spr519), unsigned 32 bits + 620: spr520 (spr520), unsigned 32 bits + 621: spr521 (spr521), unsigned 32 bits + 622: spr522 (spr522), unsigned 32 bits + 623: spr523 (spr523), unsigned 32 bits + 624: spr524 (spr524), unsigned 32 bits + 625: spr525 (spr525), unsigned 32 bits + 626: spr526 (spr526), unsigned 32 bits + 627: spr527 (spr527), unsigned 32 bits + 628: spr528 (spr528), unsigned 32 bits + 629: spr529 (spr529), unsigned 32 bits + 630: spr530 (spr530), unsigned 32 bits + 631: spr531 (spr531), unsigned 32 bits + 632: spr532 (spr532), unsigned 32 bits + 633: spr533 (spr533), unsigned 32 bits + 634: spr534 (spr534), unsigned 32 bits + 635: spr535 (spr535), unsigned 32 bits + 636: spr536 (spr536), unsigned 32 bits + 637: spr537 (spr537), unsigned 32 bits + 638: spr538 (spr538), unsigned 32 bits + 639: spr539 (spr539), unsigned 32 bits + 640: spr540 (spr540), unsigned 32 bits + 641: spr541 (spr541), unsigned 32 bits + 642: spr542 (spr542), unsigned 32 bits + 643: spr543 (spr543), unsigned 32 bits + 644: spr544 (spr544), unsigned 32 bits + 645: spr545 (spr545), unsigned 32 bits + 646: spr546 (spr546), unsigned 32 bits + 647: spr547 (spr547), unsigned 32 bits + 648: spr548 (spr548), unsigned 32 bits + 649: spr549 (spr549), unsigned 32 bits + 650: spr550 (spr550), unsigned 32 bits + 651: spr551 (spr551), unsigned 32 bits + 652: spr552 (spr552), unsigned 32 bits + 653: spr553 (spr553), unsigned 32 bits + 654: spr554 (spr554), unsigned 32 bits + 655: spr555 (spr555), unsigned 32 bits + 656: spr556 (spr556), unsigned 32 bits + 657: spr557 (spr557), unsigned 32 bits + 658: spr558 (spr558), unsigned 32 bits + 659: spr559 (spr559), unsigned 32 bits + 660: spr560 (spr560), unsigned 32 bits + 661: spr561 (spr561), unsigned 32 bits + 662: spr562 (spr562), unsigned 32 bits + 663: spr563 (spr563), unsigned 32 bits + 664: spr564 (spr564), unsigned 32 bits + 665: spr565 (spr565), unsigned 32 bits + 666: spr566 (spr566), unsigned 32 bits + 667: spr567 (spr567), unsigned 32 bits + 668: spr568 (spr568), unsigned 32 bits + 669: spr569 (spr569), unsigned 32 bits + 670: spr570 (spr570), unsigned 32 bits + 671: spr571 (spr571), unsigned 32 bits + 672: spr572 (spr572), unsigned 32 bits + 673: spr573 (spr573), unsigned 32 bits + 674: spr574 (spr574), unsigned 32 bits + 675: spr575 (spr575), unsigned 32 bits + 676: spr576 (spr576), unsigned 32 bits + 677: spr577 (spr577), unsigned 32 bits + 678: spr578 (spr578), unsigned 32 bits + 679: spr579 (spr579), unsigned 32 bits + 680: spr580 (spr580), unsigned 32 bits + 681: spr581 (spr581), unsigned 32 bits + 682: spr582 (spr582), unsigned 32 bits + 683: spr583 (spr583), unsigned 32 bits + 684: spr584 (spr584), unsigned 32 bits + 685: spr585 (spr585), unsigned 32 bits + 686: spr586 (spr586), unsigned 32 bits + 687: spr587 (spr587), unsigned 32 bits + 688: spr588 (spr588), unsigned 32 bits + 689: spr589 (spr589), unsigned 32 bits + 690: spr590 (spr590), unsigned 32 bits + 691: spr591 (spr591), unsigned 32 bits + 692: spr592 (spr592), unsigned 32 bits + 693: spr593 (spr593), unsigned 32 bits + 694: spr594 (spr594), unsigned 32 bits + 695: spr595 (spr595), unsigned 32 bits + 696: spr596 (spr596), unsigned 32 bits + 697: spr597 (spr597), unsigned 32 bits + 698: spr598 (spr598), unsigned 32 bits + 699: spr599 (spr599), unsigned 32 bits + 700: spr600 (spr600), unsigned 32 bits + 701: spr601 (spr601), unsigned 32 bits + 702: spr602 (spr602), unsigned 32 bits + 703: spr603 (spr603), unsigned 32 bits + 704: spr604 (spr604), unsigned 32 bits + 705: spr605 (spr605), unsigned 32 bits + 706: spr606 (spr606), unsigned 32 bits + 707: spr607 (spr607), unsigned 32 bits + 708: spr608 (spr608), unsigned 32 bits + 709: spr609 (spr609), unsigned 32 bits + 710: spr610 (spr610), unsigned 32 bits + 711: spr611 (spr611), unsigned 32 bits + 712: spr612 (spr612), unsigned 32 bits + 713: spr613 (spr613), unsigned 32 bits + 714: spr614 (spr614), unsigned 32 bits + 715: spr615 (spr615), unsigned 32 bits + 716: spr616 (spr616), unsigned 32 bits + 717: spr617 (spr617), unsigned 32 bits + 718: spr618 (spr618), unsigned 32 bits + 719: spr619 (spr619), unsigned 32 bits + 720: spr620 (spr620), unsigned 32 bits + 721: spr621 (spr621), unsigned 32 bits + 722: spr622 (spr622), unsigned 32 bits + 723: spr623 (spr623), unsigned 32 bits + 724: spr624 (spr624), unsigned 32 bits + 725: spr625 (spr625), unsigned 32 bits + 726: spr626 (spr626), unsigned 32 bits + 727: spr627 (spr627), unsigned 32 bits + 728: spr628 (spr628), unsigned 32 bits + 729: spr629 (spr629), unsigned 32 bits + 730: spr630 (spr630), unsigned 32 bits + 731: spr631 (spr631), unsigned 32 bits + 732: spr632 (spr632), unsigned 32 bits + 733: spr633 (spr633), unsigned 32 bits + 734: spr634 (spr634), unsigned 32 bits + 735: spr635 (spr635), unsigned 32 bits + 736: spr636 (spr636), unsigned 32 bits + 737: spr637 (spr637), unsigned 32 bits + 738: spr638 (spr638), unsigned 32 bits + 739: spr639 (spr639), unsigned 32 bits + 740: spr640 (spr640), unsigned 32 bits + 741: spr641 (spr641), unsigned 32 bits + 742: spr642 (spr642), unsigned 32 bits + 743: spr643 (spr643), unsigned 32 bits + 744: spr644 (spr644), unsigned 32 bits + 745: spr645 (spr645), unsigned 32 bits + 746: spr646 (spr646), unsigned 32 bits + 747: spr647 (spr647), unsigned 32 bits + 748: spr648 (spr648), unsigned 32 bits + 749: spr649 (spr649), unsigned 32 bits + 750: spr650 (spr650), unsigned 32 bits + 751: spr651 (spr651), unsigned 32 bits + 752: spr652 (spr652), unsigned 32 bits + 753: spr653 (spr653), unsigned 32 bits + 754: spr654 (spr654), unsigned 32 bits + 755: spr655 (spr655), unsigned 32 bits + 756: spr656 (spr656), unsigned 32 bits + 757: spr657 (spr657), unsigned 32 bits + 758: spr658 (spr658), unsigned 32 bits + 759: spr659 (spr659), unsigned 32 bits + 760: spr660 (spr660), unsigned 32 bits + 761: spr661 (spr661), unsigned 32 bits + 762: spr662 (spr662), unsigned 32 bits + 763: spr663 (spr663), unsigned 32 bits + 764: spr664 (spr664), unsigned 32 bits + 765: spr665 (spr665), unsigned 32 bits + 766: spr666 (spr666), unsigned 32 bits + 767: spr667 (spr667), unsigned 32 bits + 768: spr668 (spr668), unsigned 32 bits + 769: spr669 (spr669), unsigned 32 bits + 770: spr670 (spr670), unsigned 32 bits + 771: spr671 (spr671), unsigned 32 bits + 772: spr672 (spr672), unsigned 32 bits + 773: spr673 (spr673), unsigned 32 bits + 774: spr674 (spr674), unsigned 32 bits + 775: spr675 (spr675), unsigned 32 bits + 776: spr676 (spr676), unsigned 32 bits + 777: spr677 (spr677), unsigned 32 bits + 778: spr678 (spr678), unsigned 32 bits + 779: spr679 (spr679), unsigned 32 bits + 780: spr680 (spr680), unsigned 32 bits + 781: spr681 (spr681), unsigned 32 bits + 782: spr682 (spr682), unsigned 32 bits + 783: spr683 (spr683), unsigned 32 bits + 784: spr684 (spr684), unsigned 32 bits + 785: spr685 (spr685), unsigned 32 bits + 786: spr686 (spr686), unsigned 32 bits + 787: spr687 (spr687), unsigned 32 bits + 788: spr688 (spr688), unsigned 32 bits + 789: spr689 (spr689), unsigned 32 bits + 790: spr690 (spr690), unsigned 32 bits + 791: spr691 (spr691), unsigned 32 bits + 792: spr692 (spr692), unsigned 32 bits + 793: spr693 (spr693), unsigned 32 bits + 794: spr694 (spr694), unsigned 32 bits + 795: spr695 (spr695), unsigned 32 bits + 796: spr696 (spr696), unsigned 32 bits + 797: spr697 (spr697), unsigned 32 bits + 798: spr698 (spr698), unsigned 32 bits + 799: spr699 (spr699), unsigned 32 bits + 800: spr700 (spr700), unsigned 32 bits + 801: spr701 (spr701), unsigned 32 bits + 802: spr702 (spr702), unsigned 32 bits + 803: spr703 (spr703), unsigned 32 bits + 804: spr704 (spr704), unsigned 32 bits + 805: spr705 (spr705), unsigned 32 bits + 806: spr706 (spr706), unsigned 32 bits + 807: spr707 (spr707), unsigned 32 bits + 808: spr708 (spr708), unsigned 32 bits + 809: spr709 (spr709), unsigned 32 bits + 810: spr710 (spr710), unsigned 32 bits + 811: spr711 (spr711), unsigned 32 bits + 812: spr712 (spr712), unsigned 32 bits + 813: spr713 (spr713), unsigned 32 bits + 814: spr714 (spr714), unsigned 32 bits + 815: spr715 (spr715), unsigned 32 bits + 816: spr716 (spr716), unsigned 32 bits + 817: spr717 (spr717), unsigned 32 bits + 818: spr718 (spr718), unsigned 32 bits + 819: spr719 (spr719), unsigned 32 bits + 820: spr720 (spr720), unsigned 32 bits + 821: spr721 (spr721), unsigned 32 bits + 822: spr722 (spr722), unsigned 32 bits + 823: spr723 (spr723), unsigned 32 bits + 824: spr724 (spr724), unsigned 32 bits + 825: spr725 (spr725), unsigned 32 bits + 826: spr726 (spr726), unsigned 32 bits + 827: spr727 (spr727), unsigned 32 bits + 828: spr728 (spr728), unsigned 32 bits + 829: spr729 (spr729), unsigned 32 bits + 830: spr730 (spr730), unsigned 32 bits + 831: spr731 (spr731), unsigned 32 bits + 832: spr732 (spr732), unsigned 32 bits + 833: spr733 (spr733), unsigned 32 bits + 834: spr734 (spr734), unsigned 32 bits + 835: spr735 (spr735), unsigned 32 bits + 836: spr736 (spr736), unsigned 32 bits + 837: spr737 (spr737), unsigned 32 bits + 838: spr738 (spr738), unsigned 32 bits + 839: spr739 (spr739), unsigned 32 bits + 840: spr740 (spr740), unsigned 32 bits + 841: spr741 (spr741), unsigned 32 bits + 842: spr742 (spr742), unsigned 32 bits + 843: spr743 (spr743), unsigned 32 bits + 844: spr744 (spr744), unsigned 32 bits + 845: spr745 (spr745), unsigned 32 bits + 846: spr746 (spr746), unsigned 32 bits + 847: spr747 (spr747), unsigned 32 bits + 848: spr748 (spr748), unsigned 32 bits + 849: spr749 (spr749), unsigned 32 bits + 850: spr750 (spr750), unsigned 32 bits + 851: spr751 (spr751), unsigned 32 bits + 852: spr752 (spr752), unsigned 32 bits + 853: spr753 (spr753), unsigned 32 bits + 854: spr754 (spr754), unsigned 32 bits + 855: spr755 (spr755), unsigned 32 bits + 856: spr756 (spr756), unsigned 32 bits + 857: spr757 (spr757), unsigned 32 bits + 858: spr758 (spr758), unsigned 32 bits + 859: spr759 (spr759), unsigned 32 bits + 860: spr760 (spr760), unsigned 32 bits + 861: spr761 (spr761), unsigned 32 bits + 862: spr762 (spr762), unsigned 32 bits + 863: spr763 (spr763), unsigned 32 bits + 864: spr764 (spr764), unsigned 32 bits + 865: spr765 (spr765), unsigned 32 bits + 866: spr766 (spr766), unsigned 32 bits + 867: spr767 (spr767), unsigned 32 bits + 868: spr768 (spr768), unsigned 32 bits + 869: spr769 (spr769), unsigned 32 bits + 870: spr770 (spr770), unsigned 32 bits + 871: spr771 (spr771), unsigned 32 bits + 872: spr772 (spr772), unsigned 32 bits + 873: spr773 (spr773), unsigned 32 bits + 874: spr774 (spr774), unsigned 32 bits + 875: spr775 (spr775), unsigned 32 bits + 876: spr776 (spr776), unsigned 32 bits + 877: spr777 (spr777), unsigned 32 bits + 878: spr778 (spr778), unsigned 32 bits + 879: spr779 (spr779), unsigned 32 bits + 880: spr780 (spr780), unsigned 32 bits + 881: spr781 (spr781), unsigned 32 bits + 882: spr782 (spr782), unsigned 32 bits + 883: spr783 (spr783), unsigned 32 bits + 884: spr784 (spr784), unsigned 32 bits + 885: spr785 (spr785), unsigned 32 bits + 886: spr786 (spr786), unsigned 32 bits + 887: spr787 (spr787), unsigned 32 bits + 888: spr788 (spr788), unsigned 32 bits + 889: spr789 (spr789), unsigned 32 bits + 890: spr790 (spr790), unsigned 32 bits + 891: spr791 (spr791), unsigned 32 bits + 892: spr792 (spr792), unsigned 32 bits + 893: spr793 (spr793), unsigned 32 bits + 894: spr794 (spr794), unsigned 32 bits + 895: spr795 (spr795), unsigned 32 bits + 896: spr796 (spr796), unsigned 32 bits + 897: spr797 (spr797), unsigned 32 bits + 898: spr798 (spr798), unsigned 32 bits + 899: spr799 (spr799), unsigned 32 bits + 900: spr800 (spr800), unsigned 32 bits + 901: spr801 (spr801), unsigned 32 bits + 902: spr802 (spr802), unsigned 32 bits + 903: spr803 (spr803), unsigned 32 bits + 904: spr804 (spr804), unsigned 32 bits + 905: spr805 (spr805), unsigned 32 bits + 906: spr806 (spr806), unsigned 32 bits + 907: spr807 (spr807), unsigned 32 bits + 908: spr808 (spr808), unsigned 32 bits + 909: spr809 (spr809), unsigned 32 bits + 910: spr810 (spr810), unsigned 32 bits + 911: spr811 (spr811), unsigned 32 bits + 912: spr812 (spr812), unsigned 32 bits + 913: spr813 (spr813), unsigned 32 bits + 914: spr814 (spr814), unsigned 32 bits + 915: spr815 (spr815), unsigned 32 bits + 916: spr816 (spr816), unsigned 32 bits + 917: spr817 (spr817), unsigned 32 bits + 918: spr818 (spr818), unsigned 32 bits + 919: spr819 (spr819), unsigned 32 bits + 920: spr820 (spr820), unsigned 32 bits + 921: spr821 (spr821), unsigned 32 bits + 922: spr822 (spr822), unsigned 32 bits + 923: spr823 (spr823), unsigned 32 bits + 924: spr824 (spr824), unsigned 32 bits + 925: spr825 (spr825), unsigned 32 bits + 926: spr826 (spr826), unsigned 32 bits + 927: spr827 (spr827), unsigned 32 bits + 928: spr828 (spr828), unsigned 32 bits + 929: spr829 (spr829), unsigned 32 bits + 930: spr830 (spr830), unsigned 32 bits + 931: spr831 (spr831), unsigned 32 bits + 932: spr832 (spr832), unsigned 32 bits + 933: spr833 (spr833), unsigned 32 bits + 934: spr834 (spr834), unsigned 32 bits + 935: spr835 (spr835), unsigned 32 bits + 936: spr836 (spr836), unsigned 32 bits + 937: spr837 (spr837), unsigned 32 bits + 938: spr838 (spr838), unsigned 32 bits + 939: spr839 (spr839), unsigned 32 bits + 940: spr840 (spr840), unsigned 32 bits + 941: spr841 (spr841), unsigned 32 bits + 942: spr842 (spr842), unsigned 32 bits + 943: spr843 (spr843), unsigned 32 bits + 944: spr844 (spr844), unsigned 32 bits + 945: spr845 (spr845), unsigned 32 bits + 946: spr846 (spr846), unsigned 32 bits + 947: spr847 (spr847), unsigned 32 bits + 948: spr848 (spr848), unsigned 32 bits + 949: spr849 (spr849), unsigned 32 bits + 950: spr850 (spr850), unsigned 32 bits + 951: spr851 (spr851), unsigned 32 bits + 952: spr852 (spr852), unsigned 32 bits + 953: spr853 (spr853), unsigned 32 bits + 954: spr854 (spr854), unsigned 32 bits + 955: spr855 (spr855), unsigned 32 bits + 956: spr856 (spr856), unsigned 32 bits + 957: spr857 (spr857), unsigned 32 bits + 958: spr858 (spr858), unsigned 32 bits + 959: spr859 (spr859), unsigned 32 bits + 960: spr860 (spr860), unsigned 32 bits + 961: spr861 (spr861), unsigned 32 bits + 962: spr862 (spr862), unsigned 32 bits + 963: spr863 (spr863), unsigned 32 bits + 964: spr864 (spr864), unsigned 32 bits + 965: spr865 (spr865), unsigned 32 bits + 966: spr866 (spr866), unsigned 32 bits + 967: spr867 (spr867), unsigned 32 bits + 968: spr868 (spr868), unsigned 32 bits + 969: spr869 (spr869), unsigned 32 bits + 970: spr870 (spr870), unsigned 32 bits + 971: spr871 (spr871), unsigned 32 bits + 972: spr872 (spr872), unsigned 32 bits + 973: spr873 (spr873), unsigned 32 bits + 974: spr874 (spr874), unsigned 32 bits + 975: spr875 (spr875), unsigned 32 bits + 976: spr876 (spr876), unsigned 32 bits + 977: spr877 (spr877), unsigned 32 bits + 978: spr878 (spr878), unsigned 32 bits + 979: spr879 (spr879), unsigned 32 bits + 980: spr880 (spr880), unsigned 32 bits + 981: spr881 (spr881), unsigned 32 bits + 982: spr882 (spr882), unsigned 32 bits + 983: spr883 (spr883), unsigned 32 bits + 984: spr884 (spr884), unsigned 32 bits + 985: spr885 (spr885), unsigned 32 bits + 986: spr886 (spr886), unsigned 32 bits + 987: spr887 (spr887), unsigned 32 bits + 988: spr888 (spr888), unsigned 32 bits + 989: spr889 (spr889), unsigned 32 bits + 990: spr890 (spr890), unsigned 32 bits + 991: spr891 (spr891), unsigned 32 bits + 992: spr892 (spr892), unsigned 32 bits + 993: spr893 (spr893), unsigned 32 bits + 994: spr894 (spr894), unsigned 32 bits + 995: spr895 (spr895), unsigned 32 bits + 996: spr896 (spr896), unsigned 32 bits + 997: spr897 (spr897), unsigned 32 bits + 998: spr898 (spr898), unsigned 32 bits + 999: spr899 (spr899), unsigned 32 bits +vector registers: + 67: vscr (vscr), unsigned 32 bits + 356: vrsave (vrsave), unsigned 32 bits + 612: spefscr (spefscr), unsigned 32 bits + 1124: vr0 (vr0), unsigned 128 bits + 1125: vr1 (vr1), unsigned 128 bits + 1126: vr2 (vr2), unsigned 128 bits + 1127: vr3 (vr3), unsigned 128 bits + 1128: vr4 (vr4), unsigned 128 bits + 1129: vr5 (vr5), unsigned 128 bits + 1130: vr6 (vr6), unsigned 128 bits + 1131: vr7 (vr7), unsigned 128 bits + 1132: vr8 (vr8), unsigned 128 bits + 1133: vr9 (vr9), unsigned 128 bits + 1134: vr10 (vr10), unsigned 128 bits + 1135: vr11 (vr11), unsigned 128 bits + 1136: vr12 (vr12), unsigned 128 bits + 1137: vr13 (vr13), unsigned 128 bits + 1138: vr14 (vr14), unsigned 128 bits + 1139: vr15 (vr15), unsigned 128 bits + 1140: vr16 (vr16), unsigned 128 bits + 1141: vr17 (vr17), unsigned 128 bits + 1142: vr18 (vr18), unsigned 128 bits + 1143: vr19 (vr19), unsigned 128 bits + 1144: vr20 (vr20), unsigned 128 bits + 1145: vr21 (vr21), unsigned 128 bits + 1146: vr22 (vr22), unsigned 128 bits + 1147: vr23 (vr23), unsigned 128 bits + 1148: vr24 (vr24), unsigned 128 bits + 1149: vr25 (vr25), unsigned 128 bits + 1150: vr26 (vr26), unsigned 128 bits + 1151: vr27 (vr27), unsigned 128 bits + 1152: vr28 (vr28), unsigned 128 bits + 1153: vr29 (vr29), unsigned 128 bits + 1154: vr30 (vr30), unsigned 128 bits + 1155: vr31 (vr31), unsigned 128 bits +EOF + +regs_test testfile23 <<\EOF +integer registers: + 0: r0 (r0), signed 64 bits + 1: r1 (r1), signed 64 bits + 2: r2 (r2), signed 64 bits + 3: r3 (r3), signed 64 bits + 4: r4 (r4), signed 64 bits + 5: r5 (r5), signed 64 bits + 6: r6 (r6), signed 64 bits + 7: r7 (r7), signed 64 bits + 8: r8 (r8), signed 64 bits + 9: r9 (r9), signed 64 bits + 10: r10 (r10), signed 64 bits + 11: r11 (r11), signed 64 bits + 12: r12 (r12), signed 64 bits + 13: r13 (r13), signed 64 bits + 14: r14 (r14), signed 64 bits + 15: r15 (r15), signed 64 bits + 16: r16 (r16), signed 64 bits + 17: r17 (r17), signed 64 bits + 18: r18 (r18), signed 64 bits + 19: r19 (r19), signed 64 bits + 20: r20 (r20), signed 64 bits + 21: r21 (r21), signed 64 bits + 22: r22 (r22), signed 64 bits + 23: r23 (r23), signed 64 bits + 24: r24 (r24), signed 64 bits + 25: r25 (r25), signed 64 bits + 26: r26 (r26), signed 64 bits + 27: r27 (r27), signed 64 bits + 28: r28 (r28), signed 64 bits + 29: r29 (r29), signed 64 bits + 30: r30 (r30), signed 64 bits + 31: r31 (r31), signed 64 bits + 64: cr (cr), unsigned 64 bits + 66: msr (msr), unsigned 64 bits +FPU registers: + 32: f0 (f0), float 64 bits + 33: f1 (f1), float 64 bits + 34: f2 (f2), float 64 bits + 35: f3 (f3), float 64 bits + 36: f4 (f4), float 64 bits + 37: f5 (f5), float 64 bits + 38: f6 (f6), float 64 bits + 39: f7 (f7), float 64 bits + 40: f8 (f8), float 64 bits + 41: f9 (f9), float 64 bits + 42: f10 (f10), float 64 bits + 43: f11 (f11), float 64 bits + 44: f12 (f12), float 64 bits + 45: f13 (f13), float 64 bits + 46: f14 (f14), float 64 bits + 47: f15 (f15), float 64 bits + 48: f16 (f16), float 64 bits + 49: f17 (f17), float 64 bits + 50: f18 (f18), float 64 bits + 51: f19 (f19), float 64 bits + 52: f20 (f20), float 64 bits + 53: f21 (f21), float 64 bits + 54: f22 (f22), float 64 bits + 55: f23 (f23), float 64 bits + 56: f24 (f24), float 64 bits + 57: f25 (f25), float 64 bits + 58: f26 (f26), float 64 bits + 59: f27 (f27), float 64 bits + 60: f28 (f28), float 64 bits + 61: f29 (f29), float 64 bits + 62: f30 (f30), float 64 bits + 63: f31 (f31), float 64 bits + 65: fpscr (fpscr), unsigned 64 bits +privileged registers: + 70: sr0 (sr0), unsigned 64 bits + 71: sr1 (sr1), unsigned 64 bits + 72: sr2 (sr2), unsigned 64 bits + 73: sr3 (sr3), unsigned 64 bits + 74: sr4 (sr4), unsigned 64 bits + 75: sr5 (sr5), unsigned 64 bits + 76: sr6 (sr6), unsigned 64 bits + 77: sr7 (sr7), unsigned 64 bits + 78: sr8 (sr8), unsigned 64 bits + 79: sr9 (sr9), unsigned 64 bits + 80: sr10 (sr10), unsigned 64 bits + 81: sr11 (sr11), unsigned 64 bits + 82: sr12 (sr12), unsigned 64 bits + 83: sr13 (sr13), unsigned 64 bits + 84: sr14 (sr14), unsigned 64 bits + 85: sr15 (sr15), unsigned 64 bits + 100: spr0 (spr0), unsigned 64 bits + 101: xer (xer), unsigned 64 bits + 102: spr2 (spr2), unsigned 64 bits + 103: spr3 (spr3), unsigned 64 bits + 104: spr4 (spr4), unsigned 64 bits + 105: spr5 (spr5), unsigned 64 bits + 106: spr6 (spr6), unsigned 64 bits + 107: spr7 (spr7), unsigned 64 bits + 108: lr (lr), unsigned 64 bits + 109: ctr (ctr), unsigned 64 bits + 110: spr10 (spr10), unsigned 64 bits + 111: spr11 (spr11), unsigned 64 bits + 112: spr12 (spr12), unsigned 64 bits + 113: spr13 (spr13), unsigned 64 bits + 114: spr14 (spr14), unsigned 64 bits + 115: spr15 (spr15), unsigned 64 bits + 116: spr16 (spr16), unsigned 64 bits + 117: spr17 (spr17), unsigned 64 bits + 118: dsisr (dsisr), unsigned 64 bits + 119: dar (dar), unsigned 64 bits + 120: spr20 (spr20), unsigned 64 bits + 121: spr21 (spr21), unsigned 64 bits + 122: dec (dec), unsigned 64 bits + 123: spr23 (spr23), unsigned 64 bits + 124: spr24 (spr24), unsigned 64 bits + 125: spr25 (spr25), unsigned 64 bits + 126: spr26 (spr26), unsigned 64 bits + 127: spr27 (spr27), unsigned 64 bits + 128: spr28 (spr28), unsigned 64 bits + 129: spr29 (spr29), unsigned 64 bits + 130: spr30 (spr30), unsigned 64 bits + 131: spr31 (spr31), unsigned 64 bits + 132: spr32 (spr32), unsigned 64 bits + 133: spr33 (spr33), unsigned 64 bits + 134: spr34 (spr34), unsigned 64 bits + 135: spr35 (spr35), unsigned 64 bits + 136: spr36 (spr36), unsigned 64 bits + 137: spr37 (spr37), unsigned 64 bits + 138: spr38 (spr38), unsigned 64 bits + 139: spr39 (spr39), unsigned 64 bits + 140: spr40 (spr40), unsigned 64 bits + 141: spr41 (spr41), unsigned 64 bits + 142: spr42 (spr42), unsigned 64 bits + 143: spr43 (spr43), unsigned 64 bits + 144: spr44 (spr44), unsigned 64 bits + 145: spr45 (spr45), unsigned 64 bits + 146: spr46 (spr46), unsigned 64 bits + 147: spr47 (spr47), unsigned 64 bits + 148: spr48 (spr48), unsigned 64 bits + 149: spr49 (spr49), unsigned 64 bits + 150: spr50 (spr50), unsigned 64 bits + 151: spr51 (spr51), unsigned 64 bits + 152: spr52 (spr52), unsigned 64 bits + 153: spr53 (spr53), unsigned 64 bits + 154: spr54 (spr54), unsigned 64 bits + 155: spr55 (spr55), unsigned 64 bits + 156: spr56 (spr56), unsigned 64 bits + 157: spr57 (spr57), unsigned 64 bits + 158: spr58 (spr58), unsigned 64 bits + 159: spr59 (spr59), unsigned 64 bits + 160: spr60 (spr60), unsigned 64 bits + 161: spr61 (spr61), unsigned 64 bits + 162: spr62 (spr62), unsigned 64 bits + 163: spr63 (spr63), unsigned 64 bits + 164: spr64 (spr64), unsigned 64 bits + 165: spr65 (spr65), unsigned 64 bits + 166: spr66 (spr66), unsigned 64 bits + 167: spr67 (spr67), unsigned 64 bits + 168: spr68 (spr68), unsigned 64 bits + 169: spr69 (spr69), unsigned 64 bits + 170: spr70 (spr70), unsigned 64 bits + 171: spr71 (spr71), unsigned 64 bits + 172: spr72 (spr72), unsigned 64 bits + 173: spr73 (spr73), unsigned 64 bits + 174: spr74 (spr74), unsigned 64 bits + 175: spr75 (spr75), unsigned 64 bits + 176: spr76 (spr76), unsigned 64 bits + 177: spr77 (spr77), unsigned 64 bits + 178: spr78 (spr78), unsigned 64 bits + 179: spr79 (spr79), unsigned 64 bits + 180: spr80 (spr80), unsigned 64 bits + 181: spr81 (spr81), unsigned 64 bits + 182: spr82 (spr82), unsigned 64 bits + 183: spr83 (spr83), unsigned 64 bits + 184: spr84 (spr84), unsigned 64 bits + 185: spr85 (spr85), unsigned 64 bits + 186: spr86 (spr86), unsigned 64 bits + 187: spr87 (spr87), unsigned 64 bits + 188: spr88 (spr88), unsigned 64 bits + 189: spr89 (spr89), unsigned 64 bits + 190: spr90 (spr90), unsigned 64 bits + 191: spr91 (spr91), unsigned 64 bits + 192: spr92 (spr92), unsigned 64 bits + 193: spr93 (spr93), unsigned 64 bits + 194: spr94 (spr94), unsigned 64 bits + 195: spr95 (spr95), unsigned 64 bits + 196: spr96 (spr96), unsigned 64 bits + 197: spr97 (spr97), unsigned 64 bits + 198: spr98 (spr98), unsigned 64 bits + 199: spr99 (spr99), unsigned 64 bits + 200: spr100 (spr100), unsigned 64 bits + 201: spr101 (spr101), unsigned 64 bits + 202: spr102 (spr102), unsigned 64 bits + 203: spr103 (spr103), unsigned 64 bits + 204: spr104 (spr104), unsigned 64 bits + 205: spr105 (spr105), unsigned 64 bits + 206: spr106 (spr106), unsigned 64 bits + 207: spr107 (spr107), unsigned 64 bits + 208: spr108 (spr108), unsigned 64 bits + 209: spr109 (spr109), unsigned 64 bits + 210: spr110 (spr110), unsigned 64 bits + 211: spr111 (spr111), unsigned 64 bits + 212: spr112 (spr112), unsigned 64 bits + 213: spr113 (spr113), unsigned 64 bits + 214: spr114 (spr114), unsigned 64 bits + 215: spr115 (spr115), unsigned 64 bits + 216: spr116 (spr116), unsigned 64 bits + 217: spr117 (spr117), unsigned 64 bits + 218: spr118 (spr118), unsigned 64 bits + 219: spr119 (spr119), unsigned 64 bits + 220: spr120 (spr120), unsigned 64 bits + 221: spr121 (spr121), unsigned 64 bits + 222: spr122 (spr122), unsigned 64 bits + 223: spr123 (spr123), unsigned 64 bits + 224: spr124 (spr124), unsigned 64 bits + 225: spr125 (spr125), unsigned 64 bits + 226: spr126 (spr126), unsigned 64 bits + 227: spr127 (spr127), unsigned 64 bits + 228: spr128 (spr128), unsigned 64 bits + 229: spr129 (spr129), unsigned 64 bits + 230: spr130 (spr130), unsigned 64 bits + 231: spr131 (spr131), unsigned 64 bits + 232: spr132 (spr132), unsigned 64 bits + 233: spr133 (spr133), unsigned 64 bits + 234: spr134 (spr134), unsigned 64 bits + 235: spr135 (spr135), unsigned 64 bits + 236: spr136 (spr136), unsigned 64 bits + 237: spr137 (spr137), unsigned 64 bits + 238: spr138 (spr138), unsigned 64 bits + 239: spr139 (spr139), unsigned 64 bits + 240: spr140 (spr140), unsigned 64 bits + 241: spr141 (spr141), unsigned 64 bits + 242: spr142 (spr142), unsigned 64 bits + 243: spr143 (spr143), unsigned 64 bits + 244: spr144 (spr144), unsigned 64 bits + 245: spr145 (spr145), unsigned 64 bits + 246: spr146 (spr146), unsigned 64 bits + 247: spr147 (spr147), unsigned 64 bits + 248: spr148 (spr148), unsigned 64 bits + 249: spr149 (spr149), unsigned 64 bits + 250: spr150 (spr150), unsigned 64 bits + 251: spr151 (spr151), unsigned 64 bits + 252: spr152 (spr152), unsigned 64 bits + 253: spr153 (spr153), unsigned 64 bits + 254: spr154 (spr154), unsigned 64 bits + 255: spr155 (spr155), unsigned 64 bits + 256: spr156 (spr156), unsigned 64 bits + 257: spr157 (spr157), unsigned 64 bits + 258: spr158 (spr158), unsigned 64 bits + 259: spr159 (spr159), unsigned 64 bits + 260: spr160 (spr160), unsigned 64 bits + 261: spr161 (spr161), unsigned 64 bits + 262: spr162 (spr162), unsigned 64 bits + 263: spr163 (spr163), unsigned 64 bits + 264: spr164 (spr164), unsigned 64 bits + 265: spr165 (spr165), unsigned 64 bits + 266: spr166 (spr166), unsigned 64 bits + 267: spr167 (spr167), unsigned 64 bits + 268: spr168 (spr168), unsigned 64 bits + 269: spr169 (spr169), unsigned 64 bits + 270: spr170 (spr170), unsigned 64 bits + 271: spr171 (spr171), unsigned 64 bits + 272: spr172 (spr172), unsigned 64 bits + 273: spr173 (spr173), unsigned 64 bits + 274: spr174 (spr174), unsigned 64 bits + 275: spr175 (spr175), unsigned 64 bits + 276: spr176 (spr176), unsigned 64 bits + 277: spr177 (spr177), unsigned 64 bits + 278: spr178 (spr178), unsigned 64 bits + 279: spr179 (spr179), unsigned 64 bits + 280: spr180 (spr180), unsigned 64 bits + 281: spr181 (spr181), unsigned 64 bits + 282: spr182 (spr182), unsigned 64 bits + 283: spr183 (spr183), unsigned 64 bits + 284: spr184 (spr184), unsigned 64 bits + 285: spr185 (spr185), unsigned 64 bits + 286: spr186 (spr186), unsigned 64 bits + 287: spr187 (spr187), unsigned 64 bits + 288: spr188 (spr188), unsigned 64 bits + 289: spr189 (spr189), unsigned 64 bits + 290: spr190 (spr190), unsigned 64 bits + 291: spr191 (spr191), unsigned 64 bits + 292: spr192 (spr192), unsigned 64 bits + 293: spr193 (spr193), unsigned 64 bits + 294: spr194 (spr194), unsigned 64 bits + 295: spr195 (spr195), unsigned 64 bits + 296: spr196 (spr196), unsigned 64 bits + 297: spr197 (spr197), unsigned 64 bits + 298: spr198 (spr198), unsigned 64 bits + 299: spr199 (spr199), unsigned 64 bits + 300: spr200 (spr200), unsigned 64 bits + 301: spr201 (spr201), unsigned 64 bits + 302: spr202 (spr202), unsigned 64 bits + 303: spr203 (spr203), unsigned 64 bits + 304: spr204 (spr204), unsigned 64 bits + 305: spr205 (spr205), unsigned 64 bits + 306: spr206 (spr206), unsigned 64 bits + 307: spr207 (spr207), unsigned 64 bits + 308: spr208 (spr208), unsigned 64 bits + 309: spr209 (spr209), unsigned 64 bits + 310: spr210 (spr210), unsigned 64 bits + 311: spr211 (spr211), unsigned 64 bits + 312: spr212 (spr212), unsigned 64 bits + 313: spr213 (spr213), unsigned 64 bits + 314: spr214 (spr214), unsigned 64 bits + 315: spr215 (spr215), unsigned 64 bits + 316: spr216 (spr216), unsigned 64 bits + 317: spr217 (spr217), unsigned 64 bits + 318: spr218 (spr218), unsigned 64 bits + 319: spr219 (spr219), unsigned 64 bits + 320: spr220 (spr220), unsigned 64 bits + 321: spr221 (spr221), unsigned 64 bits + 322: spr222 (spr222), unsigned 64 bits + 323: spr223 (spr223), unsigned 64 bits + 324: spr224 (spr224), unsigned 64 bits + 325: spr225 (spr225), unsigned 64 bits + 326: spr226 (spr226), unsigned 64 bits + 327: spr227 (spr227), unsigned 64 bits + 328: spr228 (spr228), unsigned 64 bits + 329: spr229 (spr229), unsigned 64 bits + 330: spr230 (spr230), unsigned 64 bits + 331: spr231 (spr231), unsigned 64 bits + 332: spr232 (spr232), unsigned 64 bits + 333: spr233 (spr233), unsigned 64 bits + 334: spr234 (spr234), unsigned 64 bits + 335: spr235 (spr235), unsigned 64 bits + 336: spr236 (spr236), unsigned 64 bits + 337: spr237 (spr237), unsigned 64 bits + 338: spr238 (spr238), unsigned 64 bits + 339: spr239 (spr239), unsigned 64 bits + 340: spr240 (spr240), unsigned 64 bits + 341: spr241 (spr241), unsigned 64 bits + 342: spr242 (spr242), unsigned 64 bits + 343: spr243 (spr243), unsigned 64 bits + 344: spr244 (spr244), unsigned 64 bits + 345: spr245 (spr245), unsigned 64 bits + 346: spr246 (spr246), unsigned 64 bits + 347: spr247 (spr247), unsigned 64 bits + 348: spr248 (spr248), unsigned 64 bits + 349: spr249 (spr249), unsigned 64 bits + 350: spr250 (spr250), unsigned 64 bits + 351: spr251 (spr251), unsigned 64 bits + 352: spr252 (spr252), unsigned 64 bits + 353: spr253 (spr253), unsigned 64 bits + 354: spr254 (spr254), unsigned 64 bits + 355: spr255 (spr255), unsigned 64 bits + 357: spr257 (spr257), unsigned 64 bits + 358: spr258 (spr258), unsigned 64 bits + 359: spr259 (spr259), unsigned 64 bits + 360: spr260 (spr260), unsigned 64 bits + 361: spr261 (spr261), unsigned 64 bits + 362: spr262 (spr262), unsigned 64 bits + 363: spr263 (spr263), unsigned 64 bits + 364: spr264 (spr264), unsigned 64 bits + 365: spr265 (spr265), unsigned 64 bits + 366: spr266 (spr266), unsigned 64 bits + 367: spr267 (spr267), unsigned 64 bits + 368: spr268 (spr268), unsigned 64 bits + 369: spr269 (spr269), unsigned 64 bits + 370: spr270 (spr270), unsigned 64 bits + 371: spr271 (spr271), unsigned 64 bits + 372: spr272 (spr272), unsigned 64 bits + 373: spr273 (spr273), unsigned 64 bits + 374: spr274 (spr274), unsigned 64 bits + 375: spr275 (spr275), unsigned 64 bits + 376: spr276 (spr276), unsigned 64 bits + 377: spr277 (spr277), unsigned 64 bits + 378: spr278 (spr278), unsigned 64 bits + 379: spr279 (spr279), unsigned 64 bits + 380: spr280 (spr280), unsigned 64 bits + 381: spr281 (spr281), unsigned 64 bits + 382: spr282 (spr282), unsigned 64 bits + 383: spr283 (spr283), unsigned 64 bits + 384: spr284 (spr284), unsigned 64 bits + 385: spr285 (spr285), unsigned 64 bits + 386: spr286 (spr286), unsigned 64 bits + 387: spr287 (spr287), unsigned 64 bits + 388: spr288 (spr288), unsigned 64 bits + 389: spr289 (spr289), unsigned 64 bits + 390: spr290 (spr290), unsigned 64 bits + 391: spr291 (spr291), unsigned 64 bits + 392: spr292 (spr292), unsigned 64 bits + 393: spr293 (spr293), unsigned 64 bits + 394: spr294 (spr294), unsigned 64 bits + 395: spr295 (spr295), unsigned 64 bits + 396: spr296 (spr296), unsigned 64 bits + 397: spr297 (spr297), unsigned 64 bits + 398: spr298 (spr298), unsigned 64 bits + 399: spr299 (spr299), unsigned 64 bits + 400: spr300 (spr300), unsigned 64 bits + 401: spr301 (spr301), unsigned 64 bits + 402: spr302 (spr302), unsigned 64 bits + 403: spr303 (spr303), unsigned 64 bits + 404: spr304 (spr304), unsigned 64 bits + 405: spr305 (spr305), unsigned 64 bits + 406: spr306 (spr306), unsigned 64 bits + 407: spr307 (spr307), unsigned 64 bits + 408: spr308 (spr308), unsigned 64 bits + 409: spr309 (spr309), unsigned 64 bits + 410: spr310 (spr310), unsigned 64 bits + 411: spr311 (spr311), unsigned 64 bits + 412: spr312 (spr312), unsigned 64 bits + 413: spr313 (spr313), unsigned 64 bits + 414: spr314 (spr314), unsigned 64 bits + 415: spr315 (spr315), unsigned 64 bits + 416: spr316 (spr316), unsigned 64 bits + 417: spr317 (spr317), unsigned 64 bits + 418: spr318 (spr318), unsigned 64 bits + 419: spr319 (spr319), unsigned 64 bits + 420: spr320 (spr320), unsigned 64 bits + 421: spr321 (spr321), unsigned 64 bits + 422: spr322 (spr322), unsigned 64 bits + 423: spr323 (spr323), unsigned 64 bits + 424: spr324 (spr324), unsigned 64 bits + 425: spr325 (spr325), unsigned 64 bits + 426: spr326 (spr326), unsigned 64 bits + 427: spr327 (spr327), unsigned 64 bits + 428: spr328 (spr328), unsigned 64 bits + 429: spr329 (spr329), unsigned 64 bits + 430: spr330 (spr330), unsigned 64 bits + 431: spr331 (spr331), unsigned 64 bits + 432: spr332 (spr332), unsigned 64 bits + 433: spr333 (spr333), unsigned 64 bits + 434: spr334 (spr334), unsigned 64 bits + 435: spr335 (spr335), unsigned 64 bits + 436: spr336 (spr336), unsigned 64 bits + 437: spr337 (spr337), unsigned 64 bits + 438: spr338 (spr338), unsigned 64 bits + 439: spr339 (spr339), unsigned 64 bits + 440: spr340 (spr340), unsigned 64 bits + 441: spr341 (spr341), unsigned 64 bits + 442: spr342 (spr342), unsigned 64 bits + 443: spr343 (spr343), unsigned 64 bits + 444: spr344 (spr344), unsigned 64 bits + 445: spr345 (spr345), unsigned 64 bits + 446: spr346 (spr346), unsigned 64 bits + 447: spr347 (spr347), unsigned 64 bits + 448: spr348 (spr348), unsigned 64 bits + 449: spr349 (spr349), unsigned 64 bits + 450: spr350 (spr350), unsigned 64 bits + 451: spr351 (spr351), unsigned 64 bits + 452: spr352 (spr352), unsigned 64 bits + 453: spr353 (spr353), unsigned 64 bits + 454: spr354 (spr354), unsigned 64 bits + 455: spr355 (spr355), unsigned 64 bits + 456: spr356 (spr356), unsigned 64 bits + 457: spr357 (spr357), unsigned 64 bits + 458: spr358 (spr358), unsigned 64 bits + 459: spr359 (spr359), unsigned 64 bits + 460: spr360 (spr360), unsigned 64 bits + 461: spr361 (spr361), unsigned 64 bits + 462: spr362 (spr362), unsigned 64 bits + 463: spr363 (spr363), unsigned 64 bits + 464: spr364 (spr364), unsigned 64 bits + 465: spr365 (spr365), unsigned 64 bits + 466: spr366 (spr366), unsigned 64 bits + 467: spr367 (spr367), unsigned 64 bits + 468: spr368 (spr368), unsigned 64 bits + 469: spr369 (spr369), unsigned 64 bits + 470: spr370 (spr370), unsigned 64 bits + 471: spr371 (spr371), unsigned 64 bits + 472: spr372 (spr372), unsigned 64 bits + 473: spr373 (spr373), unsigned 64 bits + 474: spr374 (spr374), unsigned 64 bits + 475: spr375 (spr375), unsigned 64 bits + 476: spr376 (spr376), unsigned 64 bits + 477: spr377 (spr377), unsigned 64 bits + 478: spr378 (spr378), unsigned 64 bits + 479: spr379 (spr379), unsigned 64 bits + 480: spr380 (spr380), unsigned 64 bits + 481: spr381 (spr381), unsigned 64 bits + 482: spr382 (spr382), unsigned 64 bits + 483: spr383 (spr383), unsigned 64 bits + 484: spr384 (spr384), unsigned 64 bits + 485: spr385 (spr385), unsigned 64 bits + 486: spr386 (spr386), unsigned 64 bits + 487: spr387 (spr387), unsigned 64 bits + 488: spr388 (spr388), unsigned 64 bits + 489: spr389 (spr389), unsigned 64 bits + 490: spr390 (spr390), unsigned 64 bits + 491: spr391 (spr391), unsigned 64 bits + 492: spr392 (spr392), unsigned 64 bits + 493: spr393 (spr393), unsigned 64 bits + 494: spr394 (spr394), unsigned 64 bits + 495: spr395 (spr395), unsigned 64 bits + 496: spr396 (spr396), unsigned 64 bits + 497: spr397 (spr397), unsigned 64 bits + 498: spr398 (spr398), unsigned 64 bits + 499: spr399 (spr399), unsigned 64 bits + 500: spr400 (spr400), unsigned 64 bits + 501: spr401 (spr401), unsigned 64 bits + 502: spr402 (spr402), unsigned 64 bits + 503: spr403 (spr403), unsigned 64 bits + 504: spr404 (spr404), unsigned 64 bits + 505: spr405 (spr405), unsigned 64 bits + 506: spr406 (spr406), unsigned 64 bits + 507: spr407 (spr407), unsigned 64 bits + 508: spr408 (spr408), unsigned 64 bits + 509: spr409 (spr409), unsigned 64 bits + 510: spr410 (spr410), unsigned 64 bits + 511: spr411 (spr411), unsigned 64 bits + 512: spr412 (spr412), unsigned 64 bits + 513: spr413 (spr413), unsigned 64 bits + 514: spr414 (spr414), unsigned 64 bits + 515: spr415 (spr415), unsigned 64 bits + 516: spr416 (spr416), unsigned 64 bits + 517: spr417 (spr417), unsigned 64 bits + 518: spr418 (spr418), unsigned 64 bits + 519: spr419 (spr419), unsigned 64 bits + 520: spr420 (spr420), unsigned 64 bits + 521: spr421 (spr421), unsigned 64 bits + 522: spr422 (spr422), unsigned 64 bits + 523: spr423 (spr423), unsigned 64 bits + 524: spr424 (spr424), unsigned 64 bits + 525: spr425 (spr425), unsigned 64 bits + 526: spr426 (spr426), unsigned 64 bits + 527: spr427 (spr427), unsigned 64 bits + 528: spr428 (spr428), unsigned 64 bits + 529: spr429 (spr429), unsigned 64 bits + 530: spr430 (spr430), unsigned 64 bits + 531: spr431 (spr431), unsigned 64 bits + 532: spr432 (spr432), unsigned 64 bits + 533: spr433 (spr433), unsigned 64 bits + 534: spr434 (spr434), unsigned 64 bits + 535: spr435 (spr435), unsigned 64 bits + 536: spr436 (spr436), unsigned 64 bits + 537: spr437 (spr437), unsigned 64 bits + 538: spr438 (spr438), unsigned 64 bits + 539: spr439 (spr439), unsigned 64 bits + 540: spr440 (spr440), unsigned 64 bits + 541: spr441 (spr441), unsigned 64 bits + 542: spr442 (spr442), unsigned 64 bits + 543: spr443 (spr443), unsigned 64 bits + 544: spr444 (spr444), unsigned 64 bits + 545: spr445 (spr445), unsigned 64 bits + 546: spr446 (spr446), unsigned 64 bits + 547: spr447 (spr447), unsigned 64 bits + 548: spr448 (spr448), unsigned 64 bits + 549: spr449 (spr449), unsigned 64 bits + 550: spr450 (spr450), unsigned 64 bits + 551: spr451 (spr451), unsigned 64 bits + 552: spr452 (spr452), unsigned 64 bits + 553: spr453 (spr453), unsigned 64 bits + 554: spr454 (spr454), unsigned 64 bits + 555: spr455 (spr455), unsigned 64 bits + 556: spr456 (spr456), unsigned 64 bits + 557: spr457 (spr457), unsigned 64 bits + 558: spr458 (spr458), unsigned 64 bits + 559: spr459 (spr459), unsigned 64 bits + 560: spr460 (spr460), unsigned 64 bits + 561: spr461 (spr461), unsigned 64 bits + 562: spr462 (spr462), unsigned 64 bits + 563: spr463 (spr463), unsigned 64 bits + 564: spr464 (spr464), unsigned 64 bits + 565: spr465 (spr465), unsigned 64 bits + 566: spr466 (spr466), unsigned 64 bits + 567: spr467 (spr467), unsigned 64 bits + 568: spr468 (spr468), unsigned 64 bits + 569: spr469 (spr469), unsigned 64 bits + 570: spr470 (spr470), unsigned 64 bits + 571: spr471 (spr471), unsigned 64 bits + 572: spr472 (spr472), unsigned 64 bits + 573: spr473 (spr473), unsigned 64 bits + 574: spr474 (spr474), unsigned 64 bits + 575: spr475 (spr475), unsigned 64 bits + 576: spr476 (spr476), unsigned 64 bits + 577: spr477 (spr477), unsigned 64 bits + 578: spr478 (spr478), unsigned 64 bits + 579: spr479 (spr479), unsigned 64 bits + 580: spr480 (spr480), unsigned 64 bits + 581: spr481 (spr481), unsigned 64 bits + 582: spr482 (spr482), unsigned 64 bits + 583: spr483 (spr483), unsigned 64 bits + 584: spr484 (spr484), unsigned 64 bits + 585: spr485 (spr485), unsigned 64 bits + 586: spr486 (spr486), unsigned 64 bits + 587: spr487 (spr487), unsigned 64 bits + 588: spr488 (spr488), unsigned 64 bits + 589: spr489 (spr489), unsigned 64 bits + 590: spr490 (spr490), unsigned 64 bits + 591: spr491 (spr491), unsigned 64 bits + 592: spr492 (spr492), unsigned 64 bits + 593: spr493 (spr493), unsigned 64 bits + 594: spr494 (spr494), unsigned 64 bits + 595: spr495 (spr495), unsigned 64 bits + 596: spr496 (spr496), unsigned 64 bits + 597: spr497 (spr497), unsigned 64 bits + 598: spr498 (spr498), unsigned 64 bits + 599: spr499 (spr499), unsigned 64 bits + 600: spr500 (spr500), unsigned 64 bits + 601: spr501 (spr501), unsigned 64 bits + 602: spr502 (spr502), unsigned 64 bits + 603: spr503 (spr503), unsigned 64 bits + 604: spr504 (spr504), unsigned 64 bits + 605: spr505 (spr505), unsigned 64 bits + 606: spr506 (spr506), unsigned 64 bits + 607: spr507 (spr507), unsigned 64 bits + 608: spr508 (spr508), unsigned 64 bits + 609: spr509 (spr509), unsigned 64 bits + 610: spr510 (spr510), unsigned 64 bits + 611: spr511 (spr511), unsigned 64 bits + 613: spr513 (spr513), unsigned 64 bits + 614: spr514 (spr514), unsigned 64 bits + 615: spr515 (spr515), unsigned 64 bits + 616: spr516 (spr516), unsigned 64 bits + 617: spr517 (spr517), unsigned 64 bits + 618: spr518 (spr518), unsigned 64 bits + 619: spr519 (spr519), unsigned 64 bits + 620: spr520 (spr520), unsigned 64 bits + 621: spr521 (spr521), unsigned 64 bits + 622: spr522 (spr522), unsigned 64 bits + 623: spr523 (spr523), unsigned 64 bits + 624: spr524 (spr524), unsigned 64 bits + 625: spr525 (spr525), unsigned 64 bits + 626: spr526 (spr526), unsigned 64 bits + 627: spr527 (spr527), unsigned 64 bits + 628: spr528 (spr528), unsigned 64 bits + 629: spr529 (spr529), unsigned 64 bits + 630: spr530 (spr530), unsigned 64 bits + 631: spr531 (spr531), unsigned 64 bits + 632: spr532 (spr532), unsigned 64 bits + 633: spr533 (spr533), unsigned 64 bits + 634: spr534 (spr534), unsigned 64 bits + 635: spr535 (spr535), unsigned 64 bits + 636: spr536 (spr536), unsigned 64 bits + 637: spr537 (spr537), unsigned 64 bits + 638: spr538 (spr538), unsigned 64 bits + 639: spr539 (spr539), unsigned 64 bits + 640: spr540 (spr540), unsigned 64 bits + 641: spr541 (spr541), unsigned 64 bits + 642: spr542 (spr542), unsigned 64 bits + 643: spr543 (spr543), unsigned 64 bits + 644: spr544 (spr544), unsigned 64 bits + 645: spr545 (spr545), unsigned 64 bits + 646: spr546 (spr546), unsigned 64 bits + 647: spr547 (spr547), unsigned 64 bits + 648: spr548 (spr548), unsigned 64 bits + 649: spr549 (spr549), unsigned 64 bits + 650: spr550 (spr550), unsigned 64 bits + 651: spr551 (spr551), unsigned 64 bits + 652: spr552 (spr552), unsigned 64 bits + 653: spr553 (spr553), unsigned 64 bits + 654: spr554 (spr554), unsigned 64 bits + 655: spr555 (spr555), unsigned 64 bits + 656: spr556 (spr556), unsigned 64 bits + 657: spr557 (spr557), unsigned 64 bits + 658: spr558 (spr558), unsigned 64 bits + 659: spr559 (spr559), unsigned 64 bits + 660: spr560 (spr560), unsigned 64 bits + 661: spr561 (spr561), unsigned 64 bits + 662: spr562 (spr562), unsigned 64 bits + 663: spr563 (spr563), unsigned 64 bits + 664: spr564 (spr564), unsigned 64 bits + 665: spr565 (spr565), unsigned 64 bits + 666: spr566 (spr566), unsigned 64 bits + 667: spr567 (spr567), unsigned 64 bits + 668: spr568 (spr568), unsigned 64 bits + 669: spr569 (spr569), unsigned 64 bits + 670: spr570 (spr570), unsigned 64 bits + 671: spr571 (spr571), unsigned 64 bits + 672: spr572 (spr572), unsigned 64 bits + 673: spr573 (spr573), unsigned 64 bits + 674: spr574 (spr574), unsigned 64 bits + 675: spr575 (spr575), unsigned 64 bits + 676: spr576 (spr576), unsigned 64 bits + 677: spr577 (spr577), unsigned 64 bits + 678: spr578 (spr578), unsigned 64 bits + 679: spr579 (spr579), unsigned 64 bits + 680: spr580 (spr580), unsigned 64 bits + 681: spr581 (spr581), unsigned 64 bits + 682: spr582 (spr582), unsigned 64 bits + 683: spr583 (spr583), unsigned 64 bits + 684: spr584 (spr584), unsigned 64 bits + 685: spr585 (spr585), unsigned 64 bits + 686: spr586 (spr586), unsigned 64 bits + 687: spr587 (spr587), unsigned 64 bits + 688: spr588 (spr588), unsigned 64 bits + 689: spr589 (spr589), unsigned 64 bits + 690: spr590 (spr590), unsigned 64 bits + 691: spr591 (spr591), unsigned 64 bits + 692: spr592 (spr592), unsigned 64 bits + 693: spr593 (spr593), unsigned 64 bits + 694: spr594 (spr594), unsigned 64 bits + 695: spr595 (spr595), unsigned 64 bits + 696: spr596 (spr596), unsigned 64 bits + 697: spr597 (spr597), unsigned 64 bits + 698: spr598 (spr598), unsigned 64 bits + 699: spr599 (spr599), unsigned 64 bits + 700: spr600 (spr600), unsigned 64 bits + 701: spr601 (spr601), unsigned 64 bits + 702: spr602 (spr602), unsigned 64 bits + 703: spr603 (spr603), unsigned 64 bits + 704: spr604 (spr604), unsigned 64 bits + 705: spr605 (spr605), unsigned 64 bits + 706: spr606 (spr606), unsigned 64 bits + 707: spr607 (spr607), unsigned 64 bits + 708: spr608 (spr608), unsigned 64 bits + 709: spr609 (spr609), unsigned 64 bits + 710: spr610 (spr610), unsigned 64 bits + 711: spr611 (spr611), unsigned 64 bits + 712: spr612 (spr612), unsigned 64 bits + 713: spr613 (spr613), unsigned 64 bits + 714: spr614 (spr614), unsigned 64 bits + 715: spr615 (spr615), unsigned 64 bits + 716: spr616 (spr616), unsigned 64 bits + 717: spr617 (spr617), unsigned 64 bits + 718: spr618 (spr618), unsigned 64 bits + 719: spr619 (spr619), unsigned 64 bits + 720: spr620 (spr620), unsigned 64 bits + 721: spr621 (spr621), unsigned 64 bits + 722: spr622 (spr622), unsigned 64 bits + 723: spr623 (spr623), unsigned 64 bits + 724: spr624 (spr624), unsigned 64 bits + 725: spr625 (spr625), unsigned 64 bits + 726: spr626 (spr626), unsigned 64 bits + 727: spr627 (spr627), unsigned 64 bits + 728: spr628 (spr628), unsigned 64 bits + 729: spr629 (spr629), unsigned 64 bits + 730: spr630 (spr630), unsigned 64 bits + 731: spr631 (spr631), unsigned 64 bits + 732: spr632 (spr632), unsigned 64 bits + 733: spr633 (spr633), unsigned 64 bits + 734: spr634 (spr634), unsigned 64 bits + 735: spr635 (spr635), unsigned 64 bits + 736: spr636 (spr636), unsigned 64 bits + 737: spr637 (spr637), unsigned 64 bits + 738: spr638 (spr638), unsigned 64 bits + 739: spr639 (spr639), unsigned 64 bits + 740: spr640 (spr640), unsigned 64 bits + 741: spr641 (spr641), unsigned 64 bits + 742: spr642 (spr642), unsigned 64 bits + 743: spr643 (spr643), unsigned 64 bits + 744: spr644 (spr644), unsigned 64 bits + 745: spr645 (spr645), unsigned 64 bits + 746: spr646 (spr646), unsigned 64 bits + 747: spr647 (spr647), unsigned 64 bits + 748: spr648 (spr648), unsigned 64 bits + 749: spr649 (spr649), unsigned 64 bits + 750: spr650 (spr650), unsigned 64 bits + 751: spr651 (spr651), unsigned 64 bits + 752: spr652 (spr652), unsigned 64 bits + 753: spr653 (spr653), unsigned 64 bits + 754: spr654 (spr654), unsigned 64 bits + 755: spr655 (spr655), unsigned 64 bits + 756: spr656 (spr656), unsigned 64 bits + 757: spr657 (spr657), unsigned 64 bits + 758: spr658 (spr658), unsigned 64 bits + 759: spr659 (spr659), unsigned 64 bits + 760: spr660 (spr660), unsigned 64 bits + 761: spr661 (spr661), unsigned 64 bits + 762: spr662 (spr662), unsigned 64 bits + 763: spr663 (spr663), unsigned 64 bits + 764: spr664 (spr664), unsigned 64 bits + 765: spr665 (spr665), unsigned 64 bits + 766: spr666 (spr666), unsigned 64 bits + 767: spr667 (spr667), unsigned 64 bits + 768: spr668 (spr668), unsigned 64 bits + 769: spr669 (spr669), unsigned 64 bits + 770: spr670 (spr670), unsigned 64 bits + 771: spr671 (spr671), unsigned 64 bits + 772: spr672 (spr672), unsigned 64 bits + 773: spr673 (spr673), unsigned 64 bits + 774: spr674 (spr674), unsigned 64 bits + 775: spr675 (spr675), unsigned 64 bits + 776: spr676 (spr676), unsigned 64 bits + 777: spr677 (spr677), unsigned 64 bits + 778: spr678 (spr678), unsigned 64 bits + 779: spr679 (spr679), unsigned 64 bits + 780: spr680 (spr680), unsigned 64 bits + 781: spr681 (spr681), unsigned 64 bits + 782: spr682 (spr682), unsigned 64 bits + 783: spr683 (spr683), unsigned 64 bits + 784: spr684 (spr684), unsigned 64 bits + 785: spr685 (spr685), unsigned 64 bits + 786: spr686 (spr686), unsigned 64 bits + 787: spr687 (spr687), unsigned 64 bits + 788: spr688 (spr688), unsigned 64 bits + 789: spr689 (spr689), unsigned 64 bits + 790: spr690 (spr690), unsigned 64 bits + 791: spr691 (spr691), unsigned 64 bits + 792: spr692 (spr692), unsigned 64 bits + 793: spr693 (spr693), unsigned 64 bits + 794: spr694 (spr694), unsigned 64 bits + 795: spr695 (spr695), unsigned 64 bits + 796: spr696 (spr696), unsigned 64 bits + 797: spr697 (spr697), unsigned 64 bits + 798: spr698 (spr698), unsigned 64 bits + 799: spr699 (spr699), unsigned 64 bits + 800: spr700 (spr700), unsigned 64 bits + 801: spr701 (spr701), unsigned 64 bits + 802: spr702 (spr702), unsigned 64 bits + 803: spr703 (spr703), unsigned 64 bits + 804: spr704 (spr704), unsigned 64 bits + 805: spr705 (spr705), unsigned 64 bits + 806: spr706 (spr706), unsigned 64 bits + 807: spr707 (spr707), unsigned 64 bits + 808: spr708 (spr708), unsigned 64 bits + 809: spr709 (spr709), unsigned 64 bits + 810: spr710 (spr710), unsigned 64 bits + 811: spr711 (spr711), unsigned 64 bits + 812: spr712 (spr712), unsigned 64 bits + 813: spr713 (spr713), unsigned 64 bits + 814: spr714 (spr714), unsigned 64 bits + 815: spr715 (spr715), unsigned 64 bits + 816: spr716 (spr716), unsigned 64 bits + 817: spr717 (spr717), unsigned 64 bits + 818: spr718 (spr718), unsigned 64 bits + 819: spr719 (spr719), unsigned 64 bits + 820: spr720 (spr720), unsigned 64 bits + 821: spr721 (spr721), unsigned 64 bits + 822: spr722 (spr722), unsigned 64 bits + 823: spr723 (spr723), unsigned 64 bits + 824: spr724 (spr724), unsigned 64 bits + 825: spr725 (spr725), unsigned 64 bits + 826: spr726 (spr726), unsigned 64 bits + 827: spr727 (spr727), unsigned 64 bits + 828: spr728 (spr728), unsigned 64 bits + 829: spr729 (spr729), unsigned 64 bits + 830: spr730 (spr730), unsigned 64 bits + 831: spr731 (spr731), unsigned 64 bits + 832: spr732 (spr732), unsigned 64 bits + 833: spr733 (spr733), unsigned 64 bits + 834: spr734 (spr734), unsigned 64 bits + 835: spr735 (spr735), unsigned 64 bits + 836: spr736 (spr736), unsigned 64 bits + 837: spr737 (spr737), unsigned 64 bits + 838: spr738 (spr738), unsigned 64 bits + 839: spr739 (spr739), unsigned 64 bits + 840: spr740 (spr740), unsigned 64 bits + 841: spr741 (spr741), unsigned 64 bits + 842: spr742 (spr742), unsigned 64 bits + 843: spr743 (spr743), unsigned 64 bits + 844: spr744 (spr744), unsigned 64 bits + 845: spr745 (spr745), unsigned 64 bits + 846: spr746 (spr746), unsigned 64 bits + 847: spr747 (spr747), unsigned 64 bits + 848: spr748 (spr748), unsigned 64 bits + 849: spr749 (spr749), unsigned 64 bits + 850: spr750 (spr750), unsigned 64 bits + 851: spr751 (spr751), unsigned 64 bits + 852: spr752 (spr752), unsigned 64 bits + 853: spr753 (spr753), unsigned 64 bits + 854: spr754 (spr754), unsigned 64 bits + 855: spr755 (spr755), unsigned 64 bits + 856: spr756 (spr756), unsigned 64 bits + 857: spr757 (spr757), unsigned 64 bits + 858: spr758 (spr758), unsigned 64 bits + 859: spr759 (spr759), unsigned 64 bits + 860: spr760 (spr760), unsigned 64 bits + 861: spr761 (spr761), unsigned 64 bits + 862: spr762 (spr762), unsigned 64 bits + 863: spr763 (spr763), unsigned 64 bits + 864: spr764 (spr764), unsigned 64 bits + 865: spr765 (spr765), unsigned 64 bits + 866: spr766 (spr766), unsigned 64 bits + 867: spr767 (spr767), unsigned 64 bits + 868: spr768 (spr768), unsigned 64 bits + 869: spr769 (spr769), unsigned 64 bits + 870: spr770 (spr770), unsigned 64 bits + 871: spr771 (spr771), unsigned 64 bits + 872: spr772 (spr772), unsigned 64 bits + 873: spr773 (spr773), unsigned 64 bits + 874: spr774 (spr774), unsigned 64 bits + 875: spr775 (spr775), unsigned 64 bits + 876: spr776 (spr776), unsigned 64 bits + 877: spr777 (spr777), unsigned 64 bits + 878: spr778 (spr778), unsigned 64 bits + 879: spr779 (spr779), unsigned 64 bits + 880: spr780 (spr780), unsigned 64 bits + 881: spr781 (spr781), unsigned 64 bits + 882: spr782 (spr782), unsigned 64 bits + 883: spr783 (spr783), unsigned 64 bits + 884: spr784 (spr784), unsigned 64 bits + 885: spr785 (spr785), unsigned 64 bits + 886: spr786 (spr786), unsigned 64 bits + 887: spr787 (spr787), unsigned 64 bits + 888: spr788 (spr788), unsigned 64 bits + 889: spr789 (spr789), unsigned 64 bits + 890: spr790 (spr790), unsigned 64 bits + 891: spr791 (spr791), unsigned 64 bits + 892: spr792 (spr792), unsigned 64 bits + 893: spr793 (spr793), unsigned 64 bits + 894: spr794 (spr794), unsigned 64 bits + 895: spr795 (spr795), unsigned 64 bits + 896: spr796 (spr796), unsigned 64 bits + 897: spr797 (spr797), unsigned 64 bits + 898: spr798 (spr798), unsigned 64 bits + 899: spr799 (spr799), unsigned 64 bits + 900: spr800 (spr800), unsigned 64 bits + 901: spr801 (spr801), unsigned 64 bits + 902: spr802 (spr802), unsigned 64 bits + 903: spr803 (spr803), unsigned 64 bits + 904: spr804 (spr804), unsigned 64 bits + 905: spr805 (spr805), unsigned 64 bits + 906: spr806 (spr806), unsigned 64 bits + 907: spr807 (spr807), unsigned 64 bits + 908: spr808 (spr808), unsigned 64 bits + 909: spr809 (spr809), unsigned 64 bits + 910: spr810 (spr810), unsigned 64 bits + 911: spr811 (spr811), unsigned 64 bits + 912: spr812 (spr812), unsigned 64 bits + 913: spr813 (spr813), unsigned 64 bits + 914: spr814 (spr814), unsigned 64 bits + 915: spr815 (spr815), unsigned 64 bits + 916: spr816 (spr816), unsigned 64 bits + 917: spr817 (spr817), unsigned 64 bits + 918: spr818 (spr818), unsigned 64 bits + 919: spr819 (spr819), unsigned 64 bits + 920: spr820 (spr820), unsigned 64 bits + 921: spr821 (spr821), unsigned 64 bits + 922: spr822 (spr822), unsigned 64 bits + 923: spr823 (spr823), unsigned 64 bits + 924: spr824 (spr824), unsigned 64 bits + 925: spr825 (spr825), unsigned 64 bits + 926: spr826 (spr826), unsigned 64 bits + 927: spr827 (spr827), unsigned 64 bits + 928: spr828 (spr828), unsigned 64 bits + 929: spr829 (spr829), unsigned 64 bits + 930: spr830 (spr830), unsigned 64 bits + 931: spr831 (spr831), unsigned 64 bits + 932: spr832 (spr832), unsigned 64 bits + 933: spr833 (spr833), unsigned 64 bits + 934: spr834 (spr834), unsigned 64 bits + 935: spr835 (spr835), unsigned 64 bits + 936: spr836 (spr836), unsigned 64 bits + 937: spr837 (spr837), unsigned 64 bits + 938: spr838 (spr838), unsigned 64 bits + 939: spr839 (spr839), unsigned 64 bits + 940: spr840 (spr840), unsigned 64 bits + 941: spr841 (spr841), unsigned 64 bits + 942: spr842 (spr842), unsigned 64 bits + 943: spr843 (spr843), unsigned 64 bits + 944: spr844 (spr844), unsigned 64 bits + 945: spr845 (spr845), unsigned 64 bits + 946: spr846 (spr846), unsigned 64 bits + 947: spr847 (spr847), unsigned 64 bits + 948: spr848 (spr848), unsigned 64 bits + 949: spr849 (spr849), unsigned 64 bits + 950: spr850 (spr850), unsigned 64 bits + 951: spr851 (spr851), unsigned 64 bits + 952: spr852 (spr852), unsigned 64 bits + 953: spr853 (spr853), unsigned 64 bits + 954: spr854 (spr854), unsigned 64 bits + 955: spr855 (spr855), unsigned 64 bits + 956: spr856 (spr856), unsigned 64 bits + 957: spr857 (spr857), unsigned 64 bits + 958: spr858 (spr858), unsigned 64 bits + 959: spr859 (spr859), unsigned 64 bits + 960: spr860 (spr860), unsigned 64 bits + 961: spr861 (spr861), unsigned 64 bits + 962: spr862 (spr862), unsigned 64 bits + 963: spr863 (spr863), unsigned 64 bits + 964: spr864 (spr864), unsigned 64 bits + 965: spr865 (spr865), unsigned 64 bits + 966: spr866 (spr866), unsigned 64 bits + 967: spr867 (spr867), unsigned 64 bits + 968: spr868 (spr868), unsigned 64 bits + 969: spr869 (spr869), unsigned 64 bits + 970: spr870 (spr870), unsigned 64 bits + 971: spr871 (spr871), unsigned 64 bits + 972: spr872 (spr872), unsigned 64 bits + 973: spr873 (spr873), unsigned 64 bits + 974: spr874 (spr874), unsigned 64 bits + 975: spr875 (spr875), unsigned 64 bits + 976: spr876 (spr876), unsigned 64 bits + 977: spr877 (spr877), unsigned 64 bits + 978: spr878 (spr878), unsigned 64 bits + 979: spr879 (spr879), unsigned 64 bits + 980: spr880 (spr880), unsigned 64 bits + 981: spr881 (spr881), unsigned 64 bits + 982: spr882 (spr882), unsigned 64 bits + 983: spr883 (spr883), unsigned 64 bits + 984: spr884 (spr884), unsigned 64 bits + 985: spr885 (spr885), unsigned 64 bits + 986: spr886 (spr886), unsigned 64 bits + 987: spr887 (spr887), unsigned 64 bits + 988: spr888 (spr888), unsigned 64 bits + 989: spr889 (spr889), unsigned 64 bits + 990: spr890 (spr890), unsigned 64 bits + 991: spr891 (spr891), unsigned 64 bits + 992: spr892 (spr892), unsigned 64 bits + 993: spr893 (spr893), unsigned 64 bits + 994: spr894 (spr894), unsigned 64 bits + 995: spr895 (spr895), unsigned 64 bits + 996: spr896 (spr896), unsigned 64 bits + 997: spr897 (spr897), unsigned 64 bits + 998: spr898 (spr898), unsigned 64 bits + 999: spr899 (spr899), unsigned 64 bits +vector registers: + 67: vscr (vscr), unsigned 32 bits + 356: vrsave (vrsave), unsigned 32 bits + 612: spefscr (spefscr), unsigned 32 bits + 1124: vr0 (vr0), unsigned 128 bits + 1125: vr1 (vr1), unsigned 128 bits + 1126: vr2 (vr2), unsigned 128 bits + 1127: vr3 (vr3), unsigned 128 bits + 1128: vr4 (vr4), unsigned 128 bits + 1129: vr5 (vr5), unsigned 128 bits + 1130: vr6 (vr6), unsigned 128 bits + 1131: vr7 (vr7), unsigned 128 bits + 1132: vr8 (vr8), unsigned 128 bits + 1133: vr9 (vr9), unsigned 128 bits + 1134: vr10 (vr10), unsigned 128 bits + 1135: vr11 (vr11), unsigned 128 bits + 1136: vr12 (vr12), unsigned 128 bits + 1137: vr13 (vr13), unsigned 128 bits + 1138: vr14 (vr14), unsigned 128 bits + 1139: vr15 (vr15), unsigned 128 bits + 1140: vr16 (vr16), unsigned 128 bits + 1141: vr17 (vr17), unsigned 128 bits + 1142: vr18 (vr18), unsigned 128 bits + 1143: vr19 (vr19), unsigned 128 bits + 1144: vr20 (vr20), unsigned 128 bits + 1145: vr21 (vr21), unsigned 128 bits + 1146: vr22 (vr22), unsigned 128 bits + 1147: vr23 (vr23), unsigned 128 bits + 1148: vr24 (vr24), unsigned 128 bits + 1149: vr25 (vr25), unsigned 128 bits + 1150: vr26 (vr26), unsigned 128 bits + 1151: vr27 (vr27), unsigned 128 bits + 1152: vr28 (vr28), unsigned 128 bits + 1153: vr29 (vr29), unsigned 128 bits + 1154: vr30 (vr30), unsigned 128 bits + 1155: vr31 (vr31), unsigned 128 bits +EOF + +regs_test testfile26 <<\EOF +integer registers: + 0: %r0 (r0), signed 32 bits + 1: %r1 (r1), signed 32 bits + 2: %r2 (r2), signed 32 bits + 3: %r3 (r3), signed 32 bits + 4: %r4 (r4), signed 32 bits + 5: %r5 (r5), signed 32 bits + 6: %r6 (r6), signed 32 bits + 7: %r7 (r7), signed 32 bits + 8: %r8 (r8), signed 32 bits + 9: %r9 (r9), signed 32 bits + 10: %r10 (r10), signed 32 bits + 11: %r11 (r11), signed 32 bits + 12: %r12 (r12), signed 32 bits + 13: %r13 (r13), signed 32 bits + 14: %r14 (r14), signed 32 bits + 15: %r15 (r15), signed 32 bits +FPU registers: + 16: %f0 (f0), float 64 bits + 17: %f2 (f2), float 64 bits + 18: %f4 (f4), float 64 bits + 19: %f6 (f6), float 64 bits + 20: %f1 (f1), float 64 bits + 21: %f3 (f3), float 64 bits + 22: %f5 (f5), float 64 bits + 23: %f7 (f7), float 64 bits + 24: %f8 (f8), float 64 bits + 25: %f10 (f10), float 64 bits + 26: %f12 (f12), float 64 bits + 27: %f14 (f14), float 64 bits + 28: %f9 (f9), float 64 bits + 29: %f11 (f11), float 64 bits + 30: %f13 (f13), float 64 bits + 31: %f15 (f15), float 64 bits +access registers: + 48: %a0 (a0), unsigned 32 bits + 49: %a1 (a1), unsigned 32 bits + 50: %a2 (a2), unsigned 32 bits + 51: %a3 (a3), unsigned 32 bits + 52: %a4 (a4), unsigned 32 bits + 53: %a5 (a5), unsigned 32 bits + 54: %a6 (a6), unsigned 32 bits + 55: %a7 (a7), unsigned 32 bits + 56: %a8 (a8), unsigned 32 bits + 57: %a9 (a9), unsigned 32 bits + 58: %a10 (a10), unsigned 32 bits + 59: %a11 (a11), unsigned 32 bits + 60: %a12 (a12), unsigned 32 bits + 61: %a13 (a13), unsigned 32 bits + 62: %a14 (a14), unsigned 32 bits + 63: %a15 (a15), unsigned 32 bits +control registers: + 32: %c0 (c0), unsigned 32 bits + 33: %c1 (c1), unsigned 32 bits + 34: %c2 (c2), unsigned 32 bits + 35: %c3 (c3), unsigned 32 bits + 36: %c4 (c4), unsigned 32 bits + 37: %c5 (c5), unsigned 32 bits + 38: %c6 (c6), unsigned 32 bits + 39: %c7 (c7), unsigned 32 bits + 40: %c8 (c8), unsigned 32 bits + 41: %c9 (c9), unsigned 32 bits + 42: %c10 (c10), unsigned 32 bits + 43: %c11 (c11), unsigned 32 bits + 44: %c12 (c12), unsigned 32 bits + 45: %c13 (c13), unsigned 32 bits + 46: %c14 (c14), unsigned 32 bits + 47: %c15 (c15), unsigned 32 bits + 64: %pswm (pswm), unsigned 32 bits + 65: %pswa (pswa), address 32 bits +EOF + +regs_test testfile27 <<\EOF +integer registers: + 0: %r0 (r0), signed 64 bits + 1: %r1 (r1), signed 64 bits + 2: %r2 (r2), signed 64 bits + 3: %r3 (r3), signed 64 bits + 4: %r4 (r4), signed 64 bits + 5: %r5 (r5), signed 64 bits + 6: %r6 (r6), signed 64 bits + 7: %r7 (r7), signed 64 bits + 8: %r8 (r8), signed 64 bits + 9: %r9 (r9), signed 64 bits + 10: %r10 (r10), signed 64 bits + 11: %r11 (r11), signed 64 bits + 12: %r12 (r12), signed 64 bits + 13: %r13 (r13), signed 64 bits + 14: %r14 (r14), signed 64 bits + 15: %r15 (r15), signed 64 bits +FPU registers: + 16: %f0 (f0), float 64 bits + 17: %f2 (f2), float 64 bits + 18: %f4 (f4), float 64 bits + 19: %f6 (f6), float 64 bits + 20: %f1 (f1), float 64 bits + 21: %f3 (f3), float 64 bits + 22: %f5 (f5), float 64 bits + 23: %f7 (f7), float 64 bits + 24: %f8 (f8), float 64 bits + 25: %f10 (f10), float 64 bits + 26: %f12 (f12), float 64 bits + 27: %f14 (f14), float 64 bits + 28: %f9 (f9), float 64 bits + 29: %f11 (f11), float 64 bits + 30: %f13 (f13), float 64 bits + 31: %f15 (f15), float 64 bits +access registers: + 48: %a0 (a0), unsigned 32 bits + 49: %a1 (a1), unsigned 32 bits + 50: %a2 (a2), unsigned 32 bits + 51: %a3 (a3), unsigned 32 bits + 52: %a4 (a4), unsigned 32 bits + 53: %a5 (a5), unsigned 32 bits + 54: %a6 (a6), unsigned 32 bits + 55: %a7 (a7), unsigned 32 bits + 56: %a8 (a8), unsigned 32 bits + 57: %a9 (a9), unsigned 32 bits + 58: %a10 (a10), unsigned 32 bits + 59: %a11 (a11), unsigned 32 bits + 60: %a12 (a12), unsigned 32 bits + 61: %a13 (a13), unsigned 32 bits + 62: %a14 (a14), unsigned 32 bits + 63: %a15 (a15), unsigned 32 bits +control registers: + 32: %c0 (c0), unsigned 64 bits + 33: %c1 (c1), unsigned 64 bits + 34: %c2 (c2), unsigned 64 bits + 35: %c3 (c3), unsigned 64 bits + 36: %c4 (c4), unsigned 64 bits + 37: %c5 (c5), unsigned 64 bits + 38: %c6 (c6), unsigned 64 bits + 39: %c7 (c7), unsigned 64 bits + 40: %c8 (c8), unsigned 64 bits + 41: %c9 (c9), unsigned 64 bits + 42: %c10 (c10), unsigned 64 bits + 43: %c11 (c11), unsigned 64 bits + 44: %c12 (c12), unsigned 64 bits + 45: %c13 (c13), unsigned 64 bits + 46: %c14 (c14), unsigned 64 bits + 47: %c15 (c15), unsigned 64 bits + 64: %pswm (pswm), unsigned 64 bits + 65: %pswa (pswa), address 64 bits +EOF + +regs_test testfile30 <<\EOF +integer registers: + 0: %g0 (g0), signed 32 bits + 1: %g1 (g1), signed 32 bits + 2: %g2 (g2), signed 32 bits + 3: %g3 (g3), signed 32 bits + 4: %g4 (g4), signed 32 bits + 5: %g5 (g5), signed 32 bits + 6: %g6 (g6), signed 32 bits + 7: %g7 (g7), signed 32 bits + 8: %o0 (o0), signed 32 bits + 9: %o1 (o1), signed 32 bits + 10: %o2 (o2), signed 32 bits + 11: %o3 (o3), signed 32 bits + 12: %o4 (o4), signed 32 bits + 13: %o5 (o5), signed 32 bits + 14: %o6 (o6), address 32 bits + 15: %o7 (o7), signed 32 bits + 16: %l0 (l0), signed 32 bits + 17: %l1 (l1), signed 32 bits + 18: %l2 (l2), signed 32 bits + 19: %l3 (l3), signed 32 bits + 20: %l4 (l4), signed 32 bits + 21: %l5 (l5), signed 32 bits + 22: %l6 (l6), signed 32 bits + 23: %l7 (l7), signed 32 bits + 24: %i0 (i0), signed 32 bits + 25: %i1 (i1), signed 32 bits + 26: %i2 (i2), signed 32 bits + 27: %i3 (i3), signed 32 bits + 28: %i4 (i4), signed 32 bits + 29: %i5 (i5), signed 32 bits + 30: %i6 (i6), address 32 bits + 31: %i7 (i7), signed 32 bits +FPU registers: + 32: %f0 (f0), float 32 bits + 33: %f1 (f1), float 32 bits + 34: %f2 (f2), float 32 bits + 35: %f3 (f3), float 32 bits + 36: %f4 (f4), float 32 bits + 37: %f5 (f5), float 32 bits + 38: %f6 (f6), float 32 bits + 39: %f7 (f7), float 32 bits + 40: %f8 (f8), float 32 bits + 41: %f9 (f9), float 32 bits + 42: %f10 (f10), float 32 bits + 43: %f11 (f11), float 32 bits + 44: %f12 (f12), float 32 bits + 45: %f13 (f13), float 32 bits + 46: %f14 (f14), float 32 bits + 47: %f15 (f15), float 32 bits + 48: %f16 (f16), float 32 bits + 49: %f17 (f17), float 32 bits + 50: %f18 (f18), float 32 bits + 51: %f19 (f19), float 32 bits + 52: %f20 (f20), float 32 bits + 53: %f21 (f21), float 32 bits + 54: %f22 (f22), float 32 bits + 55: %f23 (f23), float 32 bits + 56: %f24 (f24), float 32 bits + 57: %f25 (f25), float 32 bits + 58: %f26 (f26), float 32 bits + 59: %f27 (f27), float 32 bits + 60: %f28 (f28), float 32 bits + 61: %f29 (f29), float 32 bits + 62: %f30 (f30), float 32 bits + 63: %f31 (f31), float 32 bits +control registers: + 64: %y (y), unsigned 32 bits + 65: %psr (psr), unsigned 32 bits + 66: %wim (wim), unsigned 32 bits + 67: %tbr (tbr), unsigned 32 bits + 68: %pc (pc), address 32 bits + 69: %npc (npc), address 32 bits + 70: %fsr (fsr), unsigned 32 bits + 71: %csr (csr), unsigned 32 bits +EOF + +regs_test testfile31 <<\EOF +integer registers: + 0: %g0 (g0), signed 64 bits + 1: %g1 (g1), signed 64 bits + 2: %g2 (g2), signed 64 bits + 3: %g3 (g3), signed 64 bits + 4: %g4 (g4), signed 64 bits + 5: %g5 (g5), signed 64 bits + 6: %g6 (g6), signed 64 bits + 7: %g7 (g7), signed 64 bits + 8: %o0 (o0), signed 64 bits + 9: %o1 (o1), signed 64 bits + 10: %o2 (o2), signed 64 bits + 11: %o3 (o3), signed 64 bits + 12: %o4 (o4), signed 64 bits + 13: %o5 (o5), signed 64 bits + 14: %o6 (o6), address 64 bits + 15: %o7 (o7), signed 64 bits + 16: %l0 (l0), signed 64 bits + 17: %l1 (l1), signed 64 bits + 18: %l2 (l2), signed 64 bits + 19: %l3 (l3), signed 64 bits + 20: %l4 (l4), signed 64 bits + 21: %l5 (l5), signed 64 bits + 22: %l6 (l6), signed 64 bits + 23: %l7 (l7), signed 64 bits + 24: %i0 (i0), signed 64 bits + 25: %i1 (i1), signed 64 bits + 26: %i2 (i2), signed 64 bits + 27: %i3 (i3), signed 64 bits + 28: %i4 (i4), signed 64 bits + 29: %i5 (i5), signed 64 bits + 30: %i6 (i6), address 64 bits + 31: %i7 (i7), signed 64 bits +FPU registers: + 32: %f0 (f0), float 32 bits + 33: %f1 (f1), float 32 bits + 34: %f2 (f2), float 32 bits + 35: %f3 (f3), float 32 bits + 36: %f4 (f4), float 32 bits + 37: %f5 (f5), float 32 bits + 38: %f6 (f6), float 32 bits + 39: %f7 (f7), float 32 bits + 40: %f8 (f8), float 32 bits + 41: %f9 (f9), float 32 bits + 42: %f10 (f10), float 32 bits + 43: %f11 (f11), float 32 bits + 44: %f12 (f12), float 32 bits + 45: %f13 (f13), float 32 bits + 46: %f14 (f14), float 32 bits + 47: %f15 (f15), float 32 bits + 48: %f16 (f16), float 32 bits + 49: %f17 (f17), float 32 bits + 50: %f18 (f18), float 32 bits + 51: %f19 (f19), float 32 bits + 52: %f20 (f20), float 32 bits + 53: %f21 (f21), float 32 bits + 54: %f22 (f22), float 32 bits + 55: %f23 (f23), float 32 bits + 56: %f24 (f24), float 32 bits + 57: %f25 (f25), float 32 bits + 58: %f26 (f26), float 32 bits + 59: %f27 (f27), float 32 bits + 60: %f28 (f28), float 32 bits + 61: %f29 (f29), float 32 bits + 62: %f30 (f30), float 32 bits + 63: %f31 (f31), float 32 bits + 64: %f32 (f32), float 64 bits + 65: %f34 (f34), float 64 bits + 66: %f36 (f36), float 64 bits + 67: %f38 (f38), float 64 bits + 68: %f40 (f40), float 64 bits + 69: %f42 (f42), float 64 bits + 70: %f44 (f44), float 64 bits + 71: %f46 (f46), float 64 bits + 72: %f48 (f48), float 64 bits + 73: %f50 (f50), float 64 bits + 74: %f52 (f52), float 64 bits + 75: %f54 (f54), float 64 bits + 76: %f56 (f56), float 64 bits + 77: %f58 (f58), float 64 bits + 78: %f60 (f60), float 64 bits + 79: %f62 (f62), float 64 bits +control registers: + 80: %pc (pc), address 64 bits + 81: %npc (npc), address 64 bits + 82: %state (state), unsigned 64 bits + 83: %fsr (fsr), unsigned 64 bits + 84: %fprs (fprs), unsigned 64 bits + 85: %y (y), unsigned 64 bits +EOF + +regs_test testfile10 <<\EOF +integer registers: + 0: $v0 (v0), signed 64 bits + 1: $t0 (t0), signed 64 bits + 2: $t1 (t1), signed 64 bits + 3: $t2 (t2), signed 64 bits + 4: $t3 (t3), signed 64 bits + 5: $t4 (t4), signed 64 bits + 6: $t5 (t5), signed 64 bits + 7: $t6 (t6), signed 64 bits + 8: $t7 (t7), signed 64 bits + 9: $s0 (s0), signed 64 bits + 10: $s1 (s1), signed 64 bits + 11: $s2 (s2), signed 64 bits + 12: $s3 (s3), signed 64 bits + 13: $s4 (s4), signed 64 bits + 14: $s5 (s5), signed 64 bits + 15: $s6 (s6), signed 64 bits + 16: $a0 (a0), signed 64 bits + 17: $a1 (a1), signed 64 bits + 18: $a2 (a2), signed 64 bits + 19: $a3 (a3), signed 64 bits + 20: $a4 (a4), signed 64 bits + 21: $a5 (a5), signed 64 bits + 22: $t8 (t8), signed 64 bits + 23: $t9 (t9), signed 64 bits + 24: $t10 (t10), signed 64 bits + 25: $t11 (t11), signed 64 bits + 26: $ra (ra), address 64 bits + 27: $t12 (t12), signed 64 bits + 28: $at (at), signed 64 bits + 29: $gp (gp), address 64 bits + 30: $sp (sp), address 64 bits + 31: $zero (zero), signed 64 bits + 64: $pc (pc), address 64 bits + 66: $unique (unique), address 64 bits +FPU registers: + 32: $f0 (f0), float 64 bits + 33: $f1 (f1), float 64 bits + 34: $f2 (f2), float 64 bits + 35: $f3 (f3), float 64 bits + 36: $f4 (f4), float 64 bits + 37: $f5 (f5), float 64 bits + 38: $f6 (f6), float 64 bits + 39: $f7 (f7), float 64 bits + 40: $f8 (f8), float 64 bits + 41: $f9 (f9), float 64 bits + 42: $f10 (f10), float 64 bits + 43: $f11 (f11), float 64 bits + 44: $f12 (f12), float 64 bits + 45: $f13 (f13), float 64 bits + 46: $f14 (f14), float 64 bits + 47: $f15 (f15), float 64 bits + 48: $f16 (f16), float 64 bits + 49: $f17 (f17), float 64 bits + 50: $f18 (f18), float 64 bits + 51: $f19 (f19), float 64 bits + 52: $f20 (f20), float 64 bits + 53: $f21 (f21), float 64 bits + 54: $f22 (f22), float 64 bits + 55: $f23 (f23), float 64 bits + 56: $f24 (f24), float 64 bits + 57: $f25 (f25), float 64 bits + 58: $f26 (f26), float 64 bits + 59: $f27 (f27), float 64 bits + 60: $f28 (f28), float 64 bits + 61: $f29 (f29), float 64 bits + 62: $f30 (f30), float 64 bits + 63: $fpcr (fpcr), unsigned 64 bits +EOF + +exit 0 diff --git a/tests/run-arextract.sh b/tests/run-arextract.sh index 839a6792..29119a13 100644 --- a/tests/run-arextract.sh +++ b/tests/run-arextract.sh @@ -1,31 +1,45 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +tempfiles arextract.test -archive=../libelf/.libs/libelf.a -test -f $archive || archive=../libelf/libelf.a +archive=../libelf/libelf.a if test -f $archive; then # The file is really available (i.e., no shared-only built). echo -n "Extracting symbols... $ac_c" # The files we are looking at. for f in ../libelf/*.o; do - ./arextract $archive `basename $f` arextract.test || exit 1 + testrun ./arextract $archive `basename $f` arextract.test || exit 1 cmp $f arextract.test || { echo "Extraction of $1 failed" exit 1 } - rm -f ${objpfx}arextract.test done echo "done" diff --git a/tests/run-arsymtest.sh b/tests/run-arsymtest.sh index 793cdb8f..d47df7a7 100644 --- a/tests/run-arsymtest.sh +++ b/tests/run-arsymtest.sh @@ -1,23 +1,39 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh lib=../libelf/libelf.a okfile=arsymtest.ok tmpfile=arsymtest.tmp testfile=arsymtest.test -result=0 +tempfiles $okfile $tmpfile $testfile + +result=77 if test -f $lib; then # Generate list using `nm' we check against. nm -s $lib | @@ -25,14 +41,12 @@ if test -f $lib; then sort > $okfile # Now run our program using libelf. - ./arsymtest $lib $tmpfile || exit 1 + testrun ./arsymtest $lib $tmpfile || exit 1 sort $tmpfile > $testfile - rm $tmpfile # Compare the outputs. if cmp $okfile $testfile; then result=0 - rm $testfile $okfile else result=1 fi diff --git a/tests/run-bug1-test.sh b/tests/run-bug1-test.sh new file mode 100755 index 00000000..7367a4ed --- /dev/null +++ b/tests/run-bug1-test.sh @@ -0,0 +1,42 @@ +#! /bin/sh +# Copyright (C) 2006 Red Hat, Inc. +# Written by Ulrich Drepper <drepper@redhat.com>, 2006. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile28 testfile28.rdwr + +testrun ./rdwrmmap testfile28 + +cmp testfile28 testfile28.rdwr + +test_cleanup + +testfiles testfile29 testfile29.rdwr + +testrun ./rdwrmmap testfile29 + +cmp testfile29 testfile29.rdwr + +exit 0 diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh new file mode 100755 index 00000000..01803c0a --- /dev/null +++ b/tests/run-disasm-x86-64.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +# Run x86-64 test. +case "`uname -m`" in + x86_64) + tempfiles testfile45.o + testfiles testfile45.S testfile45.expect + gcc -m64 -c -o testfile45.o testfile45.S + testrun_compare ../src/objdump -d testfile45.o < testfile45.expect + ;; +esac diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh new file mode 100755 index 00000000..efd734c0 --- /dev/null +++ b/tests/run-disasm-x86.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +# Run x86 test. +case "`uname -m`" in + x86_64 | i?86 ) + tempfiles testfile44.o + testfiles testfile44.S testfile44.expect + gcc -m32 -c -o testfile44.o testfile44.S + testrun_compare ../src/objdump -d testfile44.o < testfile44.expect + ;; +esac diff --git a/tests/run-dwfl-addr-sect.sh b/tests/run-dwfl-addr-sect.sh new file mode 100755 index 00000000..98666f37 --- /dev/null +++ b/tests/run-dwfl-addr-sect.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile43 + +testrun_compare ./dwfl-addr-sect -e testfile43 0x64 0x8 0x98 <<\EOF +address 0x64 => module "" section 4 + 0 +address 0x8 => module "" section 1 + 0x8 +address 0x98 => module "" section 7 + 0 +EOF + +exit 0 diff --git a/tests/run-dwfl-bug-offline-rel.sh b/tests/run-dwfl-bug-offline-rel.sh new file mode 100755 index 00000000..d1f6149a --- /dev/null +++ b/tests/run-dwfl-bug-offline-rel.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile36 testfile36.debug + +testrun_compare ./dwflmodtest -e testfile36 <<\EOF +module: 00000000..00002308 testfile36 (null) +module: 00000000 DWARF 0 (no error) +module: 00000000..00002308 testfile36 testfile36.debug +EOF + +exit 0 diff --git a/tests/run-early-offscn.sh b/tests/run-early-offscn.sh new file mode 100755 index 00000000..70be2192 --- /dev/null +++ b/tests/run-early-offscn.sh @@ -0,0 +1,32 @@ +#! /bin/sh +# Copyright (C) 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile + +testrun ./early-offscn testfile 0x500 + +exit 0 diff --git a/tests/run-ecp-test.sh b/tests/run-ecp-test.sh index e4304965..941f3e96 100644 --- a/tests/run-ecp-test.sh +++ b/tests/run-ecp-test.sh @@ -1,25 +1,36 @@ #! /bin/sh -# Copyright (C) 2002 Red Hat, Inc. +# Copyright (C) 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Jakub Jelinek <jakub@redhat.com>, 2002. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile10.bz2 > testfile10 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./ecp testfile10 testfile10.tmp +testfiles testfile10 +tempfiles testfile10.tmp -cmp testfile10 testfile10.tmp +testrun ./ecp testfile10 testfile10.tmp -rm -f testfile10 testfile10.tmp +cmp testfile10 testfile10.tmp exit 0 diff --git a/tests/run-ecp-test2.sh b/tests/run-ecp-test2.sh index 143c70a6..42317080 100644 --- a/tests/run-ecp-test2.sh +++ b/tests/run-ecp-test2.sh @@ -1,23 +1,34 @@ #! /bin/sh -# Copyright (C) 2002 Red Hat, Inc. +# Copyright (C) 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Jakub Jelinek <jakub@redhat.com>, 2002. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./ecp testfile2 testfile2.tmp +testfiles testfile2 +tempfiles testfile2.tmp -rm -f testfile2 testfile2.tmp +testrun ./ecp testfile2 testfile2.tmp exit 0 diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh new file mode 100755 index 00000000..7da0886a --- /dev/null +++ b/tests/run-elflint-self.sh @@ -0,0 +1,62 @@ +#! /bin/sh +# Copyright (C) 2005, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +status=0 +runtest() { +# Uncomment for debuging +# echo $1 + if [ -f $1 ]; then + testrun ../src/elflint --quiet --gnu-ld $1 || + { echo "*** failure in $1"; status=1; } + fi +} + +runtest ../src/addr2line +runtest ../src/elfcmp +runtest ../src/elflint +runtest ../src/findtextrel +runtest ../src/ld +runtest ../src/nm +runtest ../src/objdump +runtest ../src/readelf +runtest ../src/size +runtest ../src/strip +runtest ../libelf/libelf.so +runtest ../libdw/libdw.so +runtest ../libasm/libasm.so +runtest ../libebl/libebl_alpha.so +runtest ../libebl/libebl_arm.so +runtest ../libebl/libebl_i386.so +runtest ../libebl/libebl_ia64.so +runtest ../libebl/libebl_ppc.so +runtest ../libebl/libebl_ppc64.so +runtest ../libebl/libebl_sh.so +runtest ../libebl/libebl_sparc.so +runtest ../libebl/libebl_x86_64.so + +exit $status diff --git a/tests/run-elflint-test.sh b/tests/run-elflint-test.sh new file mode 100755 index 00000000..e0e1c547 --- /dev/null +++ b/tests/run-elflint-test.sh @@ -0,0 +1,47 @@ +#! /bin/sh +# Copyright (C) 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile18 + +testrun_compare ../src/elflint --gnu-ld testfile18 <<\EOF +section [ 8] '.rela.dyn': relocation 1: copy relocation against symbol of type FUNC +EOF + +testfiles testfile32 +testrun ../src/elflint -q testfile32 + +testfiles testfile33 +testrun ../src/elflint -q testfile33 + +testfiles testfile42 +testrun ../src/elflint -q --gnu-ld testfile42 + +testfiles testfile46 +testrun ../src/elflint -q testfile46 + +exit 0 diff --git a/tests/run-find-prologues.sh b/tests/run-find-prologues.sh new file mode 100755 index 00000000..eddc9ee7 --- /dev/null +++ b/tests/run-find-prologues.sh @@ -0,0 +1,93 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile11 testfile22 testfile24 \ + testfile25 testfile3 testfile4 testfile5 testfile6 + +testrun_compare ./find-prologues -e testfile <<\EOF +main 0x000000000804842c 0x0000000008048432 +bar 0x000000000804845c 0x000000000804845f +foo 0x0000000008048468 0x000000000804846b +EOF + +testrun_compare ./find-prologues -e testfile11 <<\EOF +main 0x00000000080489b8 0x00000000080489cd +gnu_obj_2 0x0000000008048c9e 0x0000000008048ca4 +gnu_obj_3 0x0000000008048cd8 0x0000000008048cde +gnu_obj_2 0x0000000008048cf4 0x0000000008048cfa +~invalid_argument 0x0000000008048d2e 0x0000000008048d34 +gnu_obj_1 0x0000000008048d62 0x0000000008048d65 +gnu_obj_1 0x0000000008048d8a 0x0000000008048d8d +~invalid_argument 0x0000000008048db2 0x0000000008048db8 +EOF + +testrun_compare ./find-prologues -e testfile22 <<\EOF +function 0x0000000008048348 0x000000000804834e +main 0x000000000804835b 0x0000000008048377 +EOF + +testrun_compare ./find-prologues -e testfile24 <<\EOF +incr 0x0000000008048348 0x000000000804834e +main 0x0000000008048354 0x0000000008048360 +EOF + +testrun_compare ./find-prologues -e testfile25 <<\EOF +incr 0x0000000008048348 0x000000000804834c +EOF + +testrun_compare ./find-prologues -e testfile3 <<\EOF +main 0x000000000804842c 0x0000000008048433 +bar 0x0000000008048458 0x000000000804845b +foo 0x0000000008048464 0x0000000008048467 +EOF + +testrun_compare ./find-prologues -e testfile4 <<\EOF +get 0x00000000080493fc 0x0000000008049402 +main 0x0000000008049498 0x000000000804949e +a 0x000000000804d85c 0x000000000804d85c +__tfPCc 0x000000000804d86c 0x000000000804d872 +__tfCc 0x000000000804d8a4 0x000000000804d8a4 +EOF + +testrun_compare ./find-prologues -e testfile5 <<\EOF +bar 0x000000000804842c 0x000000000804842f +foo 0x0000000008048438 0x000000000804843b +main 0x0000000008048444 0x000000000804844a +EOF + +testrun_compare ./find-prologues -e testfile6 <<\EOF +main 0x00000000080489b8 0x00000000080489cd +gnu_obj_2 0x0000000008048c9e 0x0000000008048ca4 +gnu_obj_3 0x0000000008048cd8 0x0000000008048cde +gnu_obj_2 0x0000000008048cf4 0x0000000008048cfa +~invalid_argument 0x0000000008048d2e 0x0000000008048d34 +gnu_obj_1 0x0000000008048d62 0x0000000008048d65 +gnu_obj_1 0x0000000008048d8a 0x0000000008048d8d +~invalid_argument 0x0000000008048db2 0x0000000008048db8 +EOF + +exit 0 diff --git a/tests/run-funcscopes.sh b/tests/run-funcscopes.sh new file mode 100755 index 00000000..52e50f40 --- /dev/null +++ b/tests/run-funcscopes.sh @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile25 + +testrun_compare ./funcscopes -e testfile25 incr <<\EOF +testfile25: 0x8048000 .. 0x8049528 + inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9) + incr (0x2e): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9) + x [ 66] +EOF + +exit 0 diff --git a/tests/run-get-aranges.sh b/tests/run-get-aranges.sh index 26b29863..f78a4a1d 100644 --- a/tests/run-get-aranges.sh +++ b/tests/run-get-aranges.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./get-aranges testfile testfile2 > get-aranges.out +testfiles testfile testfile2 -cmp get-aranges.out - <<"EOF" +testrun_compare ./get-aranges testfile testfile2 <<\EOF 0x804842b: not in range CU name: "m.c" CU name: "m.c" @@ -66,6 +73,4 @@ CU name: "f.c" CU name: "m.c" EOF -rm -f testfile testfile2 get-aranges.out - exit 0 diff --git a/tests/run-get-files.sh b/tests/run-get-files.sh index 7af5c139..7d51f5fc 100644 --- a/tests/run-get-files.sh +++ b/tests/run-get-files.sh @@ -1,31 +1,40 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2004, 2005, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./get-files testfile testfile2 > get-files.out +testfiles testfile testfile2 -diff -u get-files.out - <<"EOF" +testrun_compare ./get-files testfile testfile2 <<\EOF cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 191 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" file[0] = "???" file[1] = "/home/drepper/gnu/new-bu/build/ttt/m.c" cuhl = 11, o = 114, asz = 4, osz = 4, ncu = 5617 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" file[0] = "???" file[1] = "/home/drepper/gnu/new-bu/build/ttt/b.c" file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h" @@ -39,9 +48,11 @@ cuhl = 11, o = 114, asz = 4, osz = 4, ncu = 5617 file[10] = "/usr/include/_G_config.h" file[11] = "/usr/include/gconv.h" cuhl = 11, o = 412, asz = 4, osz = 4, ncu = 5752 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" file[0] = "???" file[1] = "/home/drepper/gnu/new-bu/build/ttt/f.c" cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 2418 + dirs[0] = "/shoggoth/drepper" file[0] = "???" file[1] = "/shoggoth/drepper/b.c" file[2] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stddef.h" @@ -52,13 +63,13 @@ cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 2418 file[7] = "/usr/include/libio.h" file[8] = "/usr/include/_G_config.h" cuhl = 11, o = 213, asz = 4, osz = 4, ncu = 2521 + dirs[0] = "/shoggoth/drepper" file[0] = "???" file[1] = "/shoggoth/drepper/f.c" cuhl = 11, o = 267, asz = 4, osz = 4, ncu = 2680 + dirs[0] = "/shoggoth/drepper" file[0] = "???" file[1] = "/shoggoth/drepper/m.c" EOF -rm -f testfile testfil2 get-files.out - exit 0 diff --git a/tests/run-get-lines.sh b/tests/run-get-lines.sh index 70c9cd84..fb675dc7 100644 --- a/tests/run-get-lines.sh +++ b/tests/run-get-lines.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./get-lines testfile testfile2 > get-lines.out +testfiles testfile testfile2 -diff -u get-lines.out - <<"EOF" +testrun_compare ./get-lines testfile testfile2 <<\EOF cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 191 5 lines 804842c: /home/drepper/gnu/new-bu/build/ttt/m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no @@ -62,6 +69,4 @@ cuhl = 11, o = 267, asz = 4, osz = 4, ncu = 2680 10000514: /shoggoth/drepper/m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no EOF -rm -f testfile testfile2 get-lines.out - exit 0 diff --git a/tests/run-get-pubnames.sh b/tests/run-get-pubnames.sh index a232bfd2..131baf0d 100644 --- a/tests/run-get-pubnames.sh +++ b/tests/run-get-pubnames.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./get-pubnames testfile testfile2 > get-pubnames.out +testfiles testfile testfile2 -diff -u get-pubnames.out - <<"EOF" +testrun_compare ./get-pubnames testfile testfile2 <<\EOF [ 0] "main", die: 104, cu: 11 CU name: "m.c" object name: "main" @@ -48,6 +55,4 @@ CU name: "m.c" object name: "a" EOF -rm -f testfile testfile2 get-pubnames.out - exit 0 diff --git a/tests/run-line2addr.sh b/tests/run-line2addr.sh new file mode 100755 index 00000000..3fb6f471 --- /dev/null +++ b/tests/run-line2addr.sh @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 testfile8 testfile14 testfile23 + +testrun_compare ./line2addr -e testfile f.c:4 testfile f.c:8 <<\EOF +f.c:4 -> 0x804846b (/home/drepper/gnu/new-bu/build/ttt/f.c:4) +EOF + +testrun_compare ./line2addr -e testfile2 m.c:6 b.c:1 <<\EOF +m.c:6 -> 0x100004cc (/shoggoth/drepper/m.c:6) +b.c:1 -> 0x10000470 (/shoggoth/drepper/b.c:4) +EOF + +testrun_compare ./line2addr -e testfile8 strip.c:953 strip.c:365 <<\EOF +strip.c:953 -> (.text)+0x169f (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:953) +strip.c:953 -> (.text)+0x16aa (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:953) +strip.c:365 -> (.text)+0x278b (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:365) +strip.c:365 -> (.text)+0x2797 (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:365) +EOF + +testrun_compare ./line2addr -e testfile14 v.c:6 <<\EOF +v.c:6 -> 0x400468 (/home/drepper/local/elfutils-build/20050425/v.c:6) +v.c:6 -> 0x400487 (/home/drepper/local/elfutils-build/20050425/v.c:6) +EOF + +testrun_compare ./line2addr -e testfile23 foo.c:2 foo.c:6 <<\EOF +foo.c:2 -> (.init.text)+0xc (/home/roland/stock-elfutils-build/foo.c:2) +foo.c:6 -> (.text)+0xc (/home/roland/stock-elfutils-build/foo.c:6) +EOF + +exit 0 diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh new file mode 100755 index 00000000..99926b03 --- /dev/null +++ b/tests/run-native-test.sh @@ -0,0 +1,89 @@ +#! /bin/sh +# Copyright (C) 2005, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +. $srcdir/test-subr.sh + +# This tests all the miscellaneous components of backend support +# against whatever this build is running on. A platform will fail +# this test if it is missing parts of the backend implementation. +# +# As new backend code is added to satisfy the test, be sure to update +# the fixed test cases (run-allregs.sh et al) to test that backend +# in all builds. + +tempfiles native.c native +echo 'main () { while (1) pause (); }' > native.c + +native=0 +kill_native() +{ + test $native -eq 0 || { + kill -9 $native 2> /dev/null || : + wait $native 2> /dev/null || : + } + native=0 +} + +native_cleanup() +{ + kill_native + test_cleanup +} + +trap native_cleanup 0 1 2 15 + +for cc in "$HOSTCC" "$HOST_CC" cc gcc "$CC"; do + test "x$cc" != x || continue + $cc -o native -g native.c > /dev/null 2>&1 && + # Some shell versions don't do this right without the braces. + { ./native > /dev/null 2>&1 & native=$! ; } && + sleep 1 && kill -0 $native 2> /dev/null && + break || + native=0 +done + +native_test() +{ + # Try the build against itself, i.e. $config_host. + testrun "$@" -e $1 > /dev/null + + # Try the build against a presumed native process, running this sh. + # For tests requiring debug information, this may not test anything. + testrun "$@" -p $$ > /dev/null + + # Try the build against the trivial native program we just built with -g. + test $native -eq 0 || testrun "$@" -p $native > /dev/null +} + +native_test ./allregs +native_test ./funcretval + +# We do this explicitly rather than letting the trap 0 cover it, +# because as of version 3.1 bash prints the "Killed" report for +# $native when we do the kill inside the exit handler. +native_cleanup + +exit 0 diff --git a/tests/run-ranlib-test.sh b/tests/run-ranlib-test.sh new file mode 100755 index 00000000..01c0d0b7 --- /dev/null +++ b/tests/run-ranlib-test.sh @@ -0,0 +1,46 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +tempfiles ranlib-test.a ranlib-test.a-copy + +cat > ranlib-test.a <<"EOF" +!<arch> +foo/ 1124128960 500 500 100664 4 ` +foo +bar/ 1124128965 500 500 100664 4 ` +bar +EOF + +cp ranlib-test.a ranlib-test.a-copy + +testrun ../src/ranlib ranlib-test.a + +# The ranlib call should not have changed anything. +cmp ranlib-test.a ranlib-test.a-copy + +exit 0 diff --git a/tests/run-ranlib-test2.sh b/tests/run-ranlib-test2.sh new file mode 100755 index 00000000..87040376 --- /dev/null +++ b/tests/run-ranlib-test2.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile19} +indexed=${indexed:-testfile19.index} + +testfiles $original $indexed + +testrun ../src/ranlib $original + +if test -z "$noindex"; then + # The date in the index is different. The reference file has it blanked + # out, we do the same here. + echo " " | + dd of=$original seek=24 bs=1 count=12 conv=notrunc 2>/dev/null +fi + +cmp $original $indexed + +exit 0 diff --git a/tests/run-ranlib-test3.sh b/tests/run-ranlib-test3.sh new file mode 100755 index 00000000..7be6ddd3 --- /dev/null +++ b/tests/run-ranlib-test3.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile20 +indexed=testfile20.index +. $srcdir/run-ranlib-test2.sh diff --git a/tests/run-ranlib-test4.sh b/tests/run-ranlib-test4.sh new file mode 100755 index 00000000..eeeb56fb --- /dev/null +++ b/tests/run-ranlib-test4.sh @@ -0,0 +1,31 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile21 +indexed=testfile21.index +noindex=1 +. $srcdir/run-ranlib-test2.sh diff --git a/tests/run-readelf-test1.sh b/tests/run-readelf-test1.sh new file mode 100755 index 00000000..aaa03edb --- /dev/null +++ b/tests/run-readelf-test1.sh @@ -0,0 +1,53 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile11} +stripped=${stripped:-testfile7} +debugout=${debugfile:+-f testfile.debug.temp -F $debugfile} + +testfiles testfile3 + +tempfiles testfile.temp + +testrun ../src/readelf -r testfile3 > testfile.temp + +diff -u - testfile.temp <<EOF + +Relocation section [ 8] '.rel.got' for section [19] '.got' at offset 0x294 contains 1 entry: + Offset Type Value Name + 0x08049544 386_GLOB_DAT 0000000000 __gmon_start__ + +Relocation section [ 9] '.rel.plt' for section [11] '.plt' at offset 0x29c contains 4 entries: + Offset Type Value Name + 0x08049534 386_JMP_SLOT 0x080482e4 __register_frame_info + 0x08049538 386_JMP_SLOT 0x080482f4 __deregister_frame_info + 0x0804953c 386_JMP_SLOT 0x08048304 __libc_start_main + 0x08049540 386_JMP_SLOT 0x08048314 __cxa_finalize +EOF + +exit 0 diff --git a/tests/run-readelf-test2.sh b/tests/run-readelf-test2.sh new file mode 100755 index 00000000..4edaea6c --- /dev/null +++ b/tests/run-readelf-test2.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile28 + +testrun_compare ../src/readelf -x .strtab testfile28 <<\EOF + +Hex dump of section [6] '.strtab', 1 bytes at offset 0x290: + 0x00000000 00 . +EOF + +exit 0 diff --git a/tests/run-readelf-test3.sh b/tests/run-readelf-test3.sh new file mode 100755 index 00000000..71dd8aea --- /dev/null +++ b/tests/run-readelf-test3.sh @@ -0,0 +1,39 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile40.debug + +testrun_compare ../src/readelf -n testfile40.debug <<\EOF + +Note section [ 6] '.note' of 60 bytes at offset 0x120: + Owner Data size Type + GNU 20 GNU_BUILD_ID + Build ID: 34072edcd87ef6728f4b4a7956167b2fcfc3f1d3 + Linux 4 <unknown>: 0 +EOF + +exit 0 diff --git a/tests/run-readelf-test4.sh b/tests/run-readelf-test4.sh new file mode 100755 index 00000000..85e76ed0 --- /dev/null +++ b/tests/run-readelf-test4.sh @@ -0,0 +1,41 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile19.index + +testrun_compare ../src/readelf -c testfile19.index <<\EOF + +Index of archive 'testfile19.index' has 4 entries: +Archive member 'u1.o' contains: + a +Archive member 'u2.o' contains: + aa +Archive member 'u3.o' contains: + a +EOF + +exit 0 diff --git a/tests/run-show-abbrev.sh b/tests/run-show-abbrev.sh index 78812a5f..a148dffb 100644 --- a/tests/run-show-abbrev.sh +++ b/tests/run-show-abbrev.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./show-abbrev testfile testfile2 > show-abbrev.out +testfiles testfile testfile2 -diff -u show-abbrev.out - <<"EOF" +testrun_compare ./show-abbrev testfile testfile2 <<\EOF abbrev[0]: code = 1, tag = 17, children = 1 abbrev[0]: attr[0]: code = 16, form = 6, offset = 0 abbrev[0]: attr[1]: code = 18, form = 1, offset = 2 @@ -350,6 +357,4 @@ abbrev[96]: attr[4]: code = 63, form = 12, offset = 371 abbrev[96]: attr[5]: code = 2, form = 10, offset = 373 EOF -rm -f testfile testfile2 show-abbrev.out - exit 0 diff --git a/tests/run-show-ciefde.sh b/tests/run-show-ciefde.sh index b3355334..37505c00 100644 --- a/tests/run-show-ciefde.sh +++ b/tests/run-show-ciefde.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile3.bz2 > testfile3 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile4.bz2 > testfile4 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./show-ciefde testfile3 testfile4 > show-ciefde.out +testfiles testfile3 testfile4 -diff -u show-ciefde.out - <<"EOF" +testrun_compare ./show-ciefde testfile3 testfile4 <<\EOF testfile3 has 1 CIEs and 1 FDEs CIE[0]: bytes_in_cie = 16, version = 1, augmenter = "" CIE[0]: code_alignment_factor = 1 @@ -314,6 +321,4 @@ no FDE at 8048455 FDE[@80493fc]: cie_offset = 0, cie_index = 0, fde_offset = 28 EOF -rm -f testfile3 testfile4 show-ciefde.out - exit 0 diff --git a/tests/run-show-die-info.sh b/tests/run-show-die-info.sh index 04263268..47b51513 100644 --- a/tests/run-show-die-info.sh +++ b/tests/run-show-die-info.sh @@ -1,27 +1,34 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile5.bz2 > testfile5 2>/dev/null || exit 0 +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +. $srcdir/test-subr.sh -./show-die-info testfile5 testfile2 > show-die-info.out +testfiles testfile5 testfile2 -diff -u show-die-info.out - <<"EOF" +testrun_compare ./show-die-info testfile5 testfile2 <<\EOF file: testfile5 New CU: off = 0, hsize = 11, ab = 0, as = 4, os = 4 DW_TAG_compile_unit @@ -983,6 +990,4 @@ New CU: off = 2521, hsize = 11, ab = 267, as = 4, os = 4 Attrs : location name decl_file decl_line external type EOF -rm -f testfile2 testfile5 show-die-info.out - exit 0 diff --git a/tests/run-strings-test.sh b/tests/run-strings-test.sh new file mode 100755 index 00000000..a5dac634 --- /dev/null +++ b/tests/run-strings-test.sh @@ -0,0 +1,478 @@ +#! /bin/sh +# Copyright (C) 2005, 2006, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +files="testfile `seq 2 9 | while read n; do echo testfile$n; done`" +testfiles $files + +testrun_compare ../src/strings -tx -f $files <<\EOF +testfile: f4 /lib/ld-linux.so.2 +testfile: 1c9 __gmon_start__ +testfile: 1d8 libc.so.6 +testfile: 1e2 __cxa_finalize +testfile: 1f1 __deregister_frame_info +testfile: 209 _IO_stdin_used +testfile: 218 __libc_start_main +testfile: 22a __register_frame_info +testfile: 240 GLIBC_2.1.3 +testfile: 24c GLIBC_2.0 +testfile: 338 PTRh +testfile: 345 QVh, +testfile2: 114 /lib/ld.so.1 +testfile2: 1f1 __gmon_start__ +testfile2: 200 __deregister_frame_info +testfile2: 218 __register_frame_info +testfile2: 22e libc.so.6 +testfile2: 238 __cxa_finalize +testfile2: 247 _IO_stdin_used +testfile2: 256 __libc_start_main +testfile2: 268 GLIBC_2.1.3 +testfile2: 274 GLIBC_2.0 +testfile2: 488 }a[xN +testfile2: 4a8 }a[xN +testfile2: 50c }a[xN +testfile2: 540 }?Kx +testfile3: f4 /lib/ld-linux.so.2 +testfile3: 1c9 __gmon_start__ +testfile3: 1d8 libc.so.6 +testfile3: 1e2 __cxa_finalize +testfile3: 1f1 __deregister_frame_info +testfile3: 209 _IO_stdin_used +testfile3: 218 __libc_start_main +testfile3: 22a __register_frame_info +testfile3: 240 GLIBC_2.1.3 +testfile3: 24c GLIBC_2.0 +testfile3: 338 PTRh +testfile3: 345 QVh, +testfile4: f4 /lib/ld-linux.so.2 +testfile4: 8e1 __gmon_start__ +testfile4: 8f0 __terminate_func +testfile4: 901 stderr +testfile4: 908 __tf9type_info +testfile4: 917 __tf16__user_type_info +testfile4: 92e __tf19__pointer_type_info +testfile4: 948 __tf16__attr_type_info +testfile4: 95f __tf16__func_type_info +testfile4: 976 __vt_9type_info +testfile4: 986 __vt_19__pointer_type_info +testfile4: 9a1 __vt_16__attr_type_info +testfile4: 9b9 __vt_16__func_type_info +testfile4: 9d1 __vt_16__ptmf_type_info +testfile4: 9e9 __vt_16__ptmd_type_info +testfile4: a01 __vt_17__array_type_info +testfile4: a1a __tiv +testfile4: a20 __vt_19__builtin_type_info +testfile4: a3b __tix +testfile4: a41 __til +testfile4: a47 __tii +testfile4: a4d __tis +testfile4: a53 __tib +testfile4: a59 __tic +testfile4: a5f __tiw +testfile4: a65 __tir +testfile4: a6b __tid +testfile4: a71 __tif +testfile4: a77 __tiUi +testfile4: a7e __tiUl +testfile4: a85 __tiUx +testfile4: a8c __tiUs +testfile4: a93 __tiUc +testfile4: a9a __tiSc +testfile4: aa1 __ti19__pointer_type_info +testfile4: abb __ti9type_info +testfile4: aca __ti16__attr_type_info +testfile4: ae1 __ti19__builtin_type_info +testfile4: afb __ti16__func_type_info +testfile4: b12 __ti16__ptmf_type_info +testfile4: b29 __ti16__ptmd_type_info +testfile4: b40 __ti17__array_type_info +testfile4: b58 __cplus_type_matcher +testfile4: b6d __vt_13bad_exception +testfile4: b82 __vt_9exception +testfile4: b92 _._13bad_exception +testfile4: ba5 __vt_8bad_cast +testfile4: bb4 _._8bad_cast +testfile4: bc1 __vt_10bad_typeid +testfile4: bd3 _._10bad_typeid +testfile4: be3 __ti9exception +testfile4: bf2 __ti13bad_exception +testfile4: c06 __vt_16__user_type_info +testfile4: c1e __vt_17__class_type_info +testfile4: c37 __vt_14__si_type_info +testfile4: c4d __ti8bad_cast +testfile4: c5b __ti10bad_typeid +testfile4: c6c __ti16__user_type_info +testfile4: c83 __ti14__si_type_info +testfile4: c98 __ti17__class_type_info +testfile4: cb0 libc.so.6 +testfile4: cba __register_frame +testfile4: ccb pthread_create +testfile4: cda pthread_getspecific +testfile4: cee pthread_key_delete +testfile4: d01 __cxa_finalize +testfile4: d10 malloc +testfile4: d17 __frame_state_for +testfile4: d29 abort +testfile4: d2f __register_frame_table +testfile4: d46 fprintf +testfile4: d4e pthread_once +testfile4: d5b __deregister_frame_info +testfile4: d73 pthread_key_create +testfile4: d86 memset +testfile4: d8d strcmp +testfile4: d94 pthread_mutex_unlock +testfile4: da9 __deregister_frame +testfile4: dbc pthread_mutex_lock +testfile4: dcf _IO_stdin_used +testfile4: dde __libc_start_main +testfile4: df0 strlen +testfile4: df7 __register_frame_info_table +testfile4: e13 __register_frame_info +testfile4: e29 pthread_setspecific +testfile4: e3d free +testfile4: e42 GLIBC_2.1.3 +testfile4: e4e GLIBC_2.0 +testfile4: 1308 PTRh< +testfile4: 194b [^_] +testfile4: 19bf [^_] +testfile4: 1dd9 wT9L> +testfile4: 1f3b [^_] +testfile4: 1fae [^_] +testfile4: 21c1 BZQRP +testfile4: 237f [^_] +testfile4: 2431 JWRV +testfile4: 2454 [^_] +testfile4: 2506 JWRV +testfile4: 2529 [^_] +testfile4: 2b6c [^_] +testfile4: 2b9d ZYPV +testfile4: 2c28 [^_] +testfile4: 2c4d ZYPV +testfile4: 2ce2 [^_] +testfile4: 2dfb X^_] +testfile4: 2fc8 [^_] +testfile4: 307d tq;F +testfile4: 315a [^_] +testfile4: 31a5 :zt 1 +testfile4: 3238 [^_] +testfile4: 32f8 AXY_VR +testfile4: 334a [^_] +testfile4: 37ab [^_] +testfile4: 38b8 sU;E +testfile4: 38f2 QRPV +testfile4: 3926 [^_] +testfile4: 3bfe QRWP +testfile4: 3e65 [^_] +testfile4: 4136 [^_] +testfile4: 472d [^_] +testfile4: 47a5 0[^_] +testfile4: 48ab [^_] +testfile4: 4ab1 _ZPV +testfile4: 4b53 _ZPV +testfile4: 4bd3 _ZPV +testfile4: 4e05 PQWj +testfile4: 4f75 [^_] +testfile4: 4f9b u$;E u +testfile4: 4feb [^_] +testfile4: 5080 [^_] +testfile4: 50a8 }$9u +testfile4: 5149 [^_] +testfile4: 51b0 [^_] +testfile4: 539b [^_] +testfile4: 53b5 E 9E +testfile4: 540d x!)E +testfile4: 5598 U$ B +testfile4: 571c [^_] +testfile4: 5819 [^_] +testfile4: 5922 [^_] +testfile4: 59c2 [^_] +testfile4: 5a62 [^_] +testfile4: 5b02 [^_] +testfile4: 5ba2 [^_] +testfile4: 5c42 [^_] +testfile4: 5ce2 [^_] +testfile4: 6112 [^_] +testfile4: 62bb [^_] +testfile4: 639b [^_] +testfile4: 6436 [^_] +testfile4: 6468 val is zero +testfile4: 6480 Internal Compiler Bug: No runtime type matcher. +testfile4: 64dc 19__pointer_type_info +testfile4: 64f2 16__attr_type_info +testfile4: 6505 19__builtin_type_info +testfile4: 651b 16__func_type_info +testfile4: 652e 16__ptmf_type_info +testfile4: 6541 16__ptmd_type_info +testfile4: 6554 17__array_type_info +testfile4: 6568 9exception +testfile4: 6573 13bad_exception +testfile4: 6583 9type_info +testfile4: 658e 8bad_cast +testfile4: 6598 10bad_typeid +testfile4: 65a5 16__user_type_info +testfile4: 65b8 14__si_type_info +testfile4: 65c9 17__class_type_info +testfile4: 6fc1 H. $ +testfile5: f4 /lib/ld-linux.so.2 +testfile5: 1c9 __gmon_start__ +testfile5: 1d8 libc.so.6 +testfile5: 1e2 __cxa_finalize +testfile5: 1f1 __deregister_frame_info +testfile5: 209 _IO_stdin_used +testfile5: 218 __libc_start_main +testfile5: 22a __register_frame_info +testfile5: 240 GLIBC_2.1.3 +testfile5: 24c GLIBC_2.0 +testfile5: 338 PTRh +testfile5: 345 QVhD +testfile6: 114 /lib/ld-linux.so.2 +testfile6: 3d9 libstdc++.so.5 +testfile6: 3e8 _ZTVSt16invalid_argument +testfile6: 401 _ZNSaIcEC1Ev +testfile6: 40e _ZTSSt16invalid_argument +testfile6: 427 _ZTVN10__cxxabiv120__si_class_type_infoE +testfile6: 450 _ZNSsD1Ev +testfile6: 45a _ZdlPv +testfile6: 461 __cxa_end_catch +testfile6: 471 __gxx_personality_v0 +testfile6: 486 _ZTISt9exception +testfile6: 497 _ZNSaIcED1Ev +testfile6: 4a4 _ZTISt11logic_error +testfile6: 4b8 _ZNSt16invalid_argumentD1Ev +testfile6: 4d4 _ZTVN10__cxxabiv117__class_type_infoE +testfile6: 4fa __cxa_throw +testfile6: 506 _ZNSt16invalid_argumentC1ERKSs +testfile6: 525 _ZNSsC1EPKcRKSaIcE +testfile6: 538 _ZNSt11logic_errorD2Ev +testfile6: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE +testfile6: 579 _ZNSt16invalid_argumentD0Ev +testfile6: 595 __cxa_begin_catch +testfile6: 5a7 __cxa_allocate_exception +testfile6: 5c0 _ZNKSt11logic_error4whatEv +testfile6: 5db _Jv_RegisterClasses +testfile6: 5ef _ZTISt16invalid_argument +testfile6: 608 __gmon_start__ +testfile6: 617 libm.so.6 +testfile6: 621 _IO_stdin_used +testfile6: 630 libgcc_s.so.1 +testfile6: 63e _Unwind_Resume +testfile6: 64d libc.so.6 +testfile6: 657 __libc_start_main +testfile6: 669 GCC_3.0 +testfile6: 671 GLIBC_2.0 +testfile6: 67b GLIBCPP_3.2 +testfile6: 687 CXXABI_1.2 +testfile6: 908 PTRh +testfile6: e48 gdb.1 +testfile6: ec8 N10__gnu_test9gnu_obj_1E +testfile6: ee1 N10__gnu_test9gnu_obj_2IiEE +testfile6: efd N10__gnu_test9gnu_obj_2IlEE +testfile6: f19 St16invalid_argument +testfile7: 114 /lib/ld-linux.so.2 +testfile7: 3d9 libstdc++.so.5 +testfile7: 3e8 _ZTVSt16invalid_argument +testfile7: 401 _ZNSaIcEC1Ev +testfile7: 40e _ZTSSt16invalid_argument +testfile7: 427 _ZTVN10__cxxabiv120__si_class_type_infoE +testfile7: 450 _ZNSsD1Ev +testfile7: 45a _ZdlPv +testfile7: 461 __cxa_end_catch +testfile7: 471 __gxx_personality_v0 +testfile7: 486 _ZTISt9exception +testfile7: 497 _ZNSaIcED1Ev +testfile7: 4a4 _ZTISt11logic_error +testfile7: 4b8 _ZNSt16invalid_argumentD1Ev +testfile7: 4d4 _ZTVN10__cxxabiv117__class_type_infoE +testfile7: 4fa __cxa_throw +testfile7: 506 _ZNSt16invalid_argumentC1ERKSs +testfile7: 525 _ZNSsC1EPKcRKSaIcE +testfile7: 538 _ZNSt11logic_errorD2Ev +testfile7: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE +testfile7: 579 _ZNSt16invalid_argumentD0Ev +testfile7: 595 __cxa_begin_catch +testfile7: 5a7 __cxa_allocate_exception +testfile7: 5c0 _ZNKSt11logic_error4whatEv +testfile7: 5db _Jv_RegisterClasses +testfile7: 5ef _ZTISt16invalid_argument +testfile7: 608 __gmon_start__ +testfile7: 617 libm.so.6 +testfile7: 621 _IO_stdin_used +testfile7: 630 libgcc_s.so.1 +testfile7: 63e _Unwind_Resume +testfile7: 64d libc.so.6 +testfile7: 657 __libc_start_main +testfile7: 669 GCC_3.0 +testfile7: 671 GLIBC_2.0 +testfile7: 67b GLIBCPP_3.2 +testfile7: 687 CXXABI_1.2 +testfile7: 908 PTRh +testfile7: e48 gdb.1 +testfile7: ec8 N10__gnu_test9gnu_obj_1E +testfile7: ee1 N10__gnu_test9gnu_obj_2IiEE +testfile7: efd N10__gnu_test9gnu_obj_2IlEE +testfile7: f19 St16invalid_argument +testfile8: 79 XZh; +testfile8: 87 YXh< +testfile8: 14f SQh[ +testfile8: 259 t5Wj +testfile8: 502 WRVQ +testfile8: 1fe7 ZYPj +testfile8: 2115 u'Pj +testfile8: 7bba FILE +testfile8: 7bbf preserve-dates +testfile8: 7bce remove-comment +testfile8: 7bdd Remove .comment section +testfile8: 7bf6 ${prefix}/share +testfile8: 7c06 elfutils +testfile8: 7c0f a.out +testfile8: 7c15 0.58 +testfile8: 7c1a strip (Red Hat %s) %s +testfile8: 7c31 2002 +testfile8: 7c36 Ulrich Drepper +testfile8: 7c45 Written by %s. +testfile8: 7c55 cannot stat input file "%s" +testfile8: 7c71 %s: INTERNAL ERROR: %s +testfile8: 7c88 while opening "%s" +testfile8: 7c9b handle_elf +testfile8: 7ca6 ../../src/strip.c +testfile8: 7cb8 shdr_info[cnt].group_idx != 0 +testfile8: 7cd6 illformed file `%s' +testfile8: 7cea elf_ndxscn (scn) == cnt +testfile8: 7d02 .shstrtab +testfile8: 7d0c while writing `%s': %s +testfile8: 7d23 ((sym->st_info) & 0xf) == 3 +testfile8: 7d3f shndxdata != ((void *)0) +testfile8: 7d58 scn != ((void *)0) +testfile8: 7d6b .gnu_debuglink +testfile8: 7d7a .comment +testfile8: 7d83 cannot open `%s' +testfile8: 7da0 Place stripped output into FILE +testfile8: 7dc0 Extract the removed sections into FILE +testfile8: 7e00 Copy modified/access timestamps to the output +testfile8: 7e40 Only one input file allowed together with '-o' and '-f' +testfile8: 7e80 Copyright (C) %s Red Hat, Inc. +testfile8: 7e9f This is free software; see the source for copying conditions. There is NO +testfile8: 7eea warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +testfile8: 7f40 Report bugs to <drepper@redhat.com>. +testfile8: 7f80 %s: File format not recognized +testfile8: 7fa0 cannot set access and modification date of "%s" +testfile8: 7fe0 cannot create new file `%s': %s +testfile8: 8000 error while finishing `%s': %s +testfile8: 8020 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0 +testfile8: 8060 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0 +testfile8: 80a0 %s: error while creating ELF header: %s +testfile8: 80e0 %s: error while reading the file: %s +testfile8: 8120 sec < 0xff00 || shndxdata != ((void *)0) +testfile8: 8160 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize +testfile8: 81c0 shdr_info[cnt].shdr.sh_type == 11 +testfile8: 8200 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize +testfile8: 8260 shdr_info[cnt].shdr.sh_type == 18 +testfile8: 82a0 shdr_info[cnt].data != ((void *)0) +testfile8: 82e0 elf_ndxscn (shdr_info[cnt].newscn) == idx +testfile8: 8320 while create section header section: %s +testfile8: 8360 cannot allocate section data: %s +testfile8: 83a0 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx +testfile8: 83e0 while generating output file: %s +testfile8: 8420 while preparing output for `%s' +testfile8: 8440 shdr_info[cnt].shdr.sh_type == 2 +testfile8: 8480 shdr_info[idx].data != ((void *)0) +testfile8: 84c0 cannot determine number of sections: %s +testfile8: 8500 cannot get section header string table index +testfile8: 85c0 Discard symbols from object files. +testfile8: 85e3 [FILE...] +testfile9: 79 XZh; +testfile9: 87 YXh< +testfile9: 14f SQh[ +testfile9: 259 t5Wj +testfile9: 502 WRVQ +testfile9: 1fe7 ZYPj +testfile9: 2115 u'Pj +testfile9: 3414 FILE +testfile9: 3419 preserve-dates +testfile9: 3428 remove-comment +testfile9: 3437 Remove .comment section +testfile9: 3450 ${prefix}/share +testfile9: 3460 elfutils +testfile9: 3469 a.out +testfile9: 346f 0.58 +testfile9: 3474 strip (Red Hat %s) %s +testfile9: 348b 2002 +testfile9: 3490 Ulrich Drepper +testfile9: 349f Written by %s. +testfile9: 34af cannot stat input file "%s" +testfile9: 34cb %s: INTERNAL ERROR: %s +testfile9: 34e2 while opening "%s" +testfile9: 34f5 handle_elf +testfile9: 3500 ../../src/strip.c +testfile9: 3512 shdr_info[cnt].group_idx != 0 +testfile9: 3530 illformed file `%s' +testfile9: 3544 elf_ndxscn (scn) == cnt +testfile9: 355c .shstrtab +testfile9: 3566 while writing `%s': %s +testfile9: 357d ((sym->st_info) & 0xf) == 3 +testfile9: 3599 shndxdata != ((void *)0) +testfile9: 35b2 scn != ((void *)0) +testfile9: 35c5 .gnu_debuglink +testfile9: 35d4 .comment +testfile9: 35dd cannot open `%s' +testfile9: 3600 Place stripped output into FILE +testfile9: 3620 Extract the removed sections into FILE +testfile9: 3660 Copy modified/access timestamps to the output +testfile9: 36a0 Only one input file allowed together with '-o' and '-f' +testfile9: 36e0 Copyright (C) %s Red Hat, Inc. +testfile9: 36ff This is free software; see the source for copying conditions. There is NO +testfile9: 374a warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +testfile9: 37a0 Report bugs to <drepper@redhat.com>. +testfile9: 37e0 %s: File format not recognized +testfile9: 3800 cannot set access and modification date of "%s" +testfile9: 3840 cannot create new file `%s': %s +testfile9: 3860 error while finishing `%s': %s +testfile9: 3880 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0 +testfile9: 38c0 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0 +testfile9: 3900 %s: error while creating ELF header: %s +testfile9: 3940 %s: error while reading the file: %s +testfile9: 3980 sec < 0xff00 || shndxdata != ((void *)0) +testfile9: 39c0 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize +testfile9: 3a20 shdr_info[cnt].shdr.sh_type == 11 +testfile9: 3a60 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize +testfile9: 3ac0 shdr_info[cnt].shdr.sh_type == 18 +testfile9: 3b00 shdr_info[cnt].data != ((void *)0) +testfile9: 3b40 elf_ndxscn (shdr_info[cnt].newscn) == idx +testfile9: 3b80 while create section header section: %s +testfile9: 3bc0 cannot allocate section data: %s +testfile9: 3c00 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx +testfile9: 3c40 while generating output file: %s +testfile9: 3c80 while preparing output for `%s' +testfile9: 3ca0 shdr_info[cnt].shdr.sh_type == 2 +testfile9: 3ce0 shdr_info[idx].data != ((void *)0) +testfile9: 3d20 cannot determine number of sections: %s +testfile9: 3d60 cannot get section header string table index +testfile9: 3e20 Discard symbols from object files. +testfile9: 3e43 [FILE...] +EOF + +exit 0 diff --git a/tests/run-strip-test.sh b/tests/run-strip-test.sh index aab37f48..e056f890 100644 --- a/tests/run-strip-test.sh +++ b/tests/run-strip-test.sh @@ -1,33 +1,64 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile11} +stripped=${stripped:-testfile7} +debugout=${debugfile:+-f testfile.debug.temp -F $debugfile} + +testfiles $original +test x$stripped = xtestfile.temp || testfiles $stripped $debugfile -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile11.bz2 > testfile11 2>/dev/null || exit 0 +tempfiles testfile.temp testfile.debug.temp testfile.unstrip -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile7.bz2 > testfile7 2>/dev/null || exit 0 +testrun ../src/strip -o testfile.temp $debugout $original -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/strip -o testfile.temp testfile11 +status=0 -cmp testfile7 testfile.temp +cmp $stripped testfile.temp || status=$? # Check elflint and the expected result. -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/elflint -q testfile.temp +testrun ../src/elflint -q testfile.temp || status=$? + +test -z "$debugfile" || { +cmp $debugfile testfile.debug.temp || status=$? + +# Check elflint and the expected result. +testrun ../src/elflint -q -d testfile.debug.temp || status=$? + +# Now test unstrip recombining those files. +testrun ../src/unstrip -o testfile.unstrip testfile.temp testfile.debug.temp + +# Check that it came back whole. +testrun ../src/elfcmp --hash-inexact $original testfile.unstrip +} -rm -f testfile11 testfile7 testfile.temp +tempfiles testfile.sections +testrun ../src/readelf -S testfile.temp > testfile.sections || status=$? +fgrep ' .debug_' testfile.sections && status=1 -exit 0 +exit $status diff --git a/tests/run-strip-test2.sh b/tests/run-strip-test2.sh index f385a865..a5858d2e 100644 --- a/tests/run-strip-test2.sh +++ b/tests/run-strip-test2.sh @@ -1,33 +1,30 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 0 - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile9.bz2 > testfile9 2>/dev/null || exit 0 - -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/strip -o testfile.temp testfile8 - -cmp testfile9 testfile.temp - -# Check elflint and the expected result. -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/elflint -q testfile.temp +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -rm -f testfile8 testfile9 testfile.temp -exit 0 +original=testfile8 +stripped=testfile9 +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test3.sh b/tests/run-strip-test3.sh index 5ff4a5a9..3d52f6e9 100644 --- a/tests/run-strip-test3.sh +++ b/tests/run-strip-test3.sh @@ -1,33 +1,30 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # -# This program is Open Source software; you can redistribute it and/or -# modify it under the terms of the Open Software License version 1.0 as -# published by the Open Source Initiative. +# Red Hat elfutils 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; version 2 of the License. # -# You should have received a copy of the Open Software License along -# with this program; if not, you may obtain a copy of the Open Software -# License version 1.0 from http://www.opensource.org/licenses/osl.php or -# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., -# 3001 King Ranch Road, Ukiah, CA 95482. -set -e - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile12.bz2 > testfile12 2>/dev/null || exit 0 - -# Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile13.bz2 > testfile13 2>/dev/null || exit 0 - -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/strip -o testfile.temp testfile12 - -cmp testfile13 testfile.temp - -# Check elflint and the expected result. -LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/elflint -q testfile.temp +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. -rm -f testfile12 testfile13 testfile.temp -exit 0 +original=testfile12 +stripped=testfile13 +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test4.sh b/tests/run-strip-test4.sh new file mode 100755 index 00000000..64924a92 --- /dev/null +++ b/tests/run-strip-test4.sh @@ -0,0 +1,5 @@ +original=testfile11 +stripped=testfile37 +debugfile=testfile37.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test5.sh b/tests/run-strip-test5.sh new file mode 100755 index 00000000..9fa9ebef --- /dev/null +++ b/tests/run-strip-test5.sh @@ -0,0 +1,5 @@ +original=testfile8 +stripped=testfile16 +debugfile=testfile16.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test6.sh b/tests/run-strip-test6.sh new file mode 100755 index 00000000..c59bf5e4 --- /dev/null +++ b/tests/run-strip-test6.sh @@ -0,0 +1,5 @@ +original=testfile12 +stripped=testfile35 +debugfile=testfile35.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test7.sh b/tests/run-strip-test7.sh new file mode 100755 index 00000000..c65cd050 --- /dev/null +++ b/tests/run-strip-test7.sh @@ -0,0 +1,5 @@ +original=testfile39 +stripped=testfile40 +debugfile=testfile40.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test8.sh b/tests/run-strip-test8.sh new file mode 100755 index 00000000..fb9fa087 --- /dev/null +++ b/tests/run-strip-test8.sh @@ -0,0 +1,5 @@ +original=testfile47 +stripped=testfile48 +debugfile=testfile48.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-unstrip-test.sh b/tests/run-unstrip-test.sh new file mode 100755 index 00000000..8f0fc698 --- /dev/null +++ b/tests/run-unstrip-test.sh @@ -0,0 +1,42 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile12} +stripped=${stripped:-testfile17} +debugfile=${debugfile:-${stripped}.debug} + +testfiles $original $stripped $debugfile +tempfiles testfile.unstrip + +# These are old reference output from run-test-strip6.sh, when +# strip left the .debug file with unchanged sh_size in +# stripped sections that shrank in the stripped file. strip +# no longer does that, but unstrip must still handle it. + +testrun ../src/unstrip -o testfile.unstrip $stripped $debugfile + +testrun ../src/elfcmp --hash-inexact $original testfile.unstrip diff --git a/tests/run-unstrip-test2.sh b/tests/run-unstrip-test2.sh new file mode 100755 index 00000000..44074c19 --- /dev/null +++ b/tests/run-unstrip-test2.sh @@ -0,0 +1,5 @@ +original=testfile11 +stripped=testfile15 +debugfile=testfile15.debug + +. $srcdir/run-unstrip-test.sh diff --git a/tests/saridx.c b/tests/saridx.c index 4abc892f..d95777f9 100644 --- a/tests/saridx.c +++ b/tests/saridx.c @@ -1,15 +1,27 @@ /* Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> diff --git a/tests/scnnames.c b/tests/scnnames.c index de30312e..4ced85c4 100644 --- a/tests/scnnames.c +++ b/tests/scnnames.c @@ -1,15 +1,27 @@ -/* Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> @@ -29,6 +41,12 @@ main (int argc, char *argv[]) size_t strndx; Elf_Scn *scn; + if (argc < 2) + { + puts ("missing parameter"); + exit (1); + } + fd = open (argv[1], O_RDONLY); if (fd == -1) { diff --git a/tests/sectiondump.c b/tests/sectiondump.c index f19a2151..3fdde54b 100644 --- a/tests/sectiondump.c +++ b/tests/sectiondump.c @@ -1,15 +1,27 @@ /* Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> diff --git a/tests/sha1-tst.c b/tests/sha1-tst.c new file mode 100644 index 00000000..9ff8141b --- /dev/null +++ b/tests/sha1-tst.c @@ -0,0 +1,79 @@ +/* Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2008. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <stdio.h> +#include <string.h> + +#include <sha1.h> + + +int +main (void) +{ + char buf[1000]; + int result = 0; + + struct sha1_ctx ctx; + sha1_init_ctx (&ctx); + sha1_process_bytes ("abc", 3, &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected1[SHA1_DIGEST_SIZE] = + "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e" + "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d"; + if (memcmp (buf, expected1, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 1 failed"); + result = 1; + } + + sha1_init_ctx (&ctx); + sha1_process_bytes ("\ +abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56, &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected2[SHA1_DIGEST_SIZE] = + "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae" + "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1"; + if (memcmp (buf, expected2, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 2 failed"); + result = 1; + } + + sha1_init_ctx (&ctx); + memset (buf, 'a', sizeof (buf)); + for (int i = 0; i < 1000; ++i) + sha1_process_bytes (buf, sizeof (buf), &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected3[SHA1_DIGEST_SIZE] = + "\x34\xaa\x97\x3c\xd4\xc4\xda\xa4\xf6\x1e" + "\xeb\x2b\xdb\xad\x27\x31\x65\x34\x01\x6f"; + if (memcmp (buf, expected3, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 3 failed"); + result = 1; + } + + return result; +} diff --git a/tests/show-abbrev.c b/tests/show-abbrev.c index 7017932f..75fddf5e 100644 --- a/tests/show-abbrev.c +++ b/tests/show-abbrev.c @@ -1,21 +1,33 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> #include <fcntl.h> #include <inttypes.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <stdio.h> #include <unistd.h> @@ -53,7 +65,7 @@ main (int argc, char *argv[]) { size_t length; Dwarf_Abbrev *abbrev = dwarf_getabbrev (&die, offset, &length); - if (abbrev == NULL) + if (abbrev == NULL || abbrev == DWARF_END_ABBREV) /* End of the list. */ break; diff --git a/tests/show-die-info.c b/tests/show-die-info.c index d4f992f3..19015ca1 100644 --- a/tests/show-die-info.c +++ b/tests/show-die-info.c @@ -1,22 +1,34 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> #include <dwarf.h> #include <inttypes.h> #include <libelf.h> -#include <libdw.h> +#include ELFUTILS_HEADER(dw) #include <fcntl.h> #include <stdio.h> #include <string.h> @@ -65,13 +77,24 @@ static const char *tagnames[] = [DW_TAG_namelist_item] = "DW_TAG_namelist_item", [DW_TAG_packed_type] = "DW_TAG_packed_type", [DW_TAG_subprogram] = "DW_TAG_subprogram", - [DW_TAG_template_type_param] = "DW_TAG_template_type_param", - [DW_TAG_template_value_param] = "DW_TAG_template_value_param", + [DW_TAG_template_type_parameter] = "DW_TAG_template_type_parameter", + [DW_TAG_template_value_parameter] = "DW_TAG_template_value_parameter", [DW_TAG_thrown_type] = "DW_TAG_thrown_type", [DW_TAG_try_block] = "DW_TAG_try_block", [DW_TAG_variant_part] = "DW_TAG_variant_part", [DW_TAG_variable] = "DW_TAG_variable", - [DW_TAG_volatile_type] = "DW_TAG_volatile_type" + [DW_TAG_volatile_type] = "DW_TAG_volatile_type", + [DW_TAG_dwarf_procedure] = "DW_TAG_dwarf_procedure", + [DW_TAG_restrict_type] = "DW_TAG_restrict_type", + [DW_TAG_interface_type] = "DW_TAG_interface_type", + [DW_TAG_namespace] = "DW_TAG_namespace", + [DW_TAG_imported_module] = "DW_TAG_imported_module", + [DW_TAG_unspecified_type] = "DW_TAG_unspecified_type", + [DW_TAG_partial_unit] = "DW_TAG_partial_unit", + [DW_TAG_imported_unit] = "DW_TAG_imported_unit", + [DW_TAG_mutable_type] = "DW_TAG_mutable_type", + [DW_TAG_condition] = "DW_TAG_condition", + [DW_TAG_shared_type] = "DW_TAG_shared_type", }; #define ntagnames (sizeof (tagnames) / sizeof (tagnames[0])) @@ -113,7 +136,7 @@ const struct { DW_AT_prototyped, "prototyped" }, { DW_AT_return_addr, "return_addr" }, { DW_AT_start_scope, "start_scope" }, - { DW_AT_stride_size, "stride_size" }, + { DW_AT_bit_stride, "bit_stride" }, { DW_AT_upper_bound, "upper_bound" }, { DW_AT_abstract_origin, "abstract_origin" }, { DW_AT_accessibility, "accessibility" }, @@ -134,7 +157,7 @@ const struct { DW_AT_friend, "friend" }, { DW_AT_identifier_case, "identifier_case" }, { DW_AT_macro_info, "macro_info" }, - { DW_AT_namelist_items, "namelist_items" }, + { DW_AT_namelist_item, "namelist_item" }, { DW_AT_priority, "priority" }, { DW_AT_segment, "segment" }, { DW_AT_specification, "specification" }, @@ -144,6 +167,33 @@ const struct { DW_AT_variable_parameter, "variable_parameter" }, { DW_AT_virtuality, "virtuality" }, { DW_AT_vtable_elem_location, "vtable_elem_location" }, + { DW_AT_allocated, "allocated" }, + { DW_AT_associated, "associated" }, + { DW_AT_data_location, "data_location" }, + { DW_AT_byte_stride, "byte_stride" }, + { DW_AT_entry_pc, "entry_pc" }, + { DW_AT_use_UTF8, "use_UTF8" }, + { DW_AT_extension, "extension" }, + { DW_AT_ranges, "ranges" }, + { DW_AT_trampoline, "trampoline" }, + { DW_AT_call_column, "call_column" }, + { DW_AT_call_file, "call_file" }, + { DW_AT_call_line, "call_line" }, + { DW_AT_description, "description" }, + { DW_AT_binary_scale, "binary_scale" }, + { DW_AT_decimal_scale, "decimal_scale" }, + { DW_AT_small, "small" }, + { DW_AT_decimal_sign, "decimal_sign" }, + { DW_AT_digit_count, "digit_count" }, + { DW_AT_picture_string, "picture_string" }, + { DW_AT_mutable, "mutable" }, + { DW_AT_threads_scaled, "threads_scaled" }, + { DW_AT_explicit, "explicit" }, + { DW_AT_object_pointer, "object_pointer" }, + { DW_AT_endianity, "endianity" }, + { DW_AT_elemental, "elemental" }, + { DW_AT_pure, "pure" }, + { DW_AT_recursive, "recursive" }, { DW_AT_MIPS_fde, "MIPS_fde" }, { DW_AT_MIPS_loop_begin, "MIPS_loop_begin" }, { DW_AT_MIPS_tail_loop_begin, "MIPS_tail_loop_begin" }, @@ -166,7 +216,7 @@ const struct { DW_AT_mac_info, "mac_info" }, { DW_AT_src_coords, "src_coords" }, { DW_AT_body_begin, "body_begin" }, - { DW_AT_body_end, "body_end" } + { DW_AT_body_end, "body_end" }, }; #define nattrs (sizeof (attrs) / sizeof (attrs[0])) diff --git a/tests/showptable.c b/tests/showptable.c index afc1f26d..bae17f3b 100644 --- a/tests/showptable.c +++ b/tests/showptable.c @@ -1,15 +1,27 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <config.h> @@ -28,6 +40,12 @@ main (int argc, char *argv[]) GElf_Ehdr ehdr; int cnt; + if (argc < 2) + { + puts ("missing parameter"); + exit (1); + } + fd = open (argv[1], O_RDONLY); if (fd == -1) { diff --git a/tests/test-nlist.c b/tests/test-nlist.c index 40eb320a..f73955f7 100644 --- a/tests/test-nlist.c +++ b/tests/test-nlist.c @@ -1,15 +1,27 @@ -/* Copyright (C) 2000, 2002 Red Hat, Inc. +/* Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #include <nlist.h> #include <stdio.h> @@ -28,7 +40,7 @@ foo (int a) } int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { struct nlist nl[6] = { diff --git a/tests/test-subr.sh b/tests/test-subr.sh new file mode 100644 index 00000000..cb34b93b --- /dev/null +++ b/tests/test-subr.sh @@ -0,0 +1,112 @@ +#! /bin/sh +# Copyright (C) 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +# This file is sourced by ". $srcdir/test-subr.sh" at the start of +# each test script. It defines some functions they use and sets up +# canonical sh state for test runs. + +set -e + +#LC_ALL=C +#export LC_ALL + +remove_files= +trap 'rm -f $remove_files' 0 + +tempfiles() +{ + remove_files="$remove_files $*" +} + +testfiles() +{ + for file; do + bunzip2 -c $srcdir/${file}.bz2 > ${file} 2>/dev/null || exit 77 + remove_files="$remove_files $file" + done +} + +testrun_out() +{ + outfile="$1" + shift + remove_files="$remove_files $outfile" + testrun "$@" > $outfile 2>&1 || : +} + +testrun_compare() +{ + outfile="${1##*/}.out" + testrun_out $outfile "$@" + diff -u $outfile - + # diff's exit status will kill the script. +} + +test_cleanup() +{ + rm -f $remove_files + remove_files= +} + +# See test-wrapper.sh, which sets the environment for this. +testrun() +{ + ${elfutils_testrun}_testrun "$@" +} + +built_testrun() +{ + LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"\ + "$@" +} + +installed_testrun() +{ + program="$1" + shift + case "$program" in + ./*) + if [ "x$elfutils_tests_rpath" != xno ]; then + echo >&2 installcheck not possible with --enable-tests-rpath + exit 77 + fi + ;; + ../*) + program=${bindir}/`program_transform ${program##*/}` + ;; + esac + if [ "${libdir}" != /usr/lib ] && [ "${libdir}" != /usr/lib64 ]; then + LD_LIBRARY_PATH="${libdir}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \ + $program ${1+"$@"} + else + $program ${1+"$@"} + fi +} + +program_transform() +{ + echo "$*" | sed "${program_transform_name}" +} diff --git a/tests/test-wrapper.sh b/tests/test-wrapper.sh new file mode 100755 index 00000000..3477e382 --- /dev/null +++ b/tests/test-wrapper.sh @@ -0,0 +1,68 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +# We don't compile in an rpath because we want "make installcheck" to +# use the installed libraries. So for local test runs we need to point +# the library path at this build. + +# This wrapper script is called by the makefile, in one of two ways: +# $(srcdir)/test-wrapper.sh ../libelf:... run-test.sh ... +# or: +# $(srcdir)/test-wrapper.sh installed s,^,eu-, run-test.sh ... + +if [ "$1" = installed ]; then + shift + elfutils_tests_rpath=$1 + shift + program_transform_name="$1" + shift + elfutils_testrun=installed +else + built_library_path="$1" + shift + elfutils_testrun=built +fi + +case "$1" in +*.sh) + export built_library_path program_transform_name elfutils_testrun + export elfutils_tests_rpath + ;; +*) + if [ $elfutils_testrun = built ]; then + LD_LIBRARY_PATH="$built_library_path${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH + elif [ $elfutils_tests_rpath = yes ]; then + echo >&2 installcheck not possible with --enable-tests-rpath + exit 77 + elif [ "x$libdir" != x/usr/lib ] && [ "x$libdir" != x/usr/lib64 ]; then + LD_LIBRARY_PATH="$libdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH + fi + ;; +esac + +exec "$@" diff --git a/tests/testfile14.bz2 b/tests/testfile14.bz2 Binary files differnew file mode 100644 index 00000000..ac7c69e1 --- /dev/null +++ b/tests/testfile14.bz2 diff --git a/tests/testfile15.bz2 b/tests/testfile15.bz2 Binary files differnew file mode 100644 index 00000000..e75f4575 --- /dev/null +++ b/tests/testfile15.bz2 diff --git a/tests/testfile15.debug.bz2 b/tests/testfile15.debug.bz2 Binary files differnew file mode 100644 index 00000000..5c869001 --- /dev/null +++ b/tests/testfile15.debug.bz2 diff --git a/tests/testfile16.bz2 b/tests/testfile16.bz2 Binary files differnew file mode 100644 index 00000000..4d7160c0 --- /dev/null +++ b/tests/testfile16.bz2 diff --git a/tests/testfile16.debug.bz2 b/tests/testfile16.debug.bz2 Binary files differnew file mode 100644 index 00000000..f02a9723 --- /dev/null +++ b/tests/testfile16.debug.bz2 diff --git a/tests/testfile17.bz2 b/tests/testfile17.bz2 Binary files differnew file mode 100644 index 00000000..5a123204 --- /dev/null +++ b/tests/testfile17.bz2 diff --git a/tests/testfile17.debug.bz2 b/tests/testfile17.debug.bz2 Binary files differnew file mode 100644 index 00000000..86a76ab7 --- /dev/null +++ b/tests/testfile17.debug.bz2 diff --git a/tests/testfile18.bz2 b/tests/testfile18.bz2 Binary files differnew file mode 100644 index 00000000..8b5326cc --- /dev/null +++ b/tests/testfile18.bz2 diff --git a/tests/testfile19.bz2 b/tests/testfile19.bz2 Binary files differnew file mode 100644 index 00000000..f3e6512e --- /dev/null +++ b/tests/testfile19.bz2 diff --git a/tests/testfile19.index.bz2 b/tests/testfile19.index.bz2 Binary files differnew file mode 100644 index 00000000..c0a0a7ac --- /dev/null +++ b/tests/testfile19.index.bz2 diff --git a/tests/testfile20.bz2 b/tests/testfile20.bz2 Binary files differnew file mode 100644 index 00000000..a379f6bf --- /dev/null +++ b/tests/testfile20.bz2 diff --git a/tests/testfile20.index.bz2 b/tests/testfile20.index.bz2 Binary files differnew file mode 100644 index 00000000..08dedaf4 --- /dev/null +++ b/tests/testfile20.index.bz2 diff --git a/tests/testfile21.bz2 b/tests/testfile21.bz2 Binary files differnew file mode 100644 index 00000000..bab7e6d1 --- /dev/null +++ b/tests/testfile21.bz2 diff --git a/tests/testfile21.index.bz2 b/tests/testfile21.index.bz2 Binary files differnew file mode 100644 index 00000000..5192219b --- /dev/null +++ b/tests/testfile21.index.bz2 diff --git a/tests/testfile22.bz2 b/tests/testfile22.bz2 Binary files differnew file mode 100644 index 00000000..8c262709 --- /dev/null +++ b/tests/testfile22.bz2 diff --git a/tests/testfile23.bz2 b/tests/testfile23.bz2 Binary files differnew file mode 100644 index 00000000..cf0ce559 --- /dev/null +++ b/tests/testfile23.bz2 diff --git a/tests/testfile24.bz2 b/tests/testfile24.bz2 Binary files differnew file mode 100644 index 00000000..2320acb3 --- /dev/null +++ b/tests/testfile24.bz2 diff --git a/tests/testfile25.bz2 b/tests/testfile25.bz2 Binary files differnew file mode 100644 index 00000000..51e04213 --- /dev/null +++ b/tests/testfile25.bz2 diff --git a/tests/testfile26.bz2 b/tests/testfile26.bz2 Binary files differnew file mode 100644 index 00000000..1f86285c --- /dev/null +++ b/tests/testfile26.bz2 diff --git a/tests/testfile27.bz2 b/tests/testfile27.bz2 Binary files differnew file mode 100644 index 00000000..9d06cd93 --- /dev/null +++ b/tests/testfile27.bz2 diff --git a/tests/testfile28.bz2 b/tests/testfile28.bz2 Binary files differnew file mode 100644 index 00000000..ca0dff3d --- /dev/null +++ b/tests/testfile28.bz2 diff --git a/tests/testfile28.rdwr.bz2 b/tests/testfile28.rdwr.bz2 Binary files differnew file mode 100644 index 00000000..4c658484 --- /dev/null +++ b/tests/testfile28.rdwr.bz2 diff --git a/tests/testfile29.bz2 b/tests/testfile29.bz2 Binary files differnew file mode 100644 index 00000000..b46451bf --- /dev/null +++ b/tests/testfile29.bz2 diff --git a/tests/testfile29.rdwr.bz2 b/tests/testfile29.rdwr.bz2 Binary files differnew file mode 100644 index 00000000..42eadc70 --- /dev/null +++ b/tests/testfile29.rdwr.bz2 diff --git a/tests/testfile30.bz2 b/tests/testfile30.bz2 Binary files differnew file mode 100644 index 00000000..9ee93c00 --- /dev/null +++ b/tests/testfile30.bz2 diff --git a/tests/testfile31.bz2 b/tests/testfile31.bz2 Binary files differnew file mode 100644 index 00000000..73451d22 --- /dev/null +++ b/tests/testfile31.bz2 diff --git a/tests/testfile32.bz2 b/tests/testfile32.bz2 Binary files differnew file mode 100644 index 00000000..7e3c73e6 --- /dev/null +++ b/tests/testfile32.bz2 diff --git a/tests/testfile33.bz2 b/tests/testfile33.bz2 Binary files differnew file mode 100644 index 00000000..f3dbc73c --- /dev/null +++ b/tests/testfile33.bz2 diff --git a/tests/testfile34.bz2 b/tests/testfile34.bz2 Binary files differnew file mode 100644 index 00000000..a417fcb5 --- /dev/null +++ b/tests/testfile34.bz2 diff --git a/tests/testfile35.bz2 b/tests/testfile35.bz2 Binary files differnew file mode 100644 index 00000000..b5913015 --- /dev/null +++ b/tests/testfile35.bz2 diff --git a/tests/testfile35.debug.bz2 b/tests/testfile35.debug.bz2 Binary files differnew file mode 100644 index 00000000..f1918627 --- /dev/null +++ b/tests/testfile35.debug.bz2 diff --git a/tests/testfile36.bz2 b/tests/testfile36.bz2 Binary files differnew file mode 100644 index 00000000..e912a197 --- /dev/null +++ b/tests/testfile36.bz2 diff --git a/tests/testfile36.debug.bz2 b/tests/testfile36.debug.bz2 Binary files differnew file mode 100644 index 00000000..76aca42e --- /dev/null +++ b/tests/testfile36.debug.bz2 diff --git a/tests/testfile37.bz2 b/tests/testfile37.bz2 Binary files differnew file mode 100644 index 00000000..254ce324 --- /dev/null +++ b/tests/testfile37.bz2 diff --git a/tests/testfile37.debug.bz2 b/tests/testfile37.debug.bz2 Binary files differnew file mode 100644 index 00000000..74e46a87 --- /dev/null +++ b/tests/testfile37.debug.bz2 diff --git a/tests/testfile38.bz2 b/tests/testfile38.bz2 Binary files differnew file mode 100644 index 00000000..42adb774 --- /dev/null +++ b/tests/testfile38.bz2 diff --git a/tests/testfile39.bz2 b/tests/testfile39.bz2 Binary files differnew file mode 100644 index 00000000..42d0fbce --- /dev/null +++ b/tests/testfile39.bz2 diff --git a/tests/testfile40.bz2 b/tests/testfile40.bz2 Binary files differnew file mode 100644 index 00000000..ad41985c --- /dev/null +++ b/tests/testfile40.bz2 diff --git a/tests/testfile40.debug.bz2 b/tests/testfile40.debug.bz2 Binary files differnew file mode 100644 index 00000000..2eec4d7a --- /dev/null +++ b/tests/testfile40.debug.bz2 diff --git a/tests/testfile41.bz2 b/tests/testfile41.bz2 Binary files differnew file mode 100644 index 00000000..f9bf5a48 --- /dev/null +++ b/tests/testfile41.bz2 diff --git a/tests/testfile42.bz2 b/tests/testfile42.bz2 Binary files differnew file mode 100644 index 00000000..2530aba2 --- /dev/null +++ b/tests/testfile42.bz2 diff --git a/tests/testfile43.bz2 b/tests/testfile43.bz2 Binary files differnew file mode 100644 index 00000000..c99db24a --- /dev/null +++ b/tests/testfile43.bz2 diff --git a/tests/testfile44.S.bz2 b/tests/testfile44.S.bz2 Binary files differnew file mode 100644 index 00000000..fb401e52 --- /dev/null +++ b/tests/testfile44.S.bz2 diff --git a/tests/testfile44.expect.bz2 b/tests/testfile44.expect.bz2 Binary files differnew file mode 100644 index 00000000..9e504621 --- /dev/null +++ b/tests/testfile44.expect.bz2 diff --git a/tests/testfile45.S.bz2 b/tests/testfile45.S.bz2 Binary files differnew file mode 100644 index 00000000..58bb16b8 --- /dev/null +++ b/tests/testfile45.S.bz2 diff --git a/tests/testfile45.expect.bz2 b/tests/testfile45.expect.bz2 Binary files differnew file mode 100644 index 00000000..2cf60b77 --- /dev/null +++ b/tests/testfile45.expect.bz2 diff --git a/tests/testfile46.bz2 b/tests/testfile46.bz2 Binary files differnew file mode 100644 index 00000000..db83b278 --- /dev/null +++ b/tests/testfile46.bz2 diff --git a/tests/testfile47.bz2 b/tests/testfile47.bz2 Binary files differnew file mode 100644 index 00000000..334bd6c4 --- /dev/null +++ b/tests/testfile47.bz2 diff --git a/tests/testfile48.bz2 b/tests/testfile48.bz2 Binary files differnew file mode 100644 index 00000000..da0d9dab --- /dev/null +++ b/tests/testfile48.bz2 diff --git a/tests/testfile48.debug.bz2 b/tests/testfile48.debug.bz2 Binary files differnew file mode 100644 index 00000000..7b84c4ca --- /dev/null +++ b/tests/testfile48.debug.bz2 diff --git a/tests/testfile49.bz2 b/tests/testfile49.bz2 Binary files differnew file mode 100644 index 00000000..8741a6b3 --- /dev/null +++ b/tests/testfile49.bz2 diff --git a/tests/update1.c b/tests/update1.c index decb09ba..6c038c9a 100644 --- a/tests/update1.c +++ b/tests/update1.c @@ -1,16 +1,28 @@ /* Test program for elf_update function. - Copyright (C) 2000, 2002 Red Hat, Inc. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -25,7 +37,7 @@ int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { const char *fname = "xxx"; int fd; diff --git a/tests/update2.c b/tests/update2.c index c595fba7..330e731f 100644 --- a/tests/update2.c +++ b/tests/update2.c @@ -1,16 +1,28 @@ /* Test program for elf_update function. - Copyright (C) 2000, 2002 Red Hat, Inc. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -25,7 +37,7 @@ int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { const char *fname = "xxx"; int fd; diff --git a/tests/update3.c b/tests/update3.c index 06bc8ff6..756d0159 100644 --- a/tests/update3.c +++ b/tests/update3.c @@ -1,16 +1,28 @@ /* Test program for elf_update function. - Copyright (C) 2000, 2002 Red Hat, Inc. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -23,11 +35,11 @@ #include <stdlib.h> #include <string.h> -#include <libebl.h> +#include ELFUTILS_HEADER(ebl) int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { const char *fname = "xxx"; int fd; diff --git a/tests/update4.c b/tests/update4.c index 17ef4702..e4263783 100644 --- a/tests/update4.c +++ b/tests/update4.c @@ -1,16 +1,28 @@ /* Test program for elf_update function. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. + Red Hat elfutils 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; version 2 of the License. - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -24,11 +36,11 @@ #include <string.h> #include <unistd.h> -#include <libebl.h> +#include ELFUTILS_HEADER(ebl) int -main (int argc, char *argv[]) +main (int argc, char *argv[] __attribute__ ((unused))) { const char fname[] = "xxx"; int fd; diff --git a/version.h b/version.h new file mode 100644 index 00000000..d1664197 --- /dev/null +++ b/version.h @@ -0,0 +1,58 @@ +/* Version information about elfutils development libraries. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat elfutils is distributed in the hope that 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifndef _ELFUTILS_VERSION_H +#define _ELFUTILS_VERSION_H 1 + +#define _ELFUTILS_VERSION 138 + +#define _ELFUTILS_PREREQ(major, minor) \ + (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) + +#endif /* elfutils/version.h */ |